Skip to content

feat(roadmap): the stage context names the plan reader #3428

Not planned

Description

@dan-petty

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

  1. 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_root and stage_change.check_proposal, each with its path and one line of purpose.
  2. 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.
  3. Add a test in tests/roadmap/test_roadmap_stage_plan.py that the stage request holds the entry of read_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

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 path src/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_at and plan_read.change_root, each with the path src/devops_cli/roadmap/plan_read.py and 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 path src/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.md loads
  • THEN The prompt text names plan_read.read_change and 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_change is 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_change in src/devops_cli/roadmap/plan_read.py reverses render_change and returns a StageProposal. [sources: src/devops_cli/roadmap/plan_read.py]
  • Which gate checks a StageProposal against the plan rules?: check_proposal in src/devops_cli/roadmap/stage_change.py checks 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._request in src/devops_cli/roadmap/stage.py builds the request and sets context with collect_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.py and append it to the context field in _Planner._request. Keep collect_context shared 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_context is 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'].
  • Which prompt file carries the rule that names the existing reader?: The rule goes in the planner prompt that _CHANGE_TASK names, roadmap_stage_change.md, which _ask loads with load_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_at and change_root at this commit?: No. plan_read.py defines read_change and its helpers, not those revision reads. fix(roadmap): the implement job refuses a plan that fails the plan check #3393 moves them from plan_check.py to plan_read.py and 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.py that plans the sample item and asserts plan_read.read_change is in request['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.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3393

Alternatives check of 2026-11-06: none.
Tool: none found.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 4, 2026
  2. dan-petty commented on Nov 4, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It reduces token waste and plan drift but does not block a release or fix a defect.
    • Value: Medium. It saves planning tokens and stops the planner from proposing a reader that already exists.
    • Effort: Low. The body states about 2 hours, no deleted code, and the work is adding context entries plus one test.
    • Related: feat(roadmap): the stage job plans with a read-only investigation toolbox #3037, which asks for a different change. Both shape what the stage planner sees, but #3037 adds a read-only toolbox while this names existing readers in the context.
  3. added
    priority/p2-medium
    on Nov 4, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 4, 2026
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 89682e4 (see proposed design in issue body).

  6. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Tool: none found

    Lacks:

    • No open tool or library turns an OpenSpec change folder back into a StageProposal; the reader is the repository's own plan_read.read_change.
    • No tool names this repository's internal stage context entries (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.
    • The need is internal wiring of the stage request context and a prompt rule, which an external package cannot supply.

    Searches run:

    • Python library parse OpenSpec change proposal folder into structured model
    • tool builds repository symbol map of existing functions for LLM planning prompt
    • repomix repository map existing functions for AI prompt
    • OpenSpec change folder reader library
    • codebase context tool for LLM
    • python parse markdown spec change folder round trip reader

    Checked on 2026-11-06. A person decides what this means for the item. The check changes no label and closes no issue.

  7. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    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:

    1. Name the plan reader and gate in the stage context: 41545 tokens
    2. Add the prompt rule that names the existing reader: 35955 tokens

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • false_premise at why: The plan says the gate check_proposal uses read_change, but check_proposal takes a StageProposal; stage_change.py imports no plan_read, and plan_check is the code that calls read_change. Evidence: "check_proposal in src/devops_cli/roadmap/stage/stage_change.py uses 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:

    1. search_code({"text":"check_proposal"})
    2. search_code({"text":"file_texts_at"})
    3. search_code({"text":"collect_context"})
    4. list_files({"directory":"src/devops_cli/roadmap/stage"})
    5. file_symbols({"path":"src/devops_cli/roadmap/stage/stage.py"})
    6. search_code({"text":"def check_proposal"})
    7. list_files({"directory":"tests/roadmap/stage"})
    8. list_files({"directory":"src/devops_cli/ai/tasks"})
    9. read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":840,"end_line":1100})
    10. read_file({"path":"src/devops_cli/roadmap/stage/stage_request.py"})
    11. read_file({"end_line":1090,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":1006})
    12. read_file({"end_line":720,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":600})
    13. search_code({"text":"STAGE_EVAL_TRIGGER_PATHS"})
    14. search_code({"text":"replay"})
    15. read_file({"path":"docs/roadmap/plan-check.md"})
    16. read_file({"end_line":1060,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":195})
    17. search_code({"text":"Registry places"})
    18. search_code({"text":"def collect_context"})
    19. read_file({"end_line":35,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1})
    20. read_file({"end_line":575,"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":500})
    21. read_spec({"capability":"roadmap-stage"})
    22. search_code({"text":"roadmap_stage_change.md"})
    23. read_issue({"number":3393})
    24. read_issue({"number":3403})
    25. find_issues({"terms":"plan_read read_change stage context"})
    26. read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md"})
    27. search_code({"text":"You plan the OpenSpec change for one issue"})
    28. search_code({"text":"plan_read.read_change"})
    29. read_file({"end_line":80,"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":1})
    30. references({"name":"Cite the staged value of each constant"})
    31. search_code({"text":"The reply has these keys and no other"})
    32. search_code({"text":"A plan that adds a rule of the plan check"})
    33. search_code({"text":"The stage context"})
    34. search_code({"text":"context"})
    35. read_file({"end_line":130,"path":"tests/roadmap/stage/test_roadmap_stage_prompt_rules.py","start_line":1})
    36. read_file({"end_line":60,"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":10})
    37. read_file({"end_line":330,"path":"docs/ROADMAP_WORKFLOW.md","start_line":270})
    38. read_file({"end_line":70,"path":"openspec/changes/3318-the-stage-context-lists-the-sibling/tasks.md"})
    39. search_code({"text":"context"})
    40. read_file({"path":"docs/roadmap/stage.md","start_line":1,"end_line":80})
    41. search_code({"text":"message file"})
    42. search_code({"text":"messages.py"})
    43. search_code({"text":"def measure_groups"})
    44. read_file({"end_line":220,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":215})
    45. read_file({"end_line":690,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":676})
    46. list_files({"directory":"src/devops_cli/roadmap"})
    47. list_files({"directory":"src/devops_cli/roadmap/stage"})
    48. list_files({"directory":"tests/roadmap"})
    49. file_symbols({"path":"src/devops_cli/roadmap/plan_read.py"})
    50. search_code({"text":"file_texts_at"})
    51. search_code({"text":"tree_files"})
    52. read_spec({"capability":"roadmap-stage"})
    53. read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":990,"end_line":1040})
    54. search_code({"text":"def collect_context"})
    55. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":520,"end_line":575})
    56. read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":195,"end_line":230})
    57. read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1195,"end_line":1215})
    58. read_file({"path":"src/devops_cli/roadmap/plan_read.py","start_line":505,"end_line":545})
    59. read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":1,"end_line":40})
    60. search_code({"text":"read_change"})
    61. search_code({"text":"plan_read"})
    62. search_code({"text":"from devops_cli.roadmap.plan_read"})
    63. read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1,"end_line":60})
    64. search_code({"text":"plan_read"})
    65. search_code({"text":"### "})
    66. list_files({"directory":"openspec/changes/archive"})
    67. search_code({"text":"3287-detect-obsolete"})
    68. search_code({"text":"2026-11-05-3430-read-the-default-tree-once-per-run"})
    69. search_code({"text":"2026-11-05-3393-the-implement-job-refuses-a-plan"})
    70. search_code({"text":"bff2f14f"})
    71. search_code({"text":"3287"})
    72. search_code({"text":"criteria"})
    73. read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":40,"end_line":120})
    74. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":470,"end_line":532})
    75. search_code({"text":"def _read_overlaps"})
    76. search_code({"text":"def open_pulls"})
    77. read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":1060,"end_line":1115})
    78. read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":670,"end_line":690})
    79. search_code({"text":"_CHANGE_TASK"})
    80. search_code({"text":"check_proposal"})
    81. search_code({"text":"Registry places"})
    82. read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1203,"end_line":1255})
    83. search_code({"text":"def check_proposal"})
    84. callers({"symbol":"read_change"})
    85. search_code({"text":"### Registry places"})
    86. list_files({"directory":"src/devops_cli/ai/tasks"})
    87. read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":985,"end_line":1040})
    88. read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1195,"end_line":1250})
    89. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":1,"end_line":80})
    90. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":520,"end_line":570})
    91. read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md"})
    92. search_code({"text":"roadmap_stage_change.md"})
    93. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_prompt_rules.py","start_line":1,"end_line":70})
    94. read_file({"end_line":225,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":200})
    95. read_file({"end_line":515,"path":"src/devops_cli/roadmap/plan_check.py","start_line":495})
    96. read_spec({"capability":"roadmap-stage"})
    97. search_code({"text":"plan reader"})
    98. search_code({"text":"plan_read.read_change"})
    99. find_issues({"terms":"stage context plan reader"})
    100. find_issues({"terms":"read_change stage context"})
    101. search_code({"text":"### Sibling trees"})
    102. search_code({"text":"_CONTEXT_SECTION"})
    103. read_file({"end_line":700,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":660})
    104. search_code({"text":"def _requests("})
    105. search_code({"text":"Registry places"})
    106. 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})
    107. list_files({"directory":"src/devops_cli/roadmap/stage"})
    108. search_code({"text":"def tree_files"})
    109. search_code({"text":"file_texts_at"})
    110. search_code({"text":"def files_at"})
    111. search_code({"text":"def change_root"})
    112. search_code({"text":"Registry places"})
    113. search_code({"text":"_CHANGE_TASK"})
    114. search_code({"text":"def check_proposal"})
    115. search_code({"text":"def _request"})
    116. search_code({"text":"collect_context"})
    117. read_file({"path":"src/devops_cli/roadmap/stage/stage.py","start_line":995,"end_line":1040})
    118. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_plan.py","start_line":520,"end_line":560})
    119. search_code({"text":"plan_read"})
    120. search_code({"text":"def collect_context"})
    121. read_spec({"capability":"roadmap-stage"})
    122. search_code({"text":"uv run devops ci test"})
    123. search_code({"text":"STAGE_EVAL_REPLAY"})
    124. search_code({"text":"STAGE_EVAL_TRIGGER_PATHS"})
    125. read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":195,"end_line":230})
    126. read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1020,"end_line":1075})
    127. read_file({"path":"docs/ROADMAP_WORKFLOW.md","start_line":295,"end_line":335})
    128. read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":1,"end_line":60})
    129. search_code({"text":"read_change"})
    130. search_code({"text":"plan_read.read_change"})
    131. read_file({"path":"src/devops_cli/roadmap/plan_read.py","start_line":465,"end_line":530})
    132. read_file({"path":"src/devops_cli/roadmap/plan_check.py","start_line":500,"end_line":515})
    133. read_file({"path":"src/devops_cli/roadmap/implement/implement.py","start_line":390,"end_line":405})
    134. search_code({"text":"existing_tool"})
    135. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_prompt_rules.py","start_line":100,"end_line":260})
    136. search_code({"text":"existing"})
    137. search_code({"text":"plan_read"})
    138. read_file({"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":30,"end_line":120})
    139. search_code({"text":"def spec_problems"})
    140. search_code({"text":"def check_gates"})
    141. read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1155,"end_line":1240})
    142. search_code({"text":"def _delta_problems"})
    143. read_file({"end_line":780,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":685})
    144. search_code({"text":"def _spec_problems"})
    145. read_file({"end_line":685,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":560})
    146. search_code({"text":"self-acceptance"})
    147. find_issues({"terms":"stage context"})
    148. list_files({"directory":"openspec/changes"})
    149. read_issue({"number":3978})
    150. read_issue({"number":3318})
    151. read_file({"path":"openspec/changes/archive/2026-11-05-3393-the-implement-job-refuses-a-plan/design.md"})
    152. read_issue({"number":3403})
    153. read_spec({"capability":"roadmap-stage","requirement":"The stage context lists an overlapping pull request"})
    154. read_spec({"capability":"roadmap-stage","requirement":"The model input holds the purpose and the requirement names of each capability"})
    155. search_code({"text":"def _read_overlaps"})
    156. search_code({"text":"def open_pulls"})
    157. read_file({"end_line":1110,"path":"src/devops_cli/roadmap/stage/stage.py","start_line":1068})
    158. search_code({"text":"builds_own"})
    159. read_file({"end_line":1155,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1100})
    160. search_code({"text":"def _prompt_rule_problems"})
    161. read_file({"end_line":900,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":790})
    162. read_file({"path":"src/devops_cli/roadmap/stage/stage_paths.py","start_line":1,"end_line":120})
    163. search_code({"text":"reader"})
    164. read_file({"end_line":36,"path":"src/devops_cli/ai/tasks/roadmap_stage_change.md","start_line":16})
    165. search_code({"text":"_kind_rules"})
    166. read_file({"end_line":500,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":400})
    167. search_code({"text":"stage request context"})
    168. search_code({"text":"Registry places"})
    169. read_file({"end_line":960,"path":"src/devops_cli/roadmap/refine/refine.py","start_line":870})
    170. search_code({"text":"request[\"context\"]"})
    171. search_code({"text":"\"context\""})
    172. read_file({"end_line":300,"path":"tests/roadmap/stage/test_roadmap_stage_window.py","start_line":100})
    173. read_file({"end_line":40,"path":"openspec/changes/archive/2026-11-07-3287-detect-obsolete-spec-requirements-on-command/proposal.md","start_line":34})
    174. git_log({"path":"src/devops_cli/roadmap/stage/stage.py"})
    175. read_file({"end_line":99,"path":"tests/roadmap/stage/test_roadmap_stage_window.py","start_line":1})
    176. read_file({"path":"src/devops_cli/roadmap/stage/stage_request.py","start_line":1,"end_line":120})
    177. read_spec({"capability":"roadmap-stage","requirement":"The first plan request has fixed caps and leaves a reserve for the tools"})
    178. read_spec({"capability":"roadmap-stage","requirement":"The context and the largest spec answer stay under half of the window"})
    179. search_code({"text":"roadmap_stage_change.md"})
    180. search_code({"text":"docs/roadmap/stage.md"})
    181. list_files({"directory":"docs/roadmap"})
    182. 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).

  8. added a commit that references this issue on Nov 8, 2026
  9. added
    status/planned
    owner/service
    status/in-progress
    and removed
    status/ready
    status/planned
    on Nov 8, 2026
  10. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Stopped at group 1.

    Failure class: limit_reached.
    Action taken: none.
    Action left: raise_limit: raise the limit that the run went over.

    Step Status Attempts Tokens in/out Last failing command
    group 1 stopped 1 8073658/46840 -

    Reason:

    LimitReached: The step spent its budget `roadmap.implement.step_token_budget=8000000`.
    Refused commands: uv 3, other:8c17de32b93b 1, other:7440fa805e57 1, other:a849e8a983c7 1, other 1. Other retries: 0.
    

    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:

    diff --git a/src/devops_cli/roadmap/stage/stage.py b/src/devops_cli/roadmap/stage/stage.py
    index f21cb6f3..e7176bca 100644
    --- a/src/devops_cli/roadmap/stage/stage.py
    +++ b/src/devops_cli/roadmap/stage/stage.py
    @@ -91,7 +91,7 @@ from devops_cli.ai.client.models import (
         AICredentialsError,
         StructuredOutputValidationError,
     )
    -from devops_cli.ai.context_budget import truncate_to_token_limit
    +from devops_cli.ai.context_budget import count_tokens, truncate_to_token_limit
     from devops_cli.ai.task_loader import load_task_prompt
     from devops_cli.config.commands import BIN_OPENSPEC
     from devops_cli.config.constants import (
    @@ -678,6 +678,21 @@ def select_stageable(
     # ── The plan of one item ──────────────────────────────────────────────────────
     
     _CHANGE_TASK: Final[str] = "roadmap_stage_change.md"
    +# The plan reader and the gate that a plan cites instead of planning a second reader (#3428). Every
    +# stage request holds the section, and the collected context gives it room inside its cap.
    +_PLAN_READER_SECTION: Final[str] = (
    +    "\n\n### Plan reader and gate\n\n"
    +    "- `plan_read.read_change` (`src/devops_cli/roadmap/plan_read.py`): reads a change folder back "
    +    "as a `StageProposal`, the reverse of `render_change`.\n"
    +    "- `plan_read.tree_files` (`src/devops_cli/roadmap/plan_read.py`): lists the paths that a "
    +    "commit tracks.\n"
    +    "- `plan_read.files_at` (`src/devops_cli/roadmap/plan_read.py`): gives the text of each named "
    +    "path at a commit.\n"
    +    "- `plan_read.change_root` (`src/devops_cli/roadmap/plan_read.py`): finds the change folder of "
    +    "an issue among the paths of a commit.\n"
    +    "- `stage_change.check_proposal` (`src/devops_cli/roadmap/stage/stage_change.py`): the gate "
    +    "that reports each problem of a `StageProposal` against the staged tree.\n"
    +)
     # The model window is shared by the reply, the body of the item and the repository context. A cap
     # is the smaller of its fixed size and this share of the window: a larger window gives no larger
     # cap, so the first plan request leaves room below the limit of the tools (#3477).
    @@ -1011,19 +1026,19 @@ class _Planner:
             """The request for one item: what the model reads and what the gates need. The open plans
             that create a path are read here, once for the run (#4046)."""
             item = target.item
    +        cap = min(CONST_ROADMAP_STAGE_CONTEXT_MAX_TOKENS, self._window // _WINDOW_SHARE_CONTEXT)
             context = collect_context(
                 self._source,
                 self._sha,
                 item.body,
    -            max_tokens=min(
    -                CONST_ROADMAP_STAGE_CONTEXT_MAX_TOKENS, self._window // _WINDOW_SHARE_CONTEXT
    -            ),
    +            max_tokens=cap - count_tokens(_PLAN_READER_SECTION),
             )
             registry = registry_table(self._source)
             matched = matches(registry, (item.title, item.body), tuple(self._tree.paths_in(item.body)))
             if matched:
                 lines = [f"- {entry.path} ({entry.declaring_path}:{entry.line})" for entry in matched]
                 context = f"{context}\n\n### Registry places\n\n" + "\n".join(lines)
    +        context = f"{context}{_PLAN_READER_SECTION}"
             pulls, senders = self._read_overlaps(item.body)
             probe = probe_premise(self._source, self._sha, item.body)
             self._dependency = self._dependency_of(target, probe.missing)
    diff --git a/tests/roadmap/stage/test_roadmap_stage_plan.py b/tests/roadmap/stage/test_roadmap_stage_plan.py
    index a9cc9d3f..5783175b 100644
    --- a/tests/roadmap/stage/test_roadmap_stage_plan.py
    +++ b/tests/roadmap/stage/test_roadmap_stage_plan.py
    @@ -550,6 +550,27 @@ def test_a_plan_adding_a_roadmap_limit_gets_limit_classes_in_context(
         assert "tests/roadmap/test_roadmap_limit_classes.py" in request["context"]
     
     
    [email protected]("openspec")
    +def test_the_request_context_names_the_plan_reader_and_the_gate(
    +    store: InMemoryRoadmapStore, item: int, stage_repo: StageRepo, model_fake: ModelFake
    +) -> None:
    +    model_fake.answer(make_stage_proposal())
    +
    +    _plan(store, stage_repo, item=item)
    +
    +    (request,) = _requests(model_fake)
    +    assert "### Plan reader and gate" in request["context"]
    +    for name in (
    +        "plan_read.read_change",
    +        "plan_read.tree_files",
    +        "plan_read.files_at",
    +        "plan_read.change_root",
    +        "stage_change.check_proposal",
    +        "src/devops_cli/roadmap/plan_read.py",
    +    ):
    +        assert name in request["context"]
    +
    +
     def test_a_plan_with_no_item_to_stage_calls_no_model(
         store: InMemoryRoadmapStore, stage_repo: StageRepo, model_fake: ModelFake
     ) -> None:
    diff --git a/tests/roadmap/stage/test_roadmap_stage_window.py b/tests/roadmap/stage/test_roadmap_stage_window.py
    index 6ff28478..494c79f8 100644
    --- a/tests/roadmap/stage/test_roadmap_stage_window.py
    +++ b/tests/roadmap/stage/test_roadmap_stage_window.py
    @@ -145,12 +145,13 @@ def test_a_first_request_with_the_context_and_the_body_at_their_caps_offers_the_
         _plan(store, stage_repo, script)
     
         request = _first_request(script)
    +    assert count_tokens(request["context"]) <= CONST_ROADMAP_STAGE_CONTEXT_MAX_TOKENS
    +    assert "### Plan reader and gate" in request["context"]
         assert (
    -        count_tokens(request["context"]),
             count_tokens(request["body"]),
             "read_spec" in script.tools_offered[0],
             _first_request_tokens(script) <= _limit(WINDOW) - CONST_ROADMAP_STAGE_TOOL_RESERVE_TOKENS,
    -    ) == (CONST_ROADMAP_STAGE_CONTEXT_MAX_TOKENS, CONST_ROADMAP_STAGE_BODY_MAX_TOKENS, True, True)
    +    ) == (CONST_ROADMAP_STAGE_BODY_MAX_TOKENS, True, True)
     
     
     def test_a_first_request_of_code_with_the_context_and_the_body_at_their_caps_offers_the_tools(
    @@ -259,10 +260,8 @@ def test_the_caps_of_the_context_and_the_body_do_not_grow_with_the_window(
         _plan(store, stage_repo, script)
     
         request = _first_request(script)
    -    assert (count_tokens(request["context"]), count_tokens(request["body"])) == (
    -        CONST_ROADMAP_STAGE_CONTEXT_MAX_TOKENS,
    -        CONST_ROADMAP_STAGE_BODY_MAX_TOKENS,
    -    )
    +    assert count_tokens(request["context"]) <= CONST_ROADMAP_STAGE_CONTEXT_MAX_TOKENS
    +    assert count_tokens(request["body"]) == CONST_ROADMAP_STAGE_BODY_MAX_TOKENS
     
     
     def test_a_small_window_cuts_the_caps_to_a_share_of_itself(
    @@ -281,7 +280,7 @@ def test_a_small_window_cuts_the_caps_to_a_share_of_itself(
         _run(store, stage_repo, script)
     
         request = _first_request(script)
    -    assert (count_tokens(request["context"]), count_tokens(request["body"])) == (4096, 2048)
    +    assert (count_tokens(request["context"]), count_tokens(request["body"])) == (4095, 2048)
     
     
     def test_a_window_that_ends_the_tools_too_soon_fails_the_item_and_names_the_setting(
    

    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 of roadmap.implement.digest_clears_per_class and roadmap.implement.digest_clears_per_item allow it.

  11. added
    status/blocked
    and removed
    status/in-progress
    on Nov 8, 2026
  12. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    The runner Job devops-cli-runner-20261108-121506-4727 ended: succeeded.
    Image digest: sha256:e1ccfe316f1c701c13a886bf1b067d5f217d7f62dac2db65d0539181e1ab8998

    The last lines of its log:

    Tool call: shell, program uv, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: shell, started: uv run python -c __import__('time').sleep(180)
    Tool call: shell, program uv, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: shell, started: find .data -newermt <masked> -type f ...
    Tool call: shell, program find, ok.
    Tool call: read_file, ok.
    Tool call: shell, started: find . -newermt <masked> -type f ...
    Tool call: shell, program find, ok.
    Tool call: shell, started: uv run python -c __import__('time').sleep(240)
    Tool call: shell, program uv, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: shell, started: ls -lt /tmp/pytest-of-devops | head -5
    Tool call: shell, program ls, ok.
    Tool call: shell, started: uv run python -c print(__import__('time').ctime())
    Tool call: shell, program uv, ok.
    Tool call: shell, started: uv run python -c __import__('time').sleep(240)
    Tool call: shell, program uv, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: shell, started: ls -t /tmp/pytest-of-devops/pytest-3 | head -10
    Tool call: shell, program ls, ok.
    Tool call: shell, started: uv run python -c __import__('time').sleep(120)
    Tool call: shell, program uv, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: shell, started: tail -6 /home/devops/.data/agent/worktrees/w-3428/.pydantic-ai-harness/shell/63113545a296414eb0747c62b445cf1c/output.log
    Tool call: shell, started: tail -6 /home/devops/.data/agent/worktrees/w-3428/.pydantic-ai-harness/shell/bdfa14ce8ae345d59510a7bc24b89c41/output.log
    Tool call: shell, program tail, ok.
    Tool call: shell, program tail, ok.
    Failure class limit_reached. Action left: raise_limit.
    ✓ Took 0 item(s) to a ready pull request, stopped 1.
    Elapsed: 41m 45s
    
  13. removed
    owner/service
    on Nov 8, 2026
  14. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    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.

  15. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    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.

  16. removed
    status/blocked
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions