Repository navigation
Description
Problem Description
The stage job commits and pushes change files without verifying that the plan reader can read them.
In src/devops_cli/roadmap/stage/stage.py, render_change generates the files of an OpenSpec change (proposal.md, design.md, tasks.md, spec deltas). The stage job runs validate_change to check the OpenSpec schema. It also checks secret redaction with redact_text. It does not call read_change(files) from src/devops_cli/roadmap/plan_read.py.
When tasks.md has a formatting or structural defect (such as an unparsable task line, missing command markers, or group validation failures), stage does not detect the defect. The stage job commits the files, pushes the branch to origin, and opens a draft pull request. The pull request then fails CI Plan Check.
Reproduction Steps
- Generate a proposal where
tasks.mdcontains a syntax or structure that breaksread_change(for example, aVerification:line without a command marker or a group kind mismatch). - Run
devops roadmap stageon the item. - Observe that
stagecompletes, commits to git, and pushes the draft pull request. - Run
devops roadmap plan-check <pr>and seePlanReadErroror validation error.
Expected vs Actual Behavior
Expected: stage calls read_change(files) before making a git commit. If PlanReadError or ValidationError occurs, stage refuses the proposal and asks the planner model again.
Actual: stage pushes the broken change files to origin, and the draft pull request fails CI.
Proposed Solution
In src/devops_cli/roadmap/stage/stage.py, call read_change(files) in _validate (or in _settle).
When read_change raises PlanReadError, return _Refused with the read error message.
Target Subsystem
Roadmap Automation & Planning
Proposed design
Problem statement
The stage job writes and pushes a change without checking that read_change can parse it. A broken tasks.md reaches origin and fails CI Plan Check. The fix adds a round-trip read before any git write and returns the read problem to the planner.
Acceptance criteria
Requirement: Round-trip read before git write
The stage job SHALL call read_change(files) with the rendered file mapping before it makes a branch, commit, push, or draft pull request.
Scenario: A tasks.md that read_change refuses
- WHEN
render_changewrites atasks.mdthatread_changerefuses withPlanReadError. - THEN The stage job returns
_Refusedwith the read error message and makes no git commit and no push.
Requirement: Validation error refuses the reply
The stage job SHALL return _Refused with the error message when read_change(files) raises a pydantic ValidationError.
Scenario: A spec delta that fails model validation
- WHEN
read_change(files)raisesValidationErrorfor a rendered spec delta. - THEN The stage job returns
_Refusedand gives the error message to the planner.
Requirement: Read failure returns to the planner once
The stage job SHALL send a plan that fails read_change back to the planner once and SHALL stop the item on a second failed reply.
Scenario: Two replies fail the read
- WHEN The first and second replies of one item both make
read_changeraisePlanReadError. - THEN The stage job raises
RoadmapStageErrorfor the item and makes no git write.
Requirement: Readable plan proceeds
The stage job SHALL continue to the OpenSpec validation and the StagedChange result when read_change(files) succeeds.
Scenario: A readable change folder
- WHEN
read_change(files)returns aStageProposalfor the rendered files. - THEN The stage job returns a
StagedChangethat holds the same files.
Requirement: Read check without OpenSpec
The stage job SHALL run the read_change(files) check even when the OpenSpec binary is not on PATH.
Scenario: No OpenSpec binary
- WHEN
self._toolisNoneandread_change(files)raisesPlanReadError. - THEN The stage job returns
_Refusedwith the read error message.
Existing Tool Considered
No alternatives check has run. The OpenSpec CLI is the existing open tool for change validation, and it lacks a round-trip reader for tasks.md. The project already holds read_change in src/devops_cli/roadmap/plan_read.py; the change reuses it and builds no new parser. The build cost is zero tokens and zero elapsed time.
Key questions
- Where does the stage job call
read_change(files)?: Call it in_settle, after the secret redaction and before_validate, so it runs even when the OpenSpec binary is absent._validatereturnsNonewhenself._toolisNone. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/plan_read.py]- Rejected: In
_validate. It mixes the round-trip gate with the OpenSpec schema gate and risks a skip when the binary is absent. - Chosen: In
_settlebefore_validate. It always runs, and it can return_Refusedbefore any git write. - Rejected: In both. It duplicates the read and can report the same defect twice.
- Rejected: In
- Does the check compare the parsed proposal with the original proposal?: No. Check only that
read_change(files)does not raise. The writer drops the group kind, the estimated lines, andbuilds_own, so equality would fail for a valid plan. (best practice) [sources: src/devops_cli/roadmap/plan_read.py]- Rejected: Require equality. The reader documents facts that it cannot recover, so a valid plan would fail.
- Chosen: Check readability only. It matches the defect: a plan that the reader cannot parse must not reach origin.
- Rejected: Check equality for tasks.md only. The reader still loses the group kind and the estimated lines in tasks.md.
- What does the stage job do when
read_change(files)raises?: Return_Refusedwith the error message. The existing_gatedpath sends the plan back to the planner once and stops the item on a second refusal. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/plan_read.py]- Rejected: Stop the item at once. The planner gets no chance to repair a formatting defect.
- Chosen: Return
_Refusedand use the existing one-return path. It reuses the refusal path and prevents the push. - Rejected: Log a warning and push. The broken change still fails CI Plan Check.
- Which exceptions does the stage job catch?: Catch
PlanReadErrorand pydanticValidationError.read_changeconverts most pydantic errors toPlanReadError, but a validation error from a model can still escape. (best practice) [sources: src/devops_cli/roadmap/plan_read.py, src/devops_cli/roadmap/stage/stage.py]- Rejected: Catch only
PlanReadError. A pydanticValidationErrorfrom a spec model would stop the item as an internal failure. - Chosen: Catch
PlanReadErrorandValidationError. Both are plan-form failures, and both can return_Refusedwith the message. - Rejected: Catch every exception. It would hide defects in the job, such as a
TypeError.
- Rejected: Catch only
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-09: none.
Tool: none found.
Activity
devops-cli-service commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The defect pushes broken change files and fails CI, but it does not block other work.The change stops broken draft pull requests and saves a CI cycle.The change adds one read_change call in _validate and returns _Refused on error.Both items make stage refuse a bad plan before the push; this item adds a read_change check and #3010 adds a missing-path check.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at 682d206 (see proposed design in issue body).
devops-cli-service commentedon Nov 9, 2026
Alternatives check: none
Reason: The searches surfaced the OpenSpec CLI, which the project already uses (ADR 0010) for change-schema validation, but it validates OpenSpec's own proposal/delta schema rather than the project's
tasks.mdgrammar (command markers, group kinds) thatread_changeparses, so it cannot catch the defects the issue describes. No open library implements that reader grammar; the fix is the in-reporead_changecall before the git write, not an external tool.Tool: none found
Lacks:
tasks.mdgrammar (task lines, command markers, group kinds) the wayread_changedoesPlanReadErroror maps a pydanticValidationErrorfrom its spec models to a_RefusedreplyTools considered:
Searches run:
Sources:
Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 14, 2026
Replaced by #5416 (commit 4c3de9d): _settle now calls _file_findings -> _plan_check -> staged_problems -> folder_problems, and folder_problems calls read_change(files) and maps PlanReadError to a PLAN_CHECK_GATE finding before any branch, commit, push or draft PR. read_change converts a pydantic ValidationError to PlanReadError, so both refused forms go back to the planner through the existing one-return path. The check runs even when the OpenSpec binary is absent because it is separate from _validate. Tests: tests/roadmap/stage/test_roadmap_stage_plan_check.py. No code change is needed; close as not planned.
dan-petty commentedon Nov 17, 2026
The premise is obsolete. Newer commits already resolved this item.
Commit a13a1c5 (PR #5851, closing #5214) added
read_change(files)to_file_findingsinsrc/devops_cli/roadmap/stage/stage.py. Commit 167451f (PR #5957, closing #5952) improved the read-back gate.The stage job now calls
read_change(files)before it makes any git commit or push. APlanReadErrorreturns a refusal through theREAD_GATE.Closing as not planned per AGENTS.md Rule 2.