Skip to content

fix(roadmap): fix-plan records the true result of each attempt #5213

Closed

Description

@dan-petty

Problem or Motivation

The fix-plan step logs results that did not occur, and it loses work.

  • Unreadable plan. On PlanReadError the step drops the reason. Its line says that a review found 0 findings before and 0 after, and that the comment listed 0. But no review ran, and the step did not read the comment (src/devops_cli/roadmap/steps/fix_plan.py:584-593, 610). The class is plan_defect, the attempt uses 1 of the 2 attempts on the head, and the line counts against the fix_plan grade. Job fix-plan-validate-4963 logged this line after 90 s.
  • Failed repair. revise_plan builds PlanRevision(failure) with no before (src/devops_cli/roadmap/stage/stage.py:2584-2589). A run of test_a_failed_plan_run_records_the_attempt_and_writes_nothing_else logs open=1 in the review and then 'found 0 open finding(s) before the repair'.
  • Failure before the review. The gate returns run out (stage.py:1449-1458), or the model call of the new first reply fails (stage.py:1403-1405). The line then reports a review that did not run.
  • Stop before the review. A false premise, an open blocker or a head over the budget logs 0 before and 0 after (stage.py:1297-1302). _failure gives plan_defect to Blocked (fix_plan.py:467-473).
  • Lost gated plan. When the checks refuse the head, _gated gets a new plan from the planner (stage.py:1386-1406). With no open finding, revise returns it with no repair (stage.py:1312-1313), and _settle pushes only when before is not 0 (fix_plan.py:498-500). The plan is also lost when the repair or the review after the gate fails or goes over the budget (stage.py:1316-1317, 1323, 2584-2589). Live case: Job fix-plan-validate-4917 ran 2,387 s and 7,567,057 tokens (plan_calls 3, gate_returns 2) and ended cleared with no push. docs(openspec): plan #4472 Size narrowed test workers by collected tests #4917 lost the label and keeps a plan that the current checks refuse.
  • False success. cleared with no push is a success (src/devops_cli/roadmap/job_result.py:76). A repair that gives the same plan, with a second review that finds 0, also ends cleared and pushes.
  • Screen. When stage.verify_screen acts, _review skips the model review (stage.py:1679-1680), so the head review counts 0.
  • Stale documents. k8s/README.md item 23 and the fix-plan row of ADR 0021 section 8 ('With no such finding, one model review') say that the step reviews the head only when no comment lists a finding (fix(roadmap): fix-plan compares the revision with a review of the head #5150 changed that). docs/ROADMAP_WORKFLOW.md:143 lists four results. The dry-run conditions (fix_plan_request_conditions in src/devops_cli/lang/en/messages.py) push only on fewer open findings.

Proposed Solution & Architectural Design

Change fix_plan.py and the revise path of stage.py in one PR.

  1. Read before the marks. The step reads the head plan after the fetch and the branch check, and before the attempt marks. On PlanReadError the result is unreadable: the step writes fix_plan.at and fix_plan.result, and it does not add to fix_plan.attempts. It logs one WARNING with the path and the reason (masked with redact_text, cut to 500 characters) and adds 1 to devops_cli_roadmap_fix_plan_total with result=unreadable. It writes no roadmap job result: line, because the defect is in the writer or the reader and not in fix-plan, so the fix_plan grade does not change. fix(roadmap): stage reads each plan back before the push #5214 charges such a defect to the stage job. The 6-hour wait of fix_plan.at spaces the reads, so a release that fixes the reader reads the plan at the next due round. A read error does not go to the planner, because the planner needs a StageProposal.
  2. One pass (fix(roadmap): fix-plan compares the revision with a review of the head #5150). before is the open findings of the review of the head in this attempt. after is the open findings of the last review of the revision in this attempt. The findings of the last plan comment have their own count, comment. They go to the planner only with a finding of the head review, as today. No result compares the comment with a review.
  3. Keep the gated plan. PlanRevision gets gated: StagedChange | None and reviewed: bool. The planner keeps the gated head and the open findings of the head review in attributes, and the except block of revise_plan copies both into the failed revision. gated is set when the gated head is not the same plan as the read head.
  4. Same plan. same_plan(a, b) is true when render_change gives the same files for both, with one target and one date. So the Kind: line, the date and the fields that no file holds are no change.
  5. Results, in this order:
    • stopped: a false premise, an open blocker or a head over the budget stops the item before a gated plan exists. The line has stop=premise|blocked|over_budget (names of log_job_result) and the class premise_false for a false premise. The label stays, and the step posts one fix-plan comment with the evidence. It does not return the item to New: ADR 0021 section 8 rule 1 lets a row write only its own record keys and its own marked comments, and the Status is not a key of fix-plan. A person decides.
    • failed: a model call or the gate fails before a gated plan exists, or a step after the gate fails and gated is None. The line has the class of the StageFailure. No push, and the label stays.
    • revised or cleared: a repair ran, the revision is not the same plan as the gated head, and after is less than before. The step pushes the revision. The result is cleared when after is 0 (the label goes), else revised.
    • regated: else, when gated is set. The step pushes the gated plan. The label goes only when the head review ran, before is 0 and no step failed. A failure after the gate keeps its class on the line, for example result=regated class=provider.
    • dismissed: else, when the head review ran and before is 0. No push. The label goes. The comment lists each finding of the last plan comment as dismissed.
    • unchanged: else. No push. The label stays.
      A stop of the Service ends the attempt with no push, as today.
  6. Lines and counts. The attempt line has one template for each path: stopped before the review (with the stop), failed before the review (step, class, masked reason), failed after the review (the same, and before), and reviewed (before, and after when a review of a revision ran). The result line has the counts of StageAttempt (plan_calls, gate_returns, verify_rounds, tokens, seconds) and comment, before only when the head review ran, and after only when a review of a revision ran. A line leaves out a count that the attempt cannot measure and never writes 0 for it, which is the rule of fix(roadmap): leave out changed intake candidates and count plan calls #5166. A success line that lacks a count of FIRST_PASS_LIMITS is no first pass (_is_first_pass, src/devops_cli/roadmap/job_grade_report.py:318-322), so a missing count never adds a first pass.
  7. Grades. SUCCESS_RESULTS[FIX_PLAN] stays {revised, cleared}. regated, dismissed, unchanged, stopped and failed are no success, because none of them repaired a finding of the review of the same pass.
  8. Screen. _review gets a flag that skips the screen, and the head review of fix-plan sets it.
  9. Comments. New texts for regated, dismissed and stopped.
  10. Dry run. fix_plan_requests (src/devops_cli/roadmap/request_plan.py:859-905) lists the read of the head before the attempt marks, the marks of an unreadable head, and the new conditions of the push and of the label.
  11. Documents, written as merged: the module docstring of fix_plan.py, the docstrings of revise, revise_plan and PlanRevision, the comment on SUCCESS_RESULTS, the fix-plan row of ADR 0021 section 8 (Work: the head review runs in each attempt, and the results and their pushes; Marker: the read of the head comes before the marks, and an unreadable head writes only fix_plan.at and fix_plan.result), docs/roadmap/job-success.md (row fix_plan), docs/roadmap/stage.md (The fix-plan step), docs/ROADMAP_WORKFLOW.md:142-143 (the values of fix_plan.result, and the keys of an unreadable head), k8s/README.md item 23, the description of devops_cli_roadmap_fix_plan_total (src/devops_cli/telemetry/instruments.py:349) and docs/TELEMETRY.md.
  12. Known limit. A revision that is not the same plan as the gated head and whose review counts fewer findings is revised or cleared, also when only review variance lowered the count (fix(roadmap): fix-plan compares the revision with a review of the head #5150). No string rule separates the two cases: where of a finding is free text, and a quote can come from the issue or a cited file (src/devops_cli/roadmap/stage/stage_verify.py:88-97, 298-312). same_plan removes the identical case here. feat(roadmap): fix-plan asks if each finding still holds #5215 adds a decision check of each finding of the head review on the revision.

Target Subsystem

Roadmap: the step fix-plan (src/devops_cli/roadmap/steps/fix_plan.py) and the revise path of the stage planner (src/devops_cli/roadmap/stage/stage.py).

Existing Tool Considered

No open tool holds the result rules of this step. The fix uses render_change, log_job_result and redact_text of the project. Cost to build (estimate): 1.2 M tokens and 4 hours elapsed. Keep: the new tests add about 20 s to CI. Fix: about 0.2 M tokens for each wrong result.

Acceptance Criteria

  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_an_unreadable_head_writes_no_result_line_and_uses_no_attempt: the result is unreadable, the WARNING names tasks.md and the reason, no roadmap job result: line occurs, fix_plan.attempts does not change, fix_plan.at is written, no model call occurs, and the counter has result=unreadable.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_an_unreadable_head_waits_six_hours: a selection less than 6 hours later leaves the item out.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_a_failed_repair_keeps_the_findings_of_the_head_review (setup of test_a_failed_plan_run_records_the_attempt_and_writes_nothing_else): the line gives before=1 and names the step and the class.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_a_gate_failure_before_the_review_has_no_review_counts: the gate returns run out, the result is failed, and the line has no before and no after.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_a_stop_before_the_review_is_stopped_with_its_name passes for a false premise (class premise_false), an open blocker and a head over the budget. The label stays, and one fix-plan comment holds the evidence.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_a_gated_plan_is_pushed_when_the_repair_fails: the checks refuse the head, the new reply passes, the review finds 1, and the repair raises AIClientError. The result is regated with class provider, one commit is pushed, and the label stays.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_a_gated_plan_that_differs_is_pushed_after_a_clean_review: the result is regated, one commit is on the latest main, the label goes, and the regated comment is posted.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_a_repair_that_returns_the_same_plan_is_unchanged: before=1, the planner returns the head plan, and the second review finds 0. The result is unchanged, no push occurs, success=false, and the label stays.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_a_clean_head_with_listed_findings_is_dismissed replaces test_a_head_plan_with_no_open_finding_loses_the_label_and_gets_no_commit: no commit, the label goes, the result is dismissed, success=false, and the comment lists the listed findings.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py::test_the_head_review_does_not_take_the_screen passes with the screen in mode on and the band continue.
  • uv run pytest tests/roadmap/test_job_result.py::test_fix_plan_counts_only_a_pushed_repair_as_success passes.
  • uv run pytest tests/roadmap/steps/test_roadmap_fix_plan.py -k replay passes on real fixtures in tests/fixtures/roadmap_fix_plan/: the head of docs(openspec): plan #4472 Size narrowed test workers by collected tests #4917 at ba8cc66 and the stage comment of fix(ci): a narrowed ci test runs many slow tests serially #4472 (the checks refuse the head, and the review is clean) end regated with a push, never cleared with no push. The heads of docs(openspec): plan #2968 Emit inbox gauges and add the inbox panel #4963 (9c4b2cf) and docs(openspec): plan #4697 Keep one metric stream per workload #5032 (7fd165f) with the comments of feat(roadmap): Emit inbox gauges, add panel, show digest line #2968 and fix(telemetry): keep one metric stream per workload #4697 read, and the head review runs.
  • 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 lists the read of the head before the marks and the new conditions.
  • 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 these guards, which pass on both: test_an_unreadable_head_waits_six_hours (the base writes fix_plan.at before the read, fix_plan.py:579), test_fix_plan_counts_only_a_pushed_repair_as_success, and the replay cases of docs(openspec): plan #2968 Emit inbox gauges and add the inbox panel #4963 and docs(openspec): plan #4697 Keep one metric stream per workload #5032. 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: uv run devops roadmap step fix-plan --pull <n> with no --confirm (no model call, no write) on origin/main and on the branch, for each open plan PR: selected, or the reason that leaves it out. After the merge, the App Jobs of the repair of docs(openspec): plan #2968 Emit inbox gauges and add the inbox panel #4963, docs(openspec): plan #4697 Keep one metric stream per workload #5032 and docs(openspec): plan #4472 Size narrowed test workers by collected tests #4917 add their rows.
  • uv run devops docs generate leaves no diff, and uv run devops docs check passes.

Files

  • src/devops_cli/roadmap/steps/fix_plan.py
  • src/devops_cli/roadmap/stage/stage.py
  • src/devops_cli/roadmap/job_result.py (the comment on the success rule)
  • src/devops_cli/roadmap/request_plan.py
  • src/devops_cli/lang/en/messages.py
  • src/devops_cli/telemetry/instruments.py
  • tests/roadmap/steps/test_roadmap_fix_plan.py
  • tests/roadmap/steps/test_roadmap_fix_plan_comment.py
  • tests/roadmap/test_job_result.py
  • tests/commands/test_roadmap_step_fix_plan.py
  • tests/fixtures/roadmap_fix_plan/ (the real heads and comments)
  • docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md (section 8, the fix-plan row)
  • docs/roadmap/job-success.md
  • docs/roadmap/stage.md
  • docs/ROADMAP_WORKFLOW.md
  • docs/TELEMETRY.md
  • k8s/README.md (item 23)
  • openspec/specs/roadmap-stage/fix-plan/spec.md

Dependencies

The stage job leaves this item out until that issue closes (body_dependencies, src/devops_cli/roadmap/refine/refine.py:1119-1128). The replay fixtures of the two unreadable heads need the reader fix, and both PRs change messages.py.

Related

#5061, #5104, #5150, #5164, #4845, #4917, #4472, #4963, #5032. ADR 0021 section 8. #5166 and #5168 also change stage.py, job_result.py and docs/roadmap/job-success.md: #5166 starts after #5216 of this set merges, and #5168 after #5166.

Source: #5211

Activity

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

    @dan-petty
    OwnerAuthor
    • Priority: P1-High. The step loses plans, reports false success, and logs incorrect results, which corrupts the roadmap workflow.
    • Related: feat(roadmap): a fix-plan step repairs a plan PR with open findings #5061, which asks for a different change. Both concern the fix-plan step created by #5061, but #5061 adds the step while the candidate fixes its result-recording and data-loss defects.
  4. added
    priority/p1-high
    status/in-review
    and removed
    status/new
    on Nov 12, 2026
  5. removed
    status/in-review
    on Nov 12, 2026
  6. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-13 00:46 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/p1-highscope/roadmapsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions