Skip to content

Add copy_path tool#24011

Open
luisorofino wants to merge 5 commits into
loa/openmetrics-ai-genfrom
loa/copy-path-tool
Open

Add copy_path tool#24011
luisorofino wants to merge 5 commits into
loa/openmetrics-ai-genfrom
loa/copy-path-tool

Conversation

@luisorofino

@luisorofino luisorofino commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a copy_path tool to the AI agent filesystem toolkit. It copies a file or an entire directory tree from a source path to a destination path without reading the content into the conversation context.

  • Delegates to shutil.copy2 for files and shutil.copytree (with dirs_exist_ok=True) for directories.
  • Creates missing parent directories automatically.
  • Enforces the existing FileAccessPolicy: source must pass assert_readable (if source is a directory, every child must pass it), destination must pass assert_writable.
  • Returns a brief confirmation (byte count for files, file count for directories) rather than the content itself.

Motivation

The OpenMetrics flow needs to copy files like metrics.txt between working directories as part of its pipeline. Using read_file + create_file for this would pull potentially large or binary content into the agent's context window unnecessarily. copy_path handles the operation at the OS level, keeping the agent context clean and making binary-safe copies the default.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc54f204a1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ddev/src/ddev/ai/tools/fs/copy_path.py
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 11, 2026

Copy link
Copy Markdown

Pipelines  Tests  Code Coverage

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

Validate repository | Run Validations / Validate   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 88.07%

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: fb2ef57 | Docs | Datadog PR Page | Give us feedback!

Comment thread ddev/src/ddev/ai/tools/fs/copy_path.py Outdated
Comment thread ddev/tests/ai/tools/fs/test_copy_path.py Outdated
Comment thread ddev/src/ddev/ai/tools/fs/copy_path.py
Comment thread ddev/src/ddev/ai/tools/fs/copy_path.py Outdated
Comment thread ddev/tests/ai/tools/fs/test_copy_path.py Outdated
Comment thread ddev/src/ddev/ai/tools/fs/copy_path.py
@dd-octo-sts

dd-octo-sts Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Validation Report

Validation Description Status
qa-label Validate the pull request declares whether it needs QA for the next Agent release

Run ddev validate all changed --fix to attempt to auto-fix supported validations.

Passed validations (20)
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants