Skip to content

[AI-7080] Add snapshot flow inputs - #25180

Draft
luisorofino wants to merge 4 commits into
loa/openmetrics-ai-genfrom
loa/snapshot-flow-inputs
Draft

luisorofino wants to merge 4 commits into
loa/openmetrics-ai-genfrom
loa/snapshot-flow-inputs

Conversation

@luisorofino

@luisorofino luisorofino commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

This is PR 1 of 3 in a stacked series:

  1. [AI-7080] Add snapshot flow inputs #25180 — add the snapshot input mode and the per-run capture behind it <- you are here
  2. [AI-7080] Give agents the PRD as a path #25181 — declare the built-in PRD input as a snapshot and point the openmetrics prompts at the file
  3. [AI-7080] Report snapshot inputs that changed since launch #25182 — tell the user when a resumed run's input file has changed since launch

What does this PR do?

Adds a snapshot flag to flow inputs, alongside the existing as_content. A snapshot input is validated at launch exactly as an as_content one is — it must exist, be a regular file, and decode as UTF-8 — but it converts to a canonical absolute path instead of the file's text. It is rejected on a non-path input, on a multi input, on an object field, and in combination with as_content.

Before any phase runs, the orchestrator copies every snapshot input into the run directory at inputs/files/<name><suffix>, marks the copy read-only, and repoints the input's runtime variable at it. Each run also gets an inputs/manifest.yaml recording the original path, sha256, size, and capture time.

Resuming reuses the copy the run started with rather than re-reading the original. The resume dialog shows an already-captured input read-only — its recorded source and capture time — instead of collecting the path again, so a run restarts even if that file has since been edited, moved, or deleted. Divergence between the copy and the recorded source is detected and logged; PR 3 surfaces it in the TUI.

Flow resolution now rejects a phase that consumes a snapshot input when its agent does not declare the read_file tool. Without that check, such an agent would silently receive a path it cannot open — no error, just worse output.

Nothing declares a snapshot input yet, so this PR changes no behavior on its own.

Motivation

AI-7080.

Togo inlines the full PRD text into every worker prompt and goal-review prompt that references it, so a large PRD repeatedly consumes context across a run. Handing agents a path instead would fix that, but pointing them at the user's original file would make a resumed run depend on something that may have changed since it started — different phases could then work from different versions of the same requirements.

Capturing the file once per run gives the token saving without that cost: every phase and reviewer resolves the same immutable copy, and the run keeps enough provenance to identify what it was launched with.

The mechanism is a general input mode rather than a special case for the PRD, so any flow can declare a path input it wants pinned for the lifetime of a run.

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

@luisorofino luisorofino added the qa/skip-qa Automatically skip this PR for the next QA label Sep 10, 2026
@dd-octo-sts dd-octo-sts Bot added the ddev label Sep 10, 2026
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

evalya-impact-summary

evalya impact analysis
Impact analysis: 0 selected, 0 skipped (of 0 test tasks)
Publish tasks:   2 (always emitted)
Diff (241 files):
  .gitignore
  ddev/hatch.toml
  ddev/pyproject.toml
  ddev/src/ddev/ai/__init__.py
  ddev/src/ddev/ai/agent/__init__.py
  ddev/src/ddev/ai/agent/anthropic_agent.py
  ddev/src/ddev/ai/agent/anthropic_provider.py
  ddev/src/ddev/ai/agent/base.py
  ddev/src/ddev/ai/agent/build.py
  ddev/src/ddev/ai/agent/exceptions.py
  ddev/src/ddev/ai/agent/provider.py
  ddev/src/ddev/ai/agent/registry.py
  ddev/src/ddev/ai/agent/scope.py
  ddev/src/ddev/ai/agent/types.py
  ddev/src/ddev/ai/callbacks/__init__.py
  ddev/src/ddev/ai/callbacks/callbacks.py
  ddev/src/ddev/ai/config/__init__.py
  ddev/src/ddev/ai/config/classify.py
  ddev/src/ddev/ai/config/dependency_graph.py
  ddev/src/ddev/ai/config/engine.py
  ... and 221 more

