Repository navigation
Description
Problem or Motivation
The stage job plans a change and writes the files of its OpenSpec change. The plan of PR #3403 (for #3393) told the implement job to add a reader that builds a StageProposal from the change folder. That reader already exists: read_change in src/devops_cli/roadmap/plan_read.py reverses render_change, and plan_check already uses it. The stage context does not name read_change or the revision reads, so the planner proposed a second reader. The planning job spends tokens on a part that exists, and the plan can drift from the plan-check command.
Proposed Solution & Architectural Design
- Add the public plan reader and gate entries to the stage context:
plan_read.read_change,plan_read.files_at,plan_read.file_texts_at,plan_read.change_rootandstage_change.check_proposal, each with its path and one line of purpose. - Add a prompt rule that names an existing reader when the model plans to build a reader for a change folder, so the plan cites the tool that already exists.
- Add a test in
tests/roadmap/test_roadmap_stage_plan.pythat the stage request holds the entry ofread_change.
Target Subsystem
src/devops_cli/roadmap/stage.py, src/devops_cli/roadmap/stage_change.py, tests/roadmap/test_roadmap_stage_plan.py.
Existing Tool Considered
read_change and plan_check already exist and cover the need. The change names them in the stage context and builds no new tool. Cost: about 4,000 tokens to build and test, about 1,000 tokens to keep and fix, and about 2 hours of elapsed time. The change deletes no code.
Source: #3403
Dependencies
- chore(roadmap): hold incremental stage and implement work #6521 (hold: incremental work on the stage, implement and fix-checks jobs waits for the re-architecture)
Proposed design
Problem statement
The stage context does not name the existing plan reader and gate. The planner can propose a second reader for a change folder. The plan then spends tokens on code that exists and can drift from the plan-check command. The change names read_change, the revision reads and check_proposal in the stage context and adds a prompt rule.
Acceptance criteria
Requirement: Stage context names the plan reader
The stage request context SHALL name plan_read.read_change with its repository path and a one-line purpose.
Scenario: The stage request holds the plan reader
- WHEN The stage job builds the model request for an item
- THEN The request context holds
plan_read.read_change, the pathsrc/devops_cli/roadmap/plan_read.py, and a one-line purpose.
Requirement: Stage context names the revision reads
The stage request context SHALL name plan_read.files_at, plan_read.file_texts_at and plan_read.change_root, each with its repository path and a one-line purpose.
Scenario: The stage request holds the revision reads
- WHEN The stage job builds the model request for an item
- THEN The request context holds
plan_read.files_at,plan_read.file_texts_atandplan_read.change_root, each with the pathsrc/devops_cli/roadmap/plan_read.pyand a one-line purpose.
Requirement: Stage context names the plan gate
The stage request context SHALL name stage_change.check_proposal with its repository path and a one-line purpose.
Scenario: The stage request holds the plan gate
- WHEN The stage job builds the model request for an item
- THEN The request context holds
stage_change.check_proposal, the pathsrc/devops_cli/roadmap/stage_change.py, and a one-line purpose.
Requirement: Prompt rule names the existing reader
The planner prompt MUST tell the model to name plan_read.read_change when it plans a reader for a change folder.
Scenario: The planner prompt holds the reader rule
- WHEN The prompt
roadmap_stage_change.mdloads - THEN The prompt text names
plan_read.read_changeand tells the model to cite it instead of planning a second reader.
Requirement: Test covers the stage request entry
The test suite SHALL check that the stage request context holds the entry of read_change.
Scenario: The stage plan test reads the model request
- WHEN The test plans one item with the sample proposal
- THEN The test asserts that
plan_read.read_changeis in the request context.
Existing Tool Considered
No alternatives check has run. No external open, maintained tool or library covers this internal need. The existing internal reader read_change in src/devops_cli/roadmap/plan_read.py and the gate check_proposal in src/devops_cli/roadmap/stage_change.py cover the need. The change builds no new tool. Written cost: about 4,000 tokens to build and test, about 1,000 tokens to keep and fix, and about 2 hours of elapsed time. The change deletes no code.
Key questions
- Which existing reader turns a change folder into a
StageProposal?:read_changeinsrc/devops_cli/roadmap/plan_read.pyreversesrender_changeand returns aStageProposal. [sources: src/devops_cli/roadmap/plan_read.py] - Which gate checks a
StageProposalagainst the plan rules?:check_proposalinsrc/devops_cli/roadmap/stage_change.pychecks the spec delta, the content, the form, the paths, the criteria and the overlaps. [sources: src/devops_cli/roadmap/stage_change.py] - Where does the stage job build the context that the planner reads?:
_Planner._requestinsrc/devops_cli/roadmap/stage.pybuilds the request and setscontextwithcollect_context. [sources: src/devops_cli/roadmap/stage.py] - How should the stage context hold the new entries?: Add a stage-specific constant in
src/devops_cli/roadmap/stage.pyand append it to thecontextfield in_Planner._request. Keepcollect_contextshared with refinement. (best practice) [sources: src/devops_cli/roadmap/stage.py]- Chosen: Append a constant in
stage.py. The stage request is built in_request, and the entries are stage-only. - Rejected: Add the entries to
collect_context.collect_contextis shared with refinement, so stage-only entries would pollute refine requests. - Rejected: Add a separate request key. The issue names the stage context, and the existing test reads
request['context'].
- Chosen: Append a constant in
- Which prompt file carries the rule that names the existing reader?: The rule goes in the planner prompt that
_CHANGE_TASKnames,roadmap_stage_change.md, which_askloads withload_task_prompt. [sources: src/devops_cli/roadmap/stage.py, tests/roadmap/test_roadmap_stage_plan.py] - Does the stage context name the revision reads
files_at,file_texts_atandchange_rootat this commit?: No.plan_read.pydefinesread_changeand its helpers, not those revision reads. fix(roadmap): the implement job refuses a plan that fails the plan check #3393 moves them fromplan_check.pytoplan_read.pyand makes them public, so this issue depends on fix(roadmap): the implement job refuses a plan that fails the plan check #3393. [sources: src/devops_cli/roadmap/plan_read.py, openspec/changes/3393-the-implement-job-refuses-a-plan/design.md] - What test proves the stage request holds the plan reader entry?: Add a test to
tests/roadmap/test_roadmap_stage_plan.pythat plans the sample item and assertsplan_read.read_changeis inrequest['context']. (best practice) [sources: tests/roadmap/test_roadmap_stage_plan.py, src/devops_cli/roadmap/stage.py]- Chosen: Add a test to
test_roadmap_stage_plan.py. The issue names that test module and the existing request test lives there. - Rejected: Add a test to
test_roadmap_stage_prompt_rules.py. That module tests prompt text, not the request context.
- Chosen: Add a test to
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Alternatives check of 2026-11-06: none.
Tool: none found.
Activity
dan-petty commentedon Nov 4, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It reduces token waste and plan drift but does not block a release or fix a defect.It saves planning tokens and stops the planner from proposing a reader that already exists.The body states about 2 hours, no deleted code, and the work is adding context entries plus one test.Both shape what the stage planner sees, but #3037 adds a read-only toolbox while this names existing readers in the context.devops-cli-service commentedon Nov 4, 2026
Status set to Ready at 89682e4 (see proposed design in issue body).
devops-cli-service commentedon Nov 6, 2026
Alternatives check: none
Tool: none found
Lacks:
StageProposal; the reader is the repository's ownplan_read.read_change.plan_read.read_change,plan_read.files_at,plan_read.file_texts_at,plan_read.change_root,stage_change.check_proposal) in the planner prompt.Searches run:
Checked on 2026-11-06. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 8, 2026
Staged: branch
feat/3428-the-stage-context-names-the-plan, draft pull request #4144. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
A model review of the plan found these points. They stop no draft, and a person judges them:
false_premiseat why: The plan says the gatecheck_proposalusesread_change, butcheck_proposaltakes aStageProposal;stage_change.pyimports noplan_read, andplan_checkis the code that callsread_change. Evidence: "check_proposalinsrc/devops_cli/roadmap/stage/stage_change.pyuses it."The runs of the planner and the review made 97 model request(s), and used 6506928 input tokens and 142172 output tokens. The tool calls, in order:
search_code({"text":"check_proposal"})search_code({"text":"file_texts_at"})search_code({"text":"collect_context"})list_files({"directory":"src/devops_cli/roadmap/stage"})file_symbols({"path":"src/devops_cli/roadmap/stage/stage.py"})search_code({"text":"def check_proposal"})list_files({"directory":"tests/roadmap/stage"})list_files({"directory":"src/devops_cli/ai/tasks"})read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":840,"end_line":1100})read_file({"path":"src/devops_cli/roadmap/stage/stage_request.py"})read_file({"end_line":1090,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":1006})read_file({"end_line":720,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":600})search_code({"text":"STAGE_EVAL_TRIGGER_PATHS"})search_code({"text":"replay"})read_file({"path":"docs/roadmap/plan-check.md"})read_file({"end_line":1060,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":195})search_code({"text":"Registry places"})search_code({"text":"def collect_context"})read_file({"end_line":35,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1})read_file({"end_line":575,"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":500})read_spec({"capability":"roadmap-stage"})search_code({"text":"roadmap_stage_change.md"})read_issue({"number":3393})read_issue({"number":3403})find_issues({"terms":"plan_read read_change stage context"})read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md"})search_code({"text":"You plan the OpenSpec change for one issue"})search_code({"text":"plan_read.read_change"})read_file({"end_line":80,"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":1})references({"name":"Cite the staged value of each constant"})search_code({"text":"The reply has these keys and no other"})search_code({"text":"A plan that adds a rule of the plan check"})search_code({"text":"The stage context"})search_code({"text":"context"})read_file({"end_line":130,"path":"tests/roadmap/stage/test_roadmap_stage_prompt_rules.py","start_line":1})read_file({"end_line":60,"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":10})read_file({"end_line":330,"path":"docs/ROADMAP_WORKFLOW.md","start_line":270})read_file({"end_line":70,"path":"openspec/changes/3318-the-stage-context-lists-the-sibling/tasks.md"})search_code({"text":"context"})read_file({"path":"docs/roadmap/stage.md","start_line":1,"end_line":80})search_code({"text":"message file"})search_code({"text":"messages.py"})search_code({"text":"def measure_groups"})read_file({"end_line":220,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":215})read_file({"end_line":690,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":676})list_files({"directory":"src/devops_cli/roadmap"})list_files({"directory":"src/devops_cli/roadmap/stage"})list_files({"directory":"tests/roadmap"})file_symbols({"path":"src/devops_cli/roadmap/plan_read.py"})search_code({"text":"file_texts_at"})search_code({"text":"tree_files"})read_spec({"capability":"roadmap-stage"})read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":990,"end_line":1040})search_code({"text":"def collect_context"})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":520,"end_line":575})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":195,"end_line":230})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1195,"end_line":1215})read_file({"path":"src/devops_cli/roadmap/plan_read.py","start_line":505,"end_line":545})read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":1,"end_line":40})search_code({"text":"read_change"})search_code({"text":"plan_read"})search_code({"text":"from devops_cli.roadmap.plan_read"})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1,"end_line":60})search_code({"text":"plan_read"})search_code({"text":"### "})list_files({"directory":"openspec/changes/archive"})search_code({"text":"3287-detect-obsolete"})search_code({"text":"2026-11-05-3430-read-the-default-tree-once-per-run"})search_code({"text":"2026-11-05-3393-the-implement-job-refuses-a-plan"})search_code({"text":"bff2f14f"})search_code({"text":"3287"})search_code({"text":"criteria"})read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":40,"end_line":120})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":470,"end_line":532})search_code({"text":"def _read_overlaps"})search_code({"text":"def open_pulls"})read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":1060,"end_line":1115})read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":670,"end_line":690})search_code({"text":"_CHANGE_TASK"})search_code({"text":"check_proposal"})search_code({"text":"Registry places"})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1203,"end_line":1255})search_code({"text":"def check_proposal"})callers({"symbol":"read_change"})search_code({"text":"### Registry places"})list_files({"directory":"src/devops_cli/ai/tasks"})read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":985,"end_line":1040})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1195,"end_line":1250})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":1,"end_line":80})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":520,"end_line":570})read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md"})search_code({"text":"roadmap_stage_change.md"})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_prompt_rules.py","start_line":1,"end_line":70})read_file({"end_line":225,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":200})read_file({"end_line":515,"path":"src/devops_cli/roadmap/plan_check.py","start_line":495})read_spec({"capability":"roadmap-stage"})search_code({"text":"plan reader"})search_code({"text":"plan_read.read_change"})find_issues({"terms":"stage context plan reader"})find_issues({"terms":"read_change stage context"})search_code({"text":"### Sibling trees"})search_code({"text":"_CONTEXT_SECTION"})read_file({"end_line":700,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":660})search_code({"text":"def _requests("})search_code({"text":"Registry places"})read_file({"path":"openspec/changes/archive/2026-11-05-3430-read-the-default-tree-once-per-run/proposal.md","start_line":30,"end_line":45})list_files({"directory":"src/devops_cli/roadmap/stage"})search_code({"text":"def tree_files"})search_code({"text":"file_texts_at"})search_code({"text":"def files_at"})search_code({"text":"def change_root"})search_code({"text":"Registry places"})search_code({"text":"_CHANGE_TASK"})search_code({"text":"def check_proposal"})search_code({"text":"def _request"})search_code({"text":"collect_context"})read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":995,"end_line":1040})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":520,"end_line":560})search_code({"text":"plan_read"})search_code({"text":"def collect_context"})read_spec({"capability":"roadmap-stage"})search_code({"text":"uv run devops ci test"})search_code({"text":"STAGE_EVAL_REPLAY"})search_code({"text":"STAGE_EVAL_TRIGGER_PATHS"})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":195,"end_line":230})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1020,"end_line":1075})read_file({"path":"docs/ROADMAP_WORKFLOW.md","start_line":295,"end_line":335})read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":1,"end_line":60})search_code({"text":"read_change"})search_code({"text":"plan_read.read_change"})read_file({"path":"src/devops_cli/roadmap/plan_read.py","start_line":465,"end_line":530})read_file({"path":"src/devops_cli/roadmap/plan_check.py","start_line":500,"end_line":515})read_file({"path":"src/devops_cli/roadmap/implement/implement.py","start_line":390,"end_line":405})search_code({"text":"existing_tool"})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_prompt_rules.py","start_line":100,"end_line":260})search_code({"text":"existing"})search_code({"text":"plan_read"})read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":30,"end_line":120})search_code({"text":"def spec_problems"})search_code({"text":"def check_gates"})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1155,"end_line":1240})search_code({"text":"def _delta_problems"})read_file({"end_line":780,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":685})search_code({"text":"def _spec_problems"})read_file({"end_line":685,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":560})search_code({"text":"self-acceptance"})find_issues({"terms":"stage context"})list_files({"directory":"openspec/changes"})read_issue({"number":3978})read_issue({"number":3318})read_file({"path":"openspec/changes/archive/2026-11-05-3393-the-implement-job-refuses-a-plan/design.md"})read_issue({"number":3403})read_spec({"capability":"roadmap-stage","requirement":"The stage context lists an overlapping pull request"})read_spec({"capability":"roadmap-stage","requirement":"The model input holds the purpose and the requirement names of each capability"})search_code({"text":"def _read_overlaps"})search_code({"text":"def open_pulls"})read_file({"end_line":1110,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":1068})search_code({"text":"builds_own"})read_file({"end_line":1155,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1100})search_code({"text":"def _prompt_rule_problems"})read_file({"end_line":900,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":790})read_file({"path":"src/devops_cli/roadmap/stage/stage_paths.py","start_line":1,"end_line":120})search_code({"text":"reader"})read_file({"end_line":36,"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":16})search_code({"text":"_kind_rules"})read_file({"end_line":500,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":400})search_code({"text":"stage request context"})search_code({"text":"Registry places"})read_file({"end_line":960,"path":"src/devops_cli/roadmap/refine/refine.py","start_line":870})search_code({"text":"request[\"context\"]"})search_code({"text":"\"context\""})read_file({"end_line":300,"path":"tests/roadmap/stage/test_roadmap_stage_window.py","start_line":100})read_file({"end_line":40,"path":"openspec/changes/archive/2026-11-07-3287-detect-obsolete-spec-requirements-on-command/proposal.md","start_line":34})git_log({"path":"src/devops_cli/roadmap/stage/stage.py"})read_file({"end_line":99,"path":"tests/roadmap/stage/test_roadmap_stage_window.py","start_line":1})read_file({"path":"src/devops_cli/roadmap/stage/stage_request.py","start_line":1,"end_line":120})read_spec({"capability":"roadmap-stage","requirement":"The first plan request has fixed caps and leaves a reserve for the tools"})read_spec({"capability":"roadmap-stage","requirement":"The context and the largest spec answer stay under half of the window"})search_code({"text":"roadmap_stage_change.md"})search_code({"text":"docs/roadmap/stage.md"})list_files({"directory":"docs/roadmap"})search_code({"text":"context"})Tool calls: callers=1 (empty=0), file_symbols=2 (empty=0), find_issues=4 (empty=1), git_log=1 (empty=0), list_files=11 (empty=0), read_file=65 (empty=0), read_issue=5 (empty=0), read_spec=8 (empty=0), references=1 (empty=0), search_code=84 (empty=10)
The stage job read the open pull requests and their files in 1 GraphQL request(s).
docs(openspec): plan #3428 Name the plan reader in the stage context (#…
devops-cli-service commentedon Nov 8, 2026
Stopped at group 1.
Failure class:
limit_reached.Action taken: none.
Action left:
raise_limit: raise the limit that the run went over.Reason:
Last message of the agent (a claim that no check verified): Now I'll update the two window tests that pin the context cap, since the fixed section now takes room inside it.
The job discarded this work. Read it before you retry:
The item is Blocked, and the job will not run it. Fix the cause. Then comment
implement: retry. The Service clears the stop on its own when a new runner image rolls out, but only if a retry can fix the class of the stop and the limits ofroadmap.implement.digest_clears_per_classandroadmap.implement.digest_clears_per_itemallow it.devops-cli-service commentedon Nov 8, 2026
The runner Job devops-cli-runner-20261108-121506-4727 ended: succeeded.
Image digest: sha256:e1ccfe316f1c701c13a886bf1b067d5f217d7f62dac2db65d0539181e1ab8998
The last lines of its log:
dan-petty commentedon Nov 20, 2026
Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.
dan-petty commentedon Nov 30, 2026
Triage under #6519 (owner instruction of 2026-11-30). This item adds or extends a hand-written gate, refusal, context block or plan-shape rule of the stage or implement job. #6519 found that 263 of about 900 issues in four weeks added gates and none replaced the engine; stage now runs on stock Coder, where the agent reads the repository itself and runs the OpenSpec checks in its loop. The code paths that this item names have also moved (for example
src/devops_cli/roadmap/stage/stage_change.py). If the failure class still shows in graded attempts (plan_defect), file a new item from that evidence. Closed as not planned.