Skip to content

[AI-7080] Give agents the PRD as a path - #25181

Draft
luisorofino wants to merge 1 commit into
loa/snapshot-flow-inputsfrom
loa/prd-as-snapshot-input
Draft

luisorofino wants to merge 1 commit into
loa/snapshot-flow-inputsfrom
loa/prd-as-snapshot-input

Conversation

@luisorofino

@luisorofino luisorofino commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

This is PR 2 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
  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 <- you are here
  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?

Flips the built-in prd flow input from as_content to snapshot, so it is captured once per run and reaches prompts as a path to that copy instead of as inlined text.

The four openmetrics prompts that quoted the PRD verbatim inside a fenced block now name the file and require the agent to read it in full before proceeding: phase2_code, phase2_code_goal, phase3_tests, and phase3_tests_goal.

Test expectations for the launch modal move from the PRD's contents to the path it now converts to. The launch-modal harness exposes that value as expected_prd, and the flow-screen helper returns it, so the assertion lives in one place per suite rather than in each test that happens to carry a PRD alongside what it is really testing.

Motivation

AI-7080.

The PRD was interpolated into three places per task: the worker prompt, the goal, and — through the rendered task prompt that build_reviewer_user_message embeds — the goal-review message as well. Every validation retry rebuilt all three. A large PRD was therefore paid for repeatedly across a run, crowding out task-specific context.

With a path, an agent loads the requirements when it needs them. The saving is one read per agent context rather than one copy per prompt: a task that clears context before running re-reads the file, which is still far less than inlining it into every turn.

Verified before making the change that all four openmetrics agents already declare the read_file tool, and that goal reviewers keep it — filter_read_only preserves it because it is marked read-only in the tool manifest. The resolution check added in #25180 now enforces that for any future agent.

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
@datadog-official

datadog-official Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Tests  Code Coverage

✅ All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 89.85% (-0.00%)

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

@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

@luisorofino luisorofino changed the title Give agents the PRD as a path [AI-7080] Give agents the PRD as a path Sep 10, 2026
@luisorofino

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: ddb616b9e1

ℹ️ 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/prd-as-snapshot-input branch from ddb616b to 5c038a1 Compare September 10, 2026 14:07
@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: 5c038a13e9

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

input_type=InputType.PATH,
required=True,
as_content=True,
snapshot=True,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve a selected snapshot before clearing the run directory

When a fresh launch uses a PRD located under that flow's existing .ddev/ai-runs/<slug> directory—most notably the inputs/files/prd.* copy from a prior run—the modal accepts the file and returns its path, but ExecutionScreen._build_real_orchestrator() deletes the run directory before PhaseOrchestrator.on_initialize() calls snapshot_path_inputs(). _capture() then raises FileNotFoundError, so a valid captured PRD cannot be reused for a new run; preserve or copy such sources before clearing the directory.

Useful? React with 👍 / 👎.

@luisorofino luisorofino Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The .ddev/ai-runs/<slug> dir is not meant to be used as the source of PRD. It's just the "leftover" of previous runs, so you can inspect the logs after. If someone wants to use a PRD, they will have it outside that folder. The files in that folder are either copies of outside ones (like PRDs) or logs and checkpoints from previous runs.

@luisorofino
luisorofino force-pushed the loa/prd-as-snapshot-input branch from 5c038a1 to d43041c Compare September 14, 2026 08:23
@luisorofino
luisorofino force-pushed the loa/prd-as-snapshot-input branch from d43041c to 40e8c0c Compare September 18, 2026 10:31
@luisorofino
luisorofino force-pushed the loa/prd-as-snapshot-input branch from 40e8c0c to e7bedb5 Compare September 18, 2026 10:44
The built-in `prd` input becomes a snapshot input, so it is captured once per run
and reaches prompts as a path to that copy instead of as inlined text.

The PRD was previously interpolated into the worker prompt, the goal, and — via
the rendered task prompt the reviewer receives — the goal-review message as well,
on every task and every validation retry. A large PRD therefore consumed context
repeatedly across a run. The openmetrics prompts that quoted it verbatim now
point at the file and require the agent to read it in full first.
@luisorofino
luisorofino force-pushed the loa/prd-as-snapshot-input branch from e7bedb5 to 4676e77 Compare September 18, 2026 11:02
@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 PRD input switch and all four OpenMetrics worker/goal prompts against the snapshot-input branch. The prompts require reading the PRD in full, and read_file remains available to the goal reviewers. The focused resolver tests passed (5), as did the selected launch-payload and path-validation tests (3). No new correctness findings in this PR's delta; the snapshot capture requests are on #25180.

@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