Debug a specific task: evalya plan impact --path <path> --task <task>

Learn more about CI impact filtering

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog retried 1 test - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
• Patch Coverage: 95.69%
• Overall Coverage: 89.85%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e891d43 | Docs | View more details | Give us feedback!

@luisorofino luisorofino changed the title Add snapshot flow inputs [AI-7080] Add snapshot flow inputs Sep 10, 2026
@luisorofino

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 8ce4daff1b

ℹ️ 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/config/models.py Resolved
@luisorofino
luisorofino marked this pull request as ready for review September 10, 2026 14:47
@luisorofino
luisorofino requested a review from a team as a code owner September 10, 2026 14:47

@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: 844d4578e5

ℹ️ 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".

@luisorofino
luisorofino force-pushed the loa/snapshot-flow-inputs branch from d5e5a66 to ff30482 Compare September 14, 2026 08:23
Flow inputs can now declare `snapshot: true`. Such an input is validated at
launch like an `as_content` one but reaches the flow as a path rather than as
inlined text, and the file it names is copied into the run directory before any
phase starts.

Every phase, task, and goal reviewer in a run resolves the same read-only copy,
so the input cannot change underneath a run. Resuming reuses the copy the run
started with instead of re-reading the original, and `inputs/manifest.yaml`
records the source path, digest, and size so a run can be traced back to what it
was launched with.

Flow resolution rejects a phase that consumes a snapshot input when its agent
does not declare the `read_file` tool, which would otherwise leave the agent
holding a path it cannot open.
@luisorofino
luisorofino force-pushed the loa/snapshot-flow-inputs branch from ff30482 to cafaeda Compare September 18, 2026 10:31
@luisorofino
luisorofino force-pushed the loa/snapshot-flow-inputs branch from cafaeda to 61f4305 Compare September 18, 2026 10:44
@luisorofino
luisorofino marked this pull request as draft September 18, 2026 14:44
@chouetz chouetz added the internal Identify a non-fork PR label Oct 2, 2026

@AAraKKe AAraKKe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

note: Reviewed the snapshot capture, launch/resume wiring, and reader-tool validation. The focused existing tests passed (7 in the wiring selection, then all 11 snapshot-helper tests). Two blocking requests remain: the private-file permissions issue, with a reproduction added to the existing thread, and the case-insensitive filename collision below. Both reproduced at this head.

Comment on lines +155 to +157
path = captures_dir / f"{name}{source.suffix}"
path.unlink(missing_ok=True)
path.write_bytes(content)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

request: Snapshot inputs named Spec and spec are both accepted, but with .md sources their destinations are the same file on a case-insensitive macOS or Windows volume. The second capture unlinks and replaces the first, so both runtime paths read the second input. I reproduced this on macOS with source contents A and B: first.samefile(second) returned True and both copies read B, while the manifest retained distinct source hashes. Please reject colliding names before capture or use filenames that remain distinct on these filesystems so one input cannot silently replace another.

@dd-octo-sts

dd-octo-sts Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had activity in the past 15 days.

It will be closed in 30 days if no further activity occurs. If this pull request is still relevant, adding a comment or pushing new commits will keep it open. Also, you can always reopen the pull request if you missed the window.

Thank you for your contributions!

@dd-octo-sts dd-octo-sts Bot added the stale label Nov 7, 2026
@dd-octo-sts

dd-octo-sts Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 22 validations passed.

Show details
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, naming, and wheel contents ✅
pr-description Validate the pull request checklist and visible description length ✅
qa-label Validate the pull request declares whether it needs QA for the next Agent release ✅
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

This branch has not been deployed

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

Labels

ddev internal Identify a non-fork PR qa/skip-qa Automatically skip this PR for the next QA stale team/agent-integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants