Repository navigation
Description
Problem
A review of PR #6015 (#5969, the review step) found defects. Mode plan, the template value, writes nothing and is safe; items 1 and 2 must be fixed before a person sets roadmap.review.mode: on.
- High: the key check runs before the rules (
src/devops_cli/roadmap/steps/review.py, about line 661). A head that already has a verdict is skipped beforeread_facts, so later facts are lost: a new conflict, a new review thread,verdict/fix-planfrom plan drift, a closed item. Example: a plan is judged Mergeable and marked ready; plan drift then addsverdict/fix-plan; the PR stays ready with two verdict labels, and fix-plan refuses a PR that is not a draft (fix_plan.py, about line 553). - High: a discard closes the pull request before the leased branch delete (
_discard, about lines 505-517). If the lease or the clone fails, the PR is closed with the discard label, the branch stays, and the item does not go back to New; the step skips closed PRs (about line 432), so nothing repairs it. - Medium: back to draft fights the watch row.
watch_row.py(about lines 416-425) marks each green bot plan ready unlessstage.needs_fixnames it, and the READY rule ofsteps/watch.py(about lines 207-250) ignores verdict labels; an Issue changed or Needs fix plan goes back to ready at the next poll. The step also does not check whether a person marked the PR ready. - Medium: the live-unit guard reads only
implement.job(job_holds); the watch row and the open row also skip onstage.job. - Medium: the owner guard (about lines 420-421) stops on each
owner/*label, alsoowner/service; fix-checks usesclaim_labels, which leavesowner/serviceout. - Medium: the shared-branch guard (about lines 591-595) checks only
implement.pr; a plan discard can delete implement work on the plan branch and leave staleimplement.branch,implement.wipandimplement.base. - Low: a model-only discard needs evidence that names any file of the diff (about lines 353-368); issue text could steer the model to close a PR and delete its branch.
- Low: with no withdraw, the comment and the label are written before the step raises (about lines 527-531).
- Low: a PR whose only failed checks are CI infrastructure waits with no limit and no log line; after a person edits an issue whose plan merged, each new head gets Issue changed until the cap.
Expected behavior
- The key only skips the model call; the rules run on each call.
- A discard deletes the branch with the lease first, then closes the PR, then returns the item; a failure at any step leaves a state that the next call repairs.
- The watch row holds the ready mark on any verdict label other than
verdict/mergeable, and the step does not move a PR back to draft when a person marked it ready. - The step skips an item with a live
stage.jobtoo, usesclaim_labels, and refuses a discard whenimplement.branchequals the head branch. - In mode
on, a discard from the model alone adds the label and the comment and leaves the close to a person. - The withdraw check comes before the first write; a wait on CI infrastructure has a limit and a log line.
- A test for each item fails on the base.
Related
- feat(roadmap): a review job gives each bot PR its verdict #5969, feat(roadmap): Give each bot PR one verdict with a review step #6015, feat(roadmap): start the review step as a Job from the watch row #6011 (launcher and trigger), feat(roadmap): the PR review gate scores each bot PR #5968.
Proposed design
Problem statement
A review of pull request #6015 (#5969, the review step) found nine defects. Mode plan is the template value and writes nothing, so the step is safe today. Items 1 and 2 are high and must be fixed before a person sets roadmap.review.mode: on. Items 3 to 8 and the first part of item 9 are lower defects of the same step. This change fixes items 1 to 8 and the CI infrastructure wait of item 9, and it adds one test for each item that fails on the base. The second part of item 9 names no expected behavior in the issue, so a new issue holds it.
Acceptance criteria
Requirement: The rules run on every call
The review step SHALL read the facts and run its rules on every call, and the stored verdict key SHALL skip only the model call.
Scenario: A closed item whose head already has a verdict
- WHEN The job record of the item holds the review key of the head, and the item is closed.
- THEN The step returns the verdict Issue changed, writes its comment and its label, and makes no model call.
Requirement: The discard order
A discard SHALL delete the branch with the lease before it closes the pull request, and SHALL return the item after the close.
Scenario: The order of the calls of one discard
- WHEN The step performs a discard with a withdraw and a client that each record their call.
- THEN The branch delete runs first, the close runs second and the return runs third.
Requirement: The repair of a partial discard
A discard that fails after the branch delete SHALL leave a state that the next call of the step repairs.
Scenario: A close that fails after the branch delete
- WHEN The withdraw succeeds, the close raises, and the step runs again on the same pull request.
- THEN The second call closes the pull request, returns the item to New with its plan or delivery keys cleared, and deletes no branch again.
Requirement: The repair of a failed return
The step SHALL complete a discard whose return failed, also when the pull request is already closed.
Scenario: A return that fails after the close
- WHEN The withdraw and the close succeed, the return fails, and the step runs again.
- THEN The second call returns the item to New with its plan or delivery keys cleared.
Requirement: The watch row holds the ready mark
The watch row and the READY rule SHALL NOT mark a green bot plan ready when the pull request holds a verdict label other than verdict/mergeable.
Scenario: A green plan that holds a fix-plan verdict
- WHEN A green bot plan pull request holds
verdict/fix-planat the poll of the watch row. - THEN The pull request stays a draft and no ready mark is written.
Requirement: A person's ready mark stays
The review step SHALL NOT mark a pull request a draft when a person marked it ready after the last verdict of the step.
Scenario: A person marks the pull request ready, then the step judges Needs fix
- WHEN A person marked the pull request ready after the step wrote its last verdict, and the new verdict is Needs fix.
- THEN The pull request stays ready for review and the step writes no draft mark.
Requirement: A live stage job holds the item
The review step SHALL skip an item whose job record holds a live stage.job, and SHALL send no model request.
Scenario: A live stage job on the item
- WHEN The job record of the item holds a live
stage.job. - THEN The step returns skipped with the job name in the reason and makes no model call.
Requirement: The claim of the Service does not stop the step
The review step SHALL stop only on a claim label, and SHALL judge a pull request whose item holds owner/service.
Scenario: The Service holds the item
- WHEN The item holds
owner/serviceand noowner/agentand noowner/humanlabel. - THEN The step judges the pull request and writes its verdict.
Requirement: A shared branch blocks the discard
The review step SHALL refuse a discard when the head branch equals implement.branch or the branch of the plan pull request of the item.
Scenario: A plan discard on the branch of the implementation
- WHEN The head branch of the plan pull request equals
implement.branchof the item and the verdict is a discard. - THEN The step posts the shared reason, closes no pull request and deletes no branch.
Requirement: The model alone does not close a pull request
A discard that the model alone gives SHALL write the verdict label and the comment and SHALL close no pull request.
Scenario: A model discard with evidence
- WHEN The judge returns a discard with evidence that names a file of the diff, and the mode is
on. - THEN The pull request stays open, its labels hold the discard label, and its comment holds the verdict and the reason.
Requirement: The withdraw check runs before the first write
The review step MUST check that a withdraw exists before it writes its first comment or label.
Scenario: A discard with no withdraw
- WHEN The step will perform a discard and the caller gives no withdraw.
- THEN The step raises
RoadmapImplementErrorand writes no comment and no label.
Requirement: A CI infrastructure wait is bounded and logged
A wait on CI infrastructure SHALL write one result line for each wait and SHALL stop at the limit of waits on the head.
Scenario: The head fails only on CI infrastructure
- WHEN Only CI infrastructure checks fail on the head, and the count of waits on that head reaches
roadmap.review.rounds. - THEN The step returns capped and posts one comment that leaves the pull request for a person, and each earlier wait wrote one result line.
Requirement: Each new test fails on the base
Each test that this change adds MUST fail on the base commit.
Scenario: The new tests on the base commit
- WHEN The new tests run against the base commit of the change.
- THEN Each new test fails.
Existing Tool Considered
No check has run. No open, maintained tool or library covers the need: the change corrects the roadmap step of this project, its watch row and its claim guard, and no outside package decides a verdict, a discard order or a draft state. The change builds its own code. The written cost is about 150,000 output tokens to build (about 12 agent steps), about 20,000 tokens a year to keep and fix, and about 1 day of elapsed time.
Key questions
- Where do the stored verdict key and the cap of verdicts go in the step?: After the rules and immediately before the model call. The step reads the facts and runs the rules on every call, and the key and the cap then stop only the model call. (best practice) [sources: src/devops_cli/roadmap/steps/review.py, src/devops_cli/roadmap/steps/review_facts.py:369]
- Chosen: After the rules, before the model call. The rules see each new fact, so a new conflict, a new thread or a closed item gets its verdict. The key still stops a second model call on the same head and issue text.
- Rejected: Before read_facts, as today. This is the defect: the key skips read_facts, so later facts are lost and the pull request keeps two verdict labels.
- Rejected: Remove the key check. Each call would pay for a model call on a head and a text that a call already judged.
- What order does a discard use, and how does the step repair a discard that fails?: Delete the branch with the lease first, close the pull request second, return the item third. Each step is idempotent, and the step repairs a partial discard from its own discard label, also when the pull request is closed. (best practice) [sources: src/devops_cli/roadmap/steps/review.py:502, src/devops_cli/roadmap/steps/review.py, src/devops_cli/roadmap/return_item.py]
- Chosen: Branch delete, close, return, with a repair path. A failure leaves either the pull request untouched or a state that the discard label and the item marks name, so the next call finishes the discard.
- Rejected: Close, branch delete, return, as today. This is the defect: a failed lease leaves a closed pull request, a live branch and an item that never returns to New.
- Rejected: Return the item first, then delete and close. The item would leave New while its pull request and its branch are still live, and the issue fixes the order.
- How does the step tell a ready mark of a person from a ready mark of the step?: Read the timeline of the pull request and take the actor of the last
ready_for_reviewevent. A non-bot actor is a person, and the step then leaves the pull request ready. (best practice) [sources: src/devops_cli/roadmap/steps/ready.py, src/devops_cli/roadmap/steps/review.py]- Chosen: The actor of the ready_for_review event on the timeline. GitHub keeps the actor of each ready_for_review event, and the step already reads the pull request of the item.
- Rejected: The last verdict of the step. The record cannot tell a person's later ready mark from the step's own earlier one.
- Rejected: Never mark a pull request a draft again. The fix rows take only a draft, so a Needs fix pull request would stay ready and no fix step would take it.
- Where does the check for the verdict labels live?: In the ready decision that the watch row and the READY rule of the watch step share. A verdict label other than
verdict/mergeableholds the ready mark. (best practice) [sources: src/devops_cli/roadmap/watch_row.py, src/devops_cli/roadmap/steps/watch.py, CONTEXT.md]- Chosen: The shared ready decision of both callers. One place holds the rule, so the watch row and the READY rule cannot disagree.
- Rejected: The watch row alone. The READY rule of the watch step would still mark the pull request ready at its own poll.
- Rejected: The review step writes the draft again on each poll. Two writers of the draft state race, and the watch row would mark the pull request ready again at the next poll.
- Where does the live
stage.jobguard go?: Injob_holdsofsrc/devops_cli/roadmap/status_sync.py. The review step, the watch row and the open row all call it, so one change covers each caller. (best practice) [sources: src/devops_cli/roadmap/status_sync.py:171, src/devops_cli/roadmap/watch_row.py, src/devops_cli/roadmap/open_row.py, src/devops_cli/roadmap/steps/review.py]- Chosen: Extend job_holds to read stage.job. Every caller gets the guard, and the issue names job_holds as the guard that reads only implement.job.
- Rejected: Add the check in the review step alone. The watch row and the open row keep the defect, and the issue names them.
- Rejected: A new guard function for the stage job. A second guard of the same question lets the two answers drift.
- Which labels stop the review step?: The claim labels of
claim_labels:owner/agentandowner/human. The Service's ownowner/servicedoes not stop the step. (best practice) [sources: src/devops_cli/roadmap/claim.py:80, src/devops_cli/roadmap/steps/fix_checks.py:193, CONTEXT.md]- Chosen: claim_labels. The step fix-checks already uses it, so the two steps agree, and a claim of the Service is not a stop.
- Rejected: A prefix test on owner/. This is the defect: the Service's own claim stops the step that the Service started.
- When does the step refuse a discard?: When the head branch equals the
implement.branchof the item, or the branch of the plan pull request of the item. The step then posts the reason and leaves the close and the delete to a person. (best practice) [sources: src/devops_cli/roadmap/steps/review.py, src/devops_cli/roadmap/stores/store.py]- Chosen: Refuse when the head branch holds the work of another job. The branch holds implement work, so a plan discard that deletes it destroys work that no key records.
- Rejected: Check implement.pr alone, as today. This is the defect: a plan discard leaves stale implement.branch, implement.wip and implement.base.
- What does the step do with a discard that only the model gives?: It writes the verdict label and the comment and closes nothing; a person closes the pull request. The discard action of the step stays correct and repairable for a discard that a rule gives. (best practice) [sources: src/devops_cli/roadmap/steps/review.py, docs/adr/0005-review-findings-come-from-tools-not-models.md]
- Chosen: The model's discard writes the label and the comment only. The issue text can steer the model, and ADR 0005 keeps the state of a finding to tools and people.
- Rejected: Close when the evidence names a file of the diff. This is the defect: the issue text can steer the model to name any file of the diff.
- Rejected: Ask two model calls to agree. Voting cannot remove a deterministic false positive, and it doubles the token cost.
- When does the step check that a withdraw exists?: Before its first write. A discard with no withdraw raises
RoadmapImplementErrorand writes no comment and no label. (best practice) [sources: src/devops_cli/roadmap/steps/review.py]- Chosen: Before the first write. A raise after the comment and the label leaves a verdict on the pull request that no action follows.
- Rejected: Inside the discard action, as today. This is the defect: the comment and the label are already written when the step raises.
- What limit does a wait on CI infrastructure have?: The limit of waits on one head is the value of
roadmap.review.rounds, and the step counts each wait in its record. At the limit the step stops and leaves the pull request for a person. (best practice) [sources: src/devops_cli/roadmap/steps/review.py, src/devops_cli/config/settings.py, src/devops_cli/roadmap/stores/store.py]- Chosen: Reuse roadmap.review.rounds as the limit of waits. The setting already bounds the work of the step on one pull request, and the issue asks for a limit and no new key.
- Rejected: Add a setting roadmap.review.waits. A second key of the same purpose adds configuration that the issue does not ask for.
- Rejected: Keep waiting with no limit. This is the defect: a pull request waits for ever and the log holds no line.
- Does this change wait on the launcher and the trigger of feat(roadmap): start the review step as a Job from the watch row #6011?: No. This change corrects the step alone, and a test drives the step with a fake judge and a fake withdraw. The launcher and the trigger stay in feat(roadmap): start the review step as a Job from the watch row #6011. (best practice) [sources: src/devops_cli/roadmap/steps/review.py, src/devops_cli/roadmap/steps/watch.py]
- Chosen: The step alone, with fakes in the tests. Each defect is in the step or in its guards, and a fake judge and a fake withdraw exercise each path offline.
- Rejected: Wait for feat(roadmap): start the review step as a Job from the watch row #6011 to merge first. The launcher starts the step and changes none of its defects, so the wait buys nothing.
- Which step of the work waits on a person?: One person merges the pull request into main after the required checks pass. Nothing else waits on a person for this change. (a person decides)
- Who sets
roadmap.review.modetoon?: A person sets it, after this change merges. The step writes nothing in modeplan, so the fix is safe to merge first. (a person decides) [sources: src/devops_cli/config/settings.py]
Open questions
- Which step of the work waits on a person? (a person decides)
- Who sets
roadmap.review.modetoon? (a person decides)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 16, 2026
Two High-severity defects risk data loss and broken state; they block enabling the review step mode 'on'.Both concern the review step (#5969); #6011 starts it as a Job, while this candidate fixes internal defects that must land before mode 'on' is safe.devops-cli-service commentedon Nov 16, 2026
Owner question: Which step of the work waits on a person? (a person decides)
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
chore(main): release 0.169.0 (#6034)
devops-cli-service commentedon Nov 16, 2026
Released in v0.169.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.169.0
devops-cli-service commentedon Nov 16, 2026
Live since 2026-11-16 21:30 UTC