Skip to content

feat(roadmap): a fix-plan step repairs a plan PR with open findings - #5104

Merged
dan-petty merged 7 commits into
mainfrom
feat/5061-a-fix-plan-step-repairs-a-plan-pr
Nov 12, 2026
Merged

dan-petty merged 7 commits into
mainfrom
feat/5061-a-fix-plan-step-repairs-a-plan-pr

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A plan pull request with the label plan/needs-fix stayed a draft, because no job repaired its plan.

The new step devops roadmap step fix-plan takes one such pull request of a Staged item. It reads the open findings of the last plan comment, or reviews the plan when no comment lists one. The stage planner gets the plan and the findings, and the review checks the revision with the normal repair rounds. A revision with fewer open findings is one commit on the latest default branch, pushed with a lease. The label goes when no open finding remains.

The row fix_plan follows stage on the model lane, in the mode of roadmap.fix_plan.mode, which starts in plan. Bounds: 1 plan a round, 2 attempts for each head, 6 hours between attempts, 3 revisions for each pull request.

Closes #5061

Change: openspec/changes/archive/2026-11-12-5061-a-fix-plan-step-repairs-a/

@dan-petty dan-petty added type/feature Type feature: a new function scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Design

The stage job keeps a plan pull request in draft with the label plan/needs-fix when an open finding of its model review remains after the repair rounds. No job repaired such a plan after that: the stage job does not select a staged item again, the implement job leaves the draft out, and the row stage_ready keeps it a draft. Six plan pull requests held the label on 2026-11-12, with 9 open findings: 6 criterion_dropped, 1 ignores_existing_code, 1 task_order and 1 false_premise.

This change adds the step fix-plan (src/devops_cli/roadmap/steps/fix_plan.py), the command devops roadmap step fix-plan and the row fix_plan of the model lane, after stage.

  • Selection. One open draft plan pull request that holds plan/needs-fix, recorded in stage.pr of a Staged item with no runner Job and no claim. The item has fewer than 2 attempts on the head, no attempt in the last 6 hours, and fewer than 3 revisions of the step. Highest priority first, 1 plan for each call. --item or --pull names one item.
  • Findings. The open findings come from the newest trusted comment of the stage job or of the step that names the pull request (comment_open_findings reads the section that open_findings_section writes). A test reads the real stage comment of the plan of fix(github): Fix check-readiness base and monitor merged state #2530 and reads back each line that finding_line writes. With no such comment, the verification pass reviews the plan of the head.
  • Repair. The step reads the plan of the head with read_change and calls the new seam stage.revise_plan at the latest default branch. _Planner.revise calls the existing _request, _gated, _review, _repaired and _verified: the checks judge the head plan as a kept plan, the planner gets the plan as previous and each open finding as problem, and the revision goes through the normal verification repair rounds. No planner or verifier code is new.
  • Writes. A revision with fewer open findings becomes one commit on the latest default branch, pushed with --force-with-lease on the head that the step read. The label goes when no open finding remains. A head plan with no open finding only loses the label. A revision that is not better writes only the record. The step stops before any write when the head moved or holds a commit of another author, and no attempt starts while the Service stops.
  • Marks and output. Record keys fix_plan.key, fix_plan.attempts, fix_plan.revisions, fix_plan.at and fix_plan.result, with the attempt marks written before the first model call. One comment with the marker of the step (CONST_ROADMAP_FIX_PLAN_COMMENT_MARKER) on the issue for each attempt that changes the plan or the label. One result line with job=fix_plan, and the counter devops_cli_roadmap_fix_plan_total by repo and result. The command report shows the counts of the attempt.
  • Mode. roadmap.fix_plan.mode is off, plan or on, and starts in plan (ADR 0021, section 8, rule 5). Mode plan logs the selection with no model call and no write. --confirm on the command acts in every mode.
  • Records. ADR 0021 sections 2 and 8 and ADR 0022 section 2 get the row fix-plan. docs/roadmap/stage.md, docs/ROADMAP_WORKFLOW.md, docs/roadmap/job-success.md, docs/roadmap/package-layout.md, k8s/README.md and the example ConfigMap describe it. The new capability is roadmap-stage/fix-plan.

