Skip to content

fix(roadmap): stage reads each plan back before the push #5214

Description

@dan-petty

Problem or Motivation

The stage job never reads back the files that it pushes. No module under src/devops_cli/roadmap/stage/ imports plan_read. So #3981 pushed three manifest groups that the reader refuses, and only the advisory Plan Check job (.github/workflows/pr-title.yml:100-155) showed it. The stage attempt that wrote the plan got no failure. fix-plan got it.

The writer also accepts texts that the reader refuses. Two other groups that StageProposal and form_problems accept fail read_change with 'has both verify and process': a process that ends with 'verify that uv run devops ci docs passes' (_INLINE_VERIFY, src/devops_cli/roadmap/plan_read.py:63-65), and an implementation that holds the process mark (_split_process, plan_read.py:307-311).

A check needs a bound. A new failure class with no entry in RETRY_AFTER waits as ci_infra, 1 hour (src/devops_cli/roadmap/failure.py:174-181). _record_failures counts only plan_defect toward CONST_ROADMAP_STAGE_PLAN_DEFECT_LIMIT (src/devops_cli/roadmap/stage/stage.py:3094-3096). A stop in _settle comes before _keep (stage.py:1254-1258), so each retry is a full plan run, up to 21 planner calls (stage.py:1221-1232).

Proposed Solution & Architectural Design

  1. In _Planner._settle, after openspec validate passes (stage.py:1866-1868), read the rendered files with read_change.
  2. Text error, back to the model. A PlanReadError means that the reader cannot parse a text. _settle returns a refusal of the new gate read (READ_GATE in src/devops_cli/roadmap/stage/stage_findings.py, the name that plan-recheck uses) with the reader reason, as VALIDATE_GATE does. The reply goes back to the model through the gate returns (roadmap.stage.gate_returns, at most CONST_ROADMAP_STAGE_GATE_RETURNS_CEILING = 3). When the returns run out, the item fails with plan_defect, which waits 1 hour and counts toward the limit of 3, as today.
  3. Fact mismatch, stop. The read succeeds, but a group (title, kind, reads, changes, creates, test, implementation, verify, process, documentation), the unchanged references or the criteria differ from file_facts(proposal) (fix(roadmap): write and read the kind of each plan task group #5205). The specs are not compared, because _restored puts back base scenarios that the proposal does not hold (fix(roadmap): a MODIFIED block that omits a scenario fails #4310). A mismatch is a defect of the writer or of the reader, and the model cannot fix it. _settle raises RoadmapPlanReadBackError (a RoadmapStageError) that names each group and field that differ, with no text of the plan. The model gets no return. The comparison is a pure function, plan_read.read_back_problems(files, proposal).
  4. Bound. New class plan_unreadable. CLASS_BY_EXCEPTION maps RoadmapPlanReadBackError to it, before RoadmapStageError. ACTION_BY_CLASS gives wait. RETRY_AFTER gives 6 hours. _record_failures counts plan_unreadable with plan_defect on the same body, so the third failure on one body returns the item to New with the comment that lists the differences. One item thus costs at most 3 plan runs on one body, at least 6 hours apart. The stage result line has the class plan_unreadable, so the stage job, which wrote the plan, gets the failure.
  5. fix-plan. revise goes through the same _settle, so fix-plan pushes no plan that the reader misreads. A revision that fails the read-back gives the result of fix(roadmap): fix-plan records the true result of each attempt #5213 with the class plan_unreadable on the line: regated when a gated plan exists (that plan passed the read-back in its own _settle), else failed. The attempt uses one of the 2 attempts on the head (CONST_ROADMAP_FIX_PLAN_HEAD_ATTEMPTS), so one head writes at most 2 such lines.
  6. Dry run. The push condition of fix_plan_request_conditions (src/devops_cli/lang/en/messages.py) adds that the pushed plan reads back. The stage condition model_correction ('the change fails its checks') stays true, because the read is one of the checks.
  7. Documents, written as merged: the module docstring of stage.py (Refused plans), docs/ROADMAP_WORKFLOW.md (the class table at lines 189-209, the waits in the row stage.failed_*, the row stage.plan_defects), docs/adr/0019-a-decision-step-asks-jev-short-closed-questions-about-evidence-that-tools-extract.md:44 ('one of the 19 FailureClass values' becomes 20), k8s/README.md item 15 (the waits of the classes), docs/roadmap/stage.md and docs/roadmap/job-success.md (the class on a fix_plan line).

Target Subsystem

Roadmap: the stage planner (src/devops_cli/roadmap/stage/stage.py) and the failure taxonomy (src/devops_cli/roadmap/failure.py).

Existing Tool Considered

The fix reuses read_change and file_facts (#5205), the gate-return loop, RETRY_AFTER and the defect count of the stage job. It adds no library. A second copy of the reader marks in form_problems was considered and rejected: the reader is the one parser that decides, so the read gate cannot drift from it. Cost to build (estimate): 0.8 M tokens and 3 hours elapsed. Keep: one in-process read of each settled reply, a few milliseconds. Fix: about 0.2 M tokens for each mismatch that the check reports.

Acceptance Criteria

  • uv run pytest tests/roadmap/stage/test_roadmap_stage_plan.py::test_a_reply_whose_text_the_reader_refuses_goes_back_to_the_model passes for the two real texts above (inline verify at the end of a process; process mark in an implementation). The second reply passes, and the item is staged.
  • uv run pytest tests/roadmap/stage/test_roadmap_stage_plan.py::test_a_valid_plan_of_each_kind_passes_the_read_back passes for behavior, manifest and other.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_read_back_problems_names_each_fact_that_differs passes with one case for each compared fact, and gives no problem for a pair that differs only in the specs that _restored adds.
  • uv run pytest tests/roadmap/stage/test_roadmap_stage_failure_class.py::test_a_read_back_error_has_the_class_plan_unreadable passes.
  • uv run pytest tests/roadmap/stage/test_roadmap_stage_retry_after.py::test_plan_unreadable_waits_six_hours passes.
  • uv run pytest tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py::test_plan_unreadable_counts_toward_the_limit passes: the third failure on one body returns the item to New with the comment.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_a_revision_that_does_not_read_back_is_not_pushed passes in two cases. With no gated plan, the result is failed with the class plan_unreadable, and no push occurs. With a gated plan, the result is regated with that class, and only the gated plan is pushed.
  • uv run pytest tests/commands/test_roadmap_step_fix_plan.py::test_the_dry_run_makes_no_request_and_lists_the_reads_and_the_writes gives the push condition with the read-back.
  • uv run devops ci test tests/roadmap/test_roadmap_failure.py tests/roadmap/stage tests/roadmap/steps tests/prometheus/test_implement_failure_labels.py passes.
  • uv run devops ci fail-to-pass --base origin/main shows that each new test above fails on the base and passes on the head, except the guard test_a_valid_plan_of_each_kind_passes_the_read_back, which passes on both. Each new test imports a new name inside its body, so the module collects on the base. The PR cites the run.
  • Validation table in a PR comment: for each open plan PR head and each plan PR closed in the last 14 days that the reader reads, the read-back check (read, render with one date, read, read_back_problems) on the branch. The table shows 0 fact mismatches and lists each text error. A script under .data/agent/scratch/ makes it. After the merge, the stage result lines with class=plan_unreadable over 7 days add one row (0 expected).
  • uv run devops docs check passes.

Files

  • src/devops_cli/roadmap/stage/stage.py
  • src/devops_cli/roadmap/stage/stage_findings.py
  • src/devops_cli/roadmap/plan_read.py
  • src/devops_cli/roadmap/plan_recheck.py (imports READ_GATE)
  • src/devops_cli/roadmap/failure.py
  • src/devops_cli/exceptions/roadmap.py
  • src/devops_cli/lang/en/messages.py
  • tests/roadmap/stage/test_roadmap_stage_plan.py
  • tests/roadmap/stage/test_roadmap_stage_failure_class.py
  • tests/roadmap/stage/test_roadmap_stage_retry_after.py
  • tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py
  • tests/roadmap/test_roadmap_plan_read.py
  • tests/roadmap/test_roadmap_failure.py
  • tests/roadmap/steps/test_roadmap_fix_plan.py
  • tests/commands/test_roadmap_step_fix_plan.py
  • docs/ROADMAP_WORKFLOW.md
  • docs/adr/0019-a-decision-step-asks-jev-short-closed-questions-about-evidence-that-tools-extract.md
  • docs/roadmap/stage.md
  • docs/roadmap/job-success.md
  • k8s/README.md (item 15)
  • openspec/specs/roadmap-failure-taxonomy/spec.md
  • openspec/specs/roadmap-stage/returns/spec.md

Dependencies

The stage job leaves this item out until that issue closes. This item needs file_facts and the explicit kind of the reader fix, and the results of the fix-plan fix. The PRs change stage.py, messages.py and the same documents.

Related

#3981, #4060, #4491, #4802, #4310, #3065.

Source: #5211

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
    • Possible duplicate: fix(roadmap): stage verifies round-trip readability before push #3966, which may ask for the same change. The model names the stage job calls read_change on the rendered plan files before pushing and fails if the reader cannot parse them as the change that both ask for. Both items ask the stage to read back each plan with read_change before the push and fail on a parse error. A person closes one of the two if that is so.
  4. added
    priority/p2-medium
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 12, 2026
  5. removed
    status/in-review
    on Nov 15, 2026
  6. added a commit that references this issue on Nov 15, 2026
  7. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor
  8. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-15 16:55 UTC

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/mediumpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions