From ae78d58a1eb59bafb7e34e0773e331856a8fb5f2 Mon Sep 17 00:00:00 2001 From: "devops-cli-service[bot]" <349441588+devops-cli-service[bot]@users.noreply.github.com> Date: Sun, 8 Nov 2026 09:39:40 +0000 Subject: [PATCH] docs(openspec): plan #3266 Refuse feasibility claims the run did not make Plans #3266. --- .../.openspec.yaml | 2 + .../design.md | 20 ++++++ .../proposal.md | 56 ++++++++++++++++ .../specs/roadmap-stage-eval/spec.md | 8 +++ .../specs/roadmap-stage/spec.md | 42 ++++++++++++ .../tasks.md | 66 +++++++++++++++++++ 6 files changed, 194 insertions(+) create mode 100644 openspec/changes/3266-refuse-feasibility-claims-the-run-did/.openspec.yaml create mode 100644 openspec/changes/3266-refuse-feasibility-claims-the-run-did/design.md create mode 100644 openspec/changes/3266-refuse-feasibility-claims-the-run-did/proposal.md create mode 100644 openspec/changes/3266-refuse-feasibility-claims-the-run-did/specs/roadmap-stage-eval/spec.md create mode 100644 openspec/changes/3266-refuse-feasibility-claims-the-run-did/specs/roadmap-stage/spec.md create mode 100644 openspec/changes/3266-refuse-feasibility-claims-the-run-did/tasks.md diff --git a/openspec/changes/3266-refuse-feasibility-claims-the-run-did/.openspec.yaml b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/.openspec.yaml new file mode 100644 index 0000000000..c0ad5ed4dd --- /dev/null +++ b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-08 diff --git a/openspec/changes/3266-refuse-feasibility-claims-the-run-did/design.md b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/design.md new file mode 100644 index 0000000000..1d988fc03a --- /dev/null +++ b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/design.md @@ -0,0 +1,20 @@ +# Design + +## Decisions + +- **Give `check_proposal` an optional `trace` keyword that holds a `TraceFacts` value.**: `src/devops_cli/roadmap/stage/stage_change.py:def check_proposal` already collects every problem of a reply and is called by the job, the replay and the plan check, so one keyword reaches every caller and no reply goes back to the model from two places. +- **Build `TraceFacts` from the trace of the reply's run in `src/devops_cli/roadmap/agent_run.py`, with the tool names and the `path`, `directory` and `paths` values of each JSON argument.**: `src/devops_cli/roadmap/agent_run.py:class RunTrace` holds no paths, and a code-span path claim needs them. The value keeps the check free of the message structure of a trace and keeps its signature short. +- **Read the tool names from the registry `TOOLS` and `tool_names` of `src/devops_cli/roadmap/tools.py`.**: `src/devops_cli/roadmap/stage/stage_tools.py` already imports `HOLDER_STAGE, HOLDER_STAGE_EXTENDED, tool_names` from that module, so a new tool joins the check without a second edit and no tuple of names is copied. +- **Refuse an affirmative claim only, and let a line that negates the read pass.**: The prompt asks the model to write `not checked` for a premise that the run did not check, so a negation is the supported form and a refusal of it would refuse the text that the rule asks for. +- **Skip the comparison when the caller passes no facts, and refuse every affirmative claim when the facts are empty.**: The replay of a case with no `trace` fact and the plan check have no run, and empty facts would refuse the recorded good plans. An empty `TraceFacts` is a run with zero calls, and the issue asks for its refusal. +- **Pass the facts as a keyword input of `gate_arguments` in `src/devops_cli/roadmap/stage/stage_request.py`, and add a `trace` fact to the facts of a case in `src/devops_cli/roadmap/stage/stage_eval_cases.py`.**: `gate_arguments` holds the inputs that depend on the commit and on the reply, and the trace changes with each ask. The replay reads no git and calls no model, so the trace of a recorded run comes from the case. +- **State the rule in both `src/devops_cli/ai/tasks/roadmap_stage_change.md` and `docs/roadmap/stage.md`.**: The model needs the rule to avoid the refusal, and `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py` keeps the prompt and the page in step. + +## Rejected alternatives + +- **Give `check_proposal` the whole `RunTrace`.**: `src/devops_cli/roadmap/agent_run.py:class RunTrace` holds `tool_calls: list[ToolCallRecord]` with the argument as cut, masked text, and no path, so the check would parse the message structure for a value that a small dataclass holds once. +- **Add a separate gate module for the trace rule.**: `check_proposal` has eight callers, among them `src/devops_cli/roadmap/stage/stage.py` and `src/devops_cli/roadmap/plan_check.py`, and a second module repeats the reply parsing of each of them. +- **Enforce the rule in the planner prompt only.**: The acceptance criteria of #3266 ask for a refusal, and a prompt rule is no gate: the two reported plans passed the checks with a false claim. +- **Add a constant tuple of tool names in `src/devops_cli/roadmap/stage/stage_tools.py`.**: `src/devops_cli/roadmap/tools.py` already holds `TOOLS: Final[dict[str, ToolEntry]]` and `def tool_names(`, and `src/devops_cli/roadmap/stage/stage_tools.py` imports `tool_names`, so a second list of names would drift from the first. +- **Refuse any occurrence of the words `read` or `ran` in `## Feasibility`.**: The prompt asks for `not checked` where the run checked nothing, and a plan that quotes a requirement or states a gap would be refused for the words that the rule asks it to write. +- **Treat a case with no `trace` fact as a run of zero calls.**: The golden set holds the recorded good plans of earlier items, and the replay would refuse each affirmative read claim in them, so a good case would fail the `paths` gate. diff --git a/openspec/changes/3266-refuse-feasibility-claims-the-run-did/proposal.md b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/proposal.md new file mode 100644 index 0000000000..7fbaf6a843 --- /dev/null +++ b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/proposal.md @@ -0,0 +1,56 @@ +# Proposal + +## Why + +#3266 reports two plans whose `## Feasibility` cites `read_file` and `search_code` results while the stage comment says the run made no tool call. Nothing compares the claims of a plan with the trace of the run that wrote it, so a plan presents an unchecked premise as checked. The premise probe of #3176 checks that a cited path exists, and not that the run read it. + +## What Changes + +- Add `TraceFacts` to `src/devops_cli/roadmap/agent_run.py`: the tool names and the `path`, `directory` and `paths` values of each call argument, read from a `RunTrace`. +- Add a `trace` keyword to `check_proposal` and `check_gates` in `src/devops_cli/roadmap/stage/stage_change.py`, and refuse an affirmative tool name or code-span read claim that the facts do not support. +- Pass the facts of the reply's run to the gates in `src/devops_cli/roadmap/stage/stage.py`, and add `trace` to the keyword inputs of `gate_arguments` in `src/devops_cli/roadmap/stage/stage_request.py`. +- Read the `trace` fact of a case in `src/devops_cli/roadmap/stage/stage_eval_cases.py` and pass it to `check_proposal` in `src/devops_cli/roadmap/stage/stage_eval_gates.py`, so the replay judges the rule with no run. +- State the rule in `src/devops_cli/ai/tasks/roadmap_stage_change.md` and in `docs/roadmap/stage.md`. +- Add a golden-set replay case from #3205 under `tests/fixtures/roadmap_eval/stage/` whose facts give a trace of zero calls, and the unit tests of each branch of the check. +- The change adds a refusal that the stage job reports, which a consumer observes, so it carries a delta of `roadmap-stage` and of `roadmap-stage-eval`. +- The change fits one pull request. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `roadmap-stage`: Feasibility cites only what the plan run did, Trace facts of a run, The planner prompt cites only the run +- `roadmap-stage-eval`: The golden set holds a plan whose read claim its trace does not support + +## Impact + +- Code: `src/devops_cli/roadmap/agent_run.py`, `src/devops_cli/roadmap/stage/stage_change.py`, `src/devops_cli/roadmap/stage/stage_request.py`, `src/devops_cli/lang/en/messages.py`, `src/devops_cli/roadmap/stage/stage.py`, `src/devops_cli/roadmap/stage/stage_eval_cases.py`, `src/devops_cli/roadmap/stage/stage_eval_gates.py` +- Documents: `src/devops_cli/ai/tasks/roadmap_stage_change.md`, `docs/roadmap/stage.md`, `docs/ROADMAP_WORKFLOW.md` +- Tests: `tests/ai/client/test_roadmap_agent_run.py`, `tests/roadmap/stage/test_roadmap_stage_content.py`, `tests/roadmap/stage/test_roadmap_stage_gates.py`, `tests/roadmap/stage/test_roadmap_stage_eval_gates.py`, `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`, `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/case.json`, `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/issue.txt`, `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/plan.json`, `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/facts.json`, `tests/roadmap/stage/test_roadmap_stage_eval_cases.py` + +## Feasibility + +- The probe confirms the cited paths, with two corrections: `The path `tests/roadmap/test_roadmap_stage_prompt_rules.py` is no file at the root of the staging commit. These files of the commit are candidates: `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`. Commit bff2f14f 2026-11-06 refactor(roadmap): group the job modules in subpackages (#3897) deleted or renamed it.` So the prompt-rule test lives at `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`, and the modules that the issue cites under `src/devops_cli/roadmap/` now sit under `src/devops_cli/roadmap/stage/`. +- `list_files` of `src/devops_cli/roadmap/stage` shows `stage_change.py`, `stage_tools.py`, `stage_toolbox.py`, `stage_eval_cases.py`, `stage_eval_gates.py` and `stage_request.py`, so every module of the plan is a file of the staging commit. +- The premise holds at the moved path: `file_symbols` of `src/devops_cli/roadmap/stage/stage_change.py` shows `def content_problems` at line 1101, `class ProposalGate` at line 1131, `def check_gates` at line 1155 and `def check_proposal` at line 1203, so one function collects the problems of a reply and one place takes the new keyword. +- The premise holds: `src/devops_cli/roadmap/stage/stage_change.py:160:_PLAN_CHECK_FILE: Final[str] = "src/devops_cli/roadmap/stage/stage_change.py"` with `_SELF_ACCEPTANCE_MARKS` at line 161 shows that a plan adding a rule of the check gives a group test that builds its own `StageProposal`, so this plan gives that test. +- The premise holds: `src/devops_cli/roadmap/stage/stage_change.py:110:_TOKEN_COST` holds `r"\d+(?:[.,]\d+)*\s*k?\s*tokens?\b"`, and `content_problems` refuses a plan that `builds_own` and gives no cost, so this plan states `80k tokens` and `4 hours` in `existing_tool`. +- The premise holds: `src/devops_cli/roadmap/stage/stage_toolbox.py:116` holds `self.traces: list[RunTrace] = [] if traces is None else traces` and `src/devops_cli/roadmap/stage/stage_toolbox.py:141` holds `self.traces.append(trace)`, so the client appends one trace for each ask. +- The premise holds: `src/devops_cli/roadmap/stage/stage.py:910` holds `self._traces.clear()`, and `src/devops_cli/roadmap/stage/stage.py:924` holds `proposal = self._ask(StageProposal, _CHANGE_TASK, request.for_model())` under `_gated`, so the planner reads the trace of the reply's ask after the ask returns. +- The premise holds: `src/devops_cli/roadmap/stage/stage_request.py:def gate_arguments` returns the keyword arguments of `check_proposal`, and `src/devops_cli/roadmap/stage/stage.py:1164` holds `**gate_arguments(`, so one keyword reaches every gate call of the job. +- The premise holds: `src/devops_cli/roadmap/stage/stage_eval_cases.py:70` holds `CASES_DIRECTORY: Final[Path] = Path("tests/fixtures/roadmap_eval/stage")`, `class CaseFacts` at line 157 holds `tracked`, `capabilities`, `search_evidence` and `constants`, and `src/devops_cli/commands/roadmap_eval_stage.py:34` holds `report = replay_all(select_cases(load_cases(cases_dir), names, limit))`, so the replay judges every case of the folder with no model and no git. +- The callers of `check_proposal` are `src/devops_cli/roadmap/stage/stage.py`, `src/devops_cli/roadmap/stage/stage_eval_gates.py`, `src/devops_cli/roadmap/stage/stage_eval_run.py`, `src/devops_cli/roadmap/stage/stage_overlap.py`, `src/devops_cli/roadmap/stage/stage_specs.py`, `src/devops_cli/roadmap/stage/stage_verify.py`, `src/devops_cli/roadmap/implement/implement.py` and `src/devops_cli/roadmap/plan_check.py`, and each keeps its call with no facts, because the keyword defaults to `None`. +- The first checks of the implementation, each on the real system: `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_content.py` for the gate, `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_eval_cases.py` for the case, `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py` for the prompt rule, and `uv run devops roadmap eval stage --replay` for the score before and after, as `docs/ROADMAP_WORKFLOW.md` requires. +- Each function that the plan calls and that needs a checkout, a client or a network: `TraceFacts.of(trace)` needs no checkout, no client and no network, because it reads a `RunTrace` in memory. `StageTools.tools()` needs a checkout of the repository, because the tools read the commit at `sha`. `ToolboxClient.__init__` needs a checkout of the repository and, for `read_issue` and `find_issues`, a client of the GitHub service. `checkout_problem()` needs a checkout of the repository, because it runs `git rev-parse` and `git status`. `_read_staged_file` needs a checkout of the repository, because it runs `git show` on the staged commit. `replay_case` and `devops roadmap eval stage --replay` need no client and no network: they read the case files and call no model. + +## Existing Tool Considered + +No open, maintained tool or library covers the need. The check compares this repository's stage reply with this repository's `RunTrace`, and no upstream project holds either. The change builds its own code, about 60 lines of `TraceFacts` and one check function, and deletes no internal code. Written cost: 80k tokens to build, 20k tokens to keep and fix, and 4 hours of elapsed work. + +## Dependencies + +- #4142: `docs/roadmap/stage.md` and `docs/ROADMAP_WORKFLOW.md` — the open pull request of #4142 changes the same two documents, so it merges before this plan writes its sentence into them. diff --git a/openspec/changes/3266-refuse-feasibility-claims-the-run-did/specs/roadmap-stage-eval/spec.md b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/specs/roadmap-stage-eval/spec.md new file mode 100644 index 0000000000..5ce5c83da7 --- /dev/null +++ b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/specs/roadmap-stage-eval/spec.md @@ -0,0 +1,8 @@ +## ADDED Requirements + +### Requirement: The golden set holds a plan whose read claim its trace does not support +The golden set SHALL hold a replay case from #3205 or #3237 whose facts give a trace of zero calls, and the replay SHALL refuse its unsupported read claim. + +#### Scenario: The replay refuses the case +- **WHEN** `devops roadmap eval stage --replay` runs on the golden set. +- **THEN** The case is present, and the `paths` gate refuses its unsupported read claim. diff --git a/openspec/changes/3266-refuse-feasibility-claims-the-run-did/specs/roadmap-stage/spec.md b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/specs/roadmap-stage/spec.md new file mode 100644 index 0000000000..11a97449f7 --- /dev/null +++ b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/specs/roadmap-stage/spec.md @@ -0,0 +1,42 @@ +## ADDED Requirements + +### Requirement: Feasibility cites only what the plan run did +The stage job SHALL refuse a feasibility line that names a toolbox tool, or states that a code-span path was read, when the trace of the run that wrote the reply holds no call that supports it, and SHALL accept a line that negates the claim. + +#### Scenario: A read claim with no tool call +- **WHEN** The trace holds zero calls and the feasibility section says `read `src/x.py``. +- **THEN** `check_proposal` returns a problem that names `src/x.py` and the absent read. + +#### Scenario: A read claim that the trace supports +- **WHEN** The trace holds a `read_file` call for `src/x.py` and the feasibility section says `read `src/x.py``. +- **THEN** `check_proposal` returns no problem for that line. + +#### Scenario: A tool name that the trace lacks +- **WHEN** The trace holds no `search_code` call and the feasibility section says `search_code` returned a result. +- **THEN** `check_proposal` returns a problem that names `search_code`. + +#### Scenario: A stated gap +- **WHEN** The trace holds zero calls and the feasibility section says `not read `src/x.py``. +- **THEN** `check_proposal` returns no problem for that line. + +#### Scenario: A caller with no run +- **WHEN** `check_proposal` gets no trace facts and the feasibility section says `read `src/x.py``. +- **THEN** `check_proposal` returns no trace problem, and its other checks run as before. + +### Requirement: Trace facts of a run +`TraceFacts.of` SHALL hold the tool name of each call of a `RunTrace` and the `path`, `directory` and `paths` values of an argument that parses as JSON, and the stage job SHALL pass the facts of the run that wrote each reply to `check_proposal`. + +#### Scenario: A trace with two calls +- **WHEN** The trace holds a `read_file` call for `src/x.py` and a `search_code` call for `needle`. +- **THEN** The facts hold the tools `read_file` and `search_code`, and the path `src/x.py`. + +#### Scenario: The stage job calls the check +- **WHEN** The planner gets a reply from a toolbox run that called `read_file` for `src/x.py`. +- **THEN** The `check_proposal` call for that reply holds the facts with the tool `read_file` and the path `src/x.py`. + +### Requirement: The planner prompt cites only the run +The planner prompt and `docs/roadmap/stage.md` SHALL state that a plan cites only the tools and the paths that its run used, and that a premise that the run did not check is written as `not checked`. + +#### Scenario: The prompt rule is present +- **WHEN** The stage prompt and `docs/roadmap/stage.md` are read. +- **THEN** Both hold the same sentence of the rule, and the tests in `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py` pass. diff --git a/openspec/changes/3266-refuse-feasibility-claims-the-run-did/tasks.md b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/tasks.md new file mode 100644 index 0000000000..c341cd0e2d --- /dev/null +++ b/openspec/changes/3266-refuse-feasibility-claims-the-run-did/tasks.md @@ -0,0 +1,66 @@ +# Tasks + +## 1. Add TraceFacts and its unit test + +Reads: `src/devops_cli/roadmap/agent_run.py`, `src/devops_cli/roadmap/tools.py`, `tests/ai/client/test_roadmap_agent_run.py`. Changes: `src/devops_cli/roadmap/agent_run.py`, `tests/ai/client/test_roadmap_agent_run.py`. + +- [ ] 1.1 In `tests/ai/client/test_roadmap_agent_run.py`, add a case that builds a `RunTrace` with a `read_file` call for `src/devops_cli/roadmap/agent_run.py` and a `search_code` call for `needle`, and asserts that `TraceFacts.of` holds the tools `read_file` and `search_code` and that path. Add a case of a zero-call trace with empty `tools` and `paths` + - Verification: `$ uv run devops ci test tests/ai/client/test_roadmap_agent_run.py` fails on the base +- [ ] 1.2 Add the frozen dataclass `TraceFacts` with `tools: frozenset[str]` and `paths: frozenset[str]` and the class method `of(trace: RunTrace)`, which reads the tool name of each call and the `path`, `directory` and `paths` values of `json.loads(record.argument)`. A value that is no string, and an argument that is no JSON object, adds nothing. The method never raises + - Verification: `$ uv run devops ci test tests/ai/client/test_roadmap_agent_run.py` passes + +## 2. Refuse an unsupported feasibility claim in the gates + +Reads: `src/devops_cli/roadmap/stage/stage_change.py`, `src/devops_cli/roadmap/stage/stage_request.py`, `src/devops_cli/roadmap/tools.py`, `src/devops_cli/roadmap/implement/implement.py`, `src/devops_cli/roadmap/plan_check.py`, `src/devops_cli/roadmap/stage/stage_eval_run.py`, `src/devops_cli/roadmap/stage/stage_overlap.py`, `src/devops_cli/roadmap/stage/stage_specs.py`, `src/devops_cli/roadmap/stage/stage_verify.py`, `tests/roadmap/stage/test_roadmap_stage_content.py`. Changes: `src/devops_cli/roadmap/stage/stage_change.py`, `src/devops_cli/roadmap/stage/stage_request.py`, `src/devops_cli/lang/en/messages.py`, `tests/roadmap/stage/test_roadmap_stage_content.py`. + +- [ ] 2.1 In `tests/roadmap/stage/test_roadmap_stage_content.py`, add a case of a zero-call trace whose feasibility says `read `src/devops_cli/roadmap/agent_run.py`` and assert one problem that names that path. Add a case whose trace read the path and assert no problem for that line, a case of a missing `search_code` call, a case of `not read` the path, and a case with no trace facts. Add a case that builds this plan's own `StageProposal` and asserts that `content_problems` returns no problem for it + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_content.py` fails on the base +- [ ] 2.2 Add the gate `TRACE = "trace"` to `ProposalGate` and the keyword `trace: TraceFacts | None = None` to `check_proposal` and `check_gates`, with a line in `check_gates` for `_trace_problems(proposal, trace)`. The function returns no problem for `None`. For each sentence of `proposal.feasibility` that holds a toolbox tool name in a code span, or an affirmative read word with a code-span path, it adds one problem that names the claim. A sentence with a negation before the claim adds none. Add `trace` to the keyword inputs of `gate_arguments`, and add the message templates to `src/devops_cli/lang/en/messages.py`. The other callers keep their call with no facts, so the keyword defaults to `None` + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_content.py` passes + +## 3. Pass the trace of the reply's run to the gates + +Reads: `src/devops_cli/roadmap/stage/stage.py`, `src/devops_cli/roadmap/stage/stage_request.py`, `src/devops_cli/roadmap/stage/stage_toolbox.py`, `tests/roadmap/stage/test_roadmap_stage_gates.py`. Changes: `src/devops_cli/roadmap/stage/stage.py`, `tests/roadmap/stage/test_roadmap_stage_gates.py`. + +- [ ] 3.1 In `tests/roadmap/stage/test_roadmap_stage_gates.py`, add a case of a client that appends a `RunTrace` with a `read_file` call for `src/devops_cli/roadmap/agent_run.py`, whose reply's feasibility says `read` that path, and assert that the reply passes the gates. Add a case whose appended trace holds zero calls and assert that the item is refused with a problem that names that path + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_gates.py` fails on the base +- [ ] 3.2 In `_Planner`, read the trace of the reply's ask from `self._toolbox.traces[-1]` when the client is a `ToolboxClient`, and `None` otherwise. Pass `TraceFacts.of(trace)` from `_gated` and `_repaired` through `_settle` into `_problems`, and give it to `gate_arguments` as `trace=`. The split ask and the review add no facts, and the facts of a reply are those of the trace that the ask appended + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_gates.py` passes + +## 4. Judge the trace rule in the replay + +Reads: `src/devops_cli/roadmap/stage/stage_eval_cases.py`, `src/devops_cli/roadmap/stage/stage_eval_gates.py`, `tests/roadmap/stage/test_roadmap_stage_eval_gates.py`. Changes: `src/devops_cli/roadmap/stage/stage_eval_cases.py`, `src/devops_cli/roadmap/stage/stage_eval_gates.py`, `tests/roadmap/stage/test_roadmap_stage_eval_gates.py`. + +- [ ] 4.1 In `tests/roadmap/stage/test_roadmap_stage_eval_gates.py`, add a case whose facts hold a `trace` of zero calls and whose plan says `read` the path `src/devops_cli/roadmap/agent_run.py`, and assert that the `paths` gate refuses it with a problem that names that path. Add a case with no `trace` fact and assert that the gate refuses nothing + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_eval_gates.py` fails on the base +- [ ] 4.2 Add `trace: TraceFact | None = None` to `CaseFacts`, with `TraceFact` holding `tools` and `paths` as tuples, and read the fact from the case file. `PlanUnderTest` gains `trace: TraceFacts | None`, which `of_case` builds from the fact and `_path_gate` passes to `check_proposal` as `trace=`. A case with no `trace` key gives `None`, so the replay skips the comparison + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_eval_gates.py` passes + +## 5. State the rule in the prompt and the stage page + +Reads: `src/devops_cli/ai/tasks/roadmap_stage_change.md`, `docs/roadmap/stage.md`, `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`. Changes: `src/devops_cli/ai/tasks/roadmap_stage_change.md`, `docs/roadmap/stage.md`, `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`. + +- [ ] 5.1 Add one sentence to `src/devops_cli/ai/tasks/roadmap_stage_change.md`: `Feasibility` cites only the tools and the paths that this run used, and a premise that the run did not check is written as `not checked`, never as read or ran. Add the same sentence to the `## Feasibility` rule of `docs/roadmap/stage.md`. Add the sentence to the list of shared phrases in `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py` + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py` passes +- [ ] 5.2 Edit `docs/roadmap/stage.md` and `src/devops_cli/ai/tasks/roadmap_stage_change.md` with the sentence that the prompt-rule test reads + - Verification: `$ uv run devops ci docs` passes + +## 6. Record the reported plan as a golden-set case + +Reads: `src/devops_cli/roadmap/stage/stage_eval_cases.py`, `docs/ROADMAP_WORKFLOW.md`, `tests/roadmap/stage/test_roadmap_stage_eval_cases.py`. Changes: `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/case.json` (new), `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/issue.txt` (new), `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/plan.json` (new), `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/facts.json` (new), `tests/roadmap/stage/test_roadmap_stage_eval_cases.py`, `docs/ROADMAP_WORKFLOW.md`. + +- [ ] 6.1 In `tests/roadmap/stage/test_roadmap_stage_eval_cases.py`, raise the case count and the pull set for the case, and write the case folder `tests/fixtures/roadmap_eval/stage/3205-a-plan-that-cites-a-read-its-run/` with the plan text of #3205, its facts with `trace` holding no tool and no path, `NO_COMMIT` for both commits with a note, and one `false_premise` defect with the gate `paths` that names the read path. Run `uv run devops roadmap eval stage --replay` before and after the case, and state the score of the set before and after in the `## Measure the stage job` section of `docs/ROADMAP_WORKFLOW.md` + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_eval_cases.py` passes +- [ ] 6.2 Edit `docs/ROADMAP_WORKFLOW.md` with the replay score before and after the case + - Verification: `$ uv run devops ci docs` passes + +## Criteria + +- Group 2: A test with a trace of zero calls shows that a Feasibility line "read `src/x.py`" is refused. +- Group 2: A test with a trace that read the path shows that the same line passes. +- Group 5: The planner prompt says to cite only what the run did, and the #3210 test passes. +- Group 6: A replay case from #3205 or #3237 is in the golden set. + +## Workflow follow-up + +- Pending a person: review the diff in tuicr (tuicr -r ..HEAD).