Decisions: the step posts its own comment and does not edit the stage comment, as ADR 0021 section 8 rule 1 requires. It writes one commit on the latest default branch, the form of a stage branch, so the push holds origin/main and cannot conflict.

Test results

  • New tests: tests/roadmap/steps/ (3 files) and tests/commands/test_roadmap_step_fix_plan.py: 42 passed. Git is real in tmp_path, as in the stage tests.
  • Covering tests (stage verification, stage job, stage_ready, implement selection and submit, the run tables and lanes, job result, limits, telemetry, stores, config, lang, dry run, invariants): 2205 passed on the branch rebased onto bacf71321 (FIX 2, feat(roadmap): extend stage review rounds while open findings drop #5090).
  • uv run devops ci --check --only lint,format,docs,openspec,test-tree: pass. mypy on the 17 changed source files: no issue.
  • uv run devops ci fail-to-pass --base origin/main: 14 tests failed on the base and 4 new test modules errored on the base (they import the new step); all pass on the head.

Validation on the six plan pull requests

The corpus snapshot is the open findings sections of the stage comments on 2026-11-12. All six plans were staged before #5067, so their findings came from the old return rule: only RETURN_TYPES findings went back to the planner, and none of the 6 criterion_dropped findings did.

Pull Item Open findings before (by type) Run After Label
#4849 #1910 2 criterion_dropped not run - kept
#4917 #4472 1 ignores_existing_code not run - kept
#4963 #2968 2 criterion_dropped not run - kept
#4980 #2530 1 criterion_dropped selection only (selects #4980 at 89b5e650822f) - kept
#5032 #4697 1 criterion_dropped not run - kept
#5053 #4945 1 task_order, 1 false_premise not run - kept

The live attempts did not run: the permission system of the agent session refused the first --confirm run (#4980), because it writes to the Service branches, labels and comments. A person must approve that run, or set roadmap.fix_plan.mode: on after the merge so that the Service runs the step as the App.

The step fix-plan takes one open draft plan pull request that holds
plan/needs-fix, reviews its plan again at the latest default branch,
gives the stage planner the plan and each open finding, and pushes a
revision with fewer open findings as one commit on the default branch
with a lease. The label goes when no open finding remains.

The row fix_plan of the model lane runs it in the mode of
roadmap.fix_plan.mode, which starts in plan. The command
devops roadmap step fix-plan runs it by hand.

Refs #5061
The step gives the planner the open findings that the newest trusted comment of the stage job or of the step lists for the pull request. A review of the head plan is the fallback. The command takes --pull to name the plan pull request.

Refs #5061
@dan-petty
dan-petty force-pushed the feat/5061-a-fix-plan-step-repairs-a-plan-pr branch from 56e1b4b to e0c34ab Compare November 12, 2026 14:31
@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 14:39
@dan-petty

Copy link
Copy Markdown
Owner Author

CI: the first push failed one test, tests/security/test_config_declarations.py::test_the_variables_are_those_before_one_for_each_read_option_that_had_none_and_later_ones, because the new setting adds the variable DEVOPS_CLI_ROADMAP_FIX_PLAN_MODE. Commit 662fcfc4c declares it. At head e0c34aba7 (rebased onto main with #5090), all 26 check runs pass.

@dan-petty
dan-petty merged commit ca5b16d into main Nov 12, 2026
26 checks passed
@dan-petty
dan-petty deleted the feat/5061-a-fix-plan-step-repairs-a-plan-pr branch November 12, 2026 15:07
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.119.0](v0.118.0...v0.119.0)
(2026-11-12)


### Features

* **repos:** the claim sets In Progress
([#5111](#5111))
([06ef1c6](06ef1c6))
* **roadmap:** a fix-plan step repairs a plan PR with open findings
([#5104](#5104))
([ca5b16d](ca5b16d))
* **roadmap:** extend stage review rounds while open findings drop
([#5090](#5090))
([bacf713](bacf713))
* **roadmap:** re-anchor a stale citation that matches one line
([#5040](#5040))
([16356d8](16356d8))


### Bug Fixes

* **ci:** keep failed test IDs in the service image shard summary
([#5106](#5106))
([88589ef](88589ef))
* **github:** count each page of a paginated GitHub read
([#5070](#5070))
([908e24a](908e24a))
* **github:** keep the metrics permissions out of the runner Job token
([#5064](#5064))
([fb549ff](fb549ff))
* **github:** pace mutations through the clock seam
([#5063](#5063))
([2bd87bc](2bd87bc))
* **k8s:** delete the CoreDNS files that k3s never applies
([#5055](#5055))
([463f601](463f601))
* **monitoring:** tidy LLM stack windows, units and lines
([#5052](#5052))
([375d724](375d724))
* **roadmap:** a refused kept plan uses no stage gate return
([#4983](#4983))
([b8adbca](b8adbca))
* **roadmap:** count a command as removed only when MUST NOT governs it
([#4985](#4985))
([2e6f407](2e6f407))
* **roadmap:** cut prose after a cited stage command
([#4982](#4982))
([a172563](a172563))
* **roadmap:** name every module of a group with no named test
([#5089](#5089))
([27a0e79](27a0e79))
* **roadmap:** stage returns every open review finding to the planner
([#5067](#5067))
([21b116e](21b116e))
* **roadmap:** the alternatives check reads the tools in use
([#5062](#5062))
([8903233](8903233))
* **roadmap:** the constants gate reads 6_500 and no new value
([#5080](#5080))
([8a7b113](8a7b113))
* **roadmap:** the constants gate reads only a stated value
([#5042](#5042))
([cf4733e](cf4733e))
* **telemetry:** read repository traffic as the GitHub App
([#4932](#4932))
([7c42823](7c42823))
* **tests:** close the UDP, DNS and git gaps of the network floor
([#5101](#5101))
([047ee48](047ee48))
* **tests:** repair the bwrap contract suite and gate it
([#5110](#5110))
([9a0659d](9a0659d)),
closes [#4715](#4715)


### Performance Improvements

* **ci:** build the Service image once for its test shards
([#5079](#5079))
([dcf5bd5](dcf5bd5))
* **ci:** run only the required checks on the release PR
([#5057](#5057))
([8174071](8174071))
* **ci:** stop the cache export of pull request image builds
([#5113](#5113))
([ba30820](ba30820))
* **roadmap:** consolidate keeps its vectors in the shared tiers
([#5099](#5099))
([2a8bf1a](2a8bf1a))


### Code Refactoring

* **roadmap:** one Status writer for every job
([#5109](#5109))
([24cfedc](24cfedc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
@dan-petty

Copy link
Copy Markdown
Owner Author

Validation row: #4980 (item #2530)

The first live attempt ran as the App in Job devops/fix-plan-validate-4980 (0.119.0, the Service pod spec), 2026-11-12T15:52Z to 16:48Z.

Field Value
Head 89b5e650822f
Open findings before, stage comment (08:34Z, earlier review) 1: criterion_dropped
Open findings before, review of the head with the 0.119.0 verifier (same model, main 22176a02be18) 2: false_premise (the same defect as the comment), verify_form (group 3 verifies only tests/github/test_github_pr_monitor.py)
Open findings after, last review of the revision 2 (types not recorded)
Result unchanged, nothing pushed, label kept
Runs plan_calls 6 (3 repairs, 3 gate returns: citation, paths, trace), verify_rounds 3
Tokens 15,933,306: reviews 9,800,342 (62%), repairs 4,479,335 (28%), gate returns 1,653,629 (10%); about 96% of the input tokens were cache reads
Seconds 3272: reviews about 1418, plan runs about 1773

Cause. A defect of the step: it compared the count of the stage comment (1) with the last review of the revision (2). A review of the same head with the same model and prompt found 2, so the revision was not better but not worse. The first repair got only the comment finding and not the verify_form finding. Fix: #5150, draft PR #5160. Each attempt now reviews the head and compares with that review, and the planner gets the findings of the review and of the comment.

Cost. No new cap: the run-count bounds hold an attempt, and reviews are the main cost. The fix adds one review (about 2.8M tokens on #4980) and saves all plan runs when the head review is clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(roadmap): a fix-plan step repairs a plan PR with open findings

1 participant