Repository navigation
Description
Problem
The orphan cleanup of stage keeps the App-only branch of a Ready item, but it also clears the stage.pending mark of that item. _remove_staged (src/devops_cli/roadmap/stage/stage.py, about line 4186) sets every key of STAGE_REMOVAL_KEYS to None, and the set holds stage.pending. _resumable_branches (about line 3204) resumes a branch only while stage.pending is set. So after the cleanup the item has a kept branch and no mark, and every later round leaves it out as "held by a pushed branch". The docstring of _remove_staged says that the branch is kept "so the stage pipeline can resume on it". No real record can do that.
Evidence
A review of #6664 ran this with the real git stage_repo fixture, on main 637e425 and on the branch of #6664. Both gave the same result:
- A stage Job stops after its push. The record keeps
stage.pending, and origin keeps the App-only branch. - The Service row
run_stage_roundselects the item as an orphan.StageWriter.beginkeeps the branch and clearsstage.pending. - The next Job runs
plan_stagefor the item. Result: nothing staged, no model call, and the item is left out with "Issue 1 is held by a pushed branch".
The item stays stuck until a person deletes the branch.
Expected
When the cleanup keeps the branch, it keeps stage.pending too, so the next round resumes on the branch. _stage_one already writes the mark again before its push and clears it on success.
Acceptance criteria
- A test with the real git
stage_repofixture: after the orphan cleanup keeps the App-only branch of a Ready item, the next round resumes on it and stages the item.
Source
Source: #6664
Alternatives check of 2026-11-21: none.
Tool: none found.
Reason: Searches for resumable stage pipelines and kept-branch resume found no tool or library. The defect is in the project's own _remove_staged and _resumable_branches code, which no external tool covers; #6528 owns the fix.
Lacks:
- Keeps
stage.pendingwhen an App-only branch is kept - Resumes the next stage round on the kept branch
- Real git
stage_repotest for the orphan-cleanup resume case
Proposed design
Problem statement
The stage orphan cleanup keeps the App-only branch of a Ready item but clears stage.pending, the mark that _resumable_branches needs to resume on that branch, so every later round leaves the item out as held by a pushed branch and a person must delete the branch. The cleanup SHALL keep the mark when it keeps the branch, clear it when it deletes the branch, and clear it when a plan stops on the budget so the stop and its owner question stand; a test with the real git stage_repo fixture proves the next round resumes on the kept branch.
Acceptance criteria
Requirement: Kept branch keeps the resume mark
The stage orphan cleanup SHALL keep stage.pending set when it keeps the App-only branch of a Ready item.
Scenario: Cleanup keeps the mark
- WHEN A test calls
_remove_stagedfor a Ready item whose record holdsstage.pendingand whose App-only branch the cleanup keeps. - THEN The record still holds
stage.pending, and every other key ofSTAGE_REMOVAL_KEYSis None.
Requirement: Deleted branch clears the resume mark
The stage orphan cleanup SHALL clear stage.pending when it deletes the branch of an item.
Scenario: Cleanup deletes the branch
- WHEN A test calls
_remove_stagedfor an item whose branch the cleanup deletes from origin. - THEN The record has
stage.pendingset to None.
Requirement: Budget stop clears the kept mark
A stage round that stops a Ready item on the token budget MUST clear stage.pending, so the next round does not resume the item and the stop stands.
Scenario: Stop keeps its owner question
- WHEN A test resumes a Ready item on its kept branch and the plan stops on the budget through
_stop_on_budget. - THEN The record holds
stage.needs_splitandstage.file_capand hasstage.pendingset to None, and the next round judges no orphan for the item.
Requirement: Kept branch resumes in the next round
The next stage round SHALL resume on the kept App-only branch and stage the Ready item.
Scenario: Next round resumes
- WHEN A test with the real git
stage_repofixture removes a Ready item whose stage Job stopped after its push, origin holds its App-only branch, and the next round runsplan_stage. - THEN The next round stages the item on the kept branch, makes its model call, and does not leave the item out as held by a pushed branch.
Existing Tool Considered
The alternatives check of 2026-11-21 in the issue body records verdict none and names no tool; a further search for an open, maintained tool or library that resumes work on a kept git branch after a cleanup found none. No external tool covers the stage record of this project, so the fix stays in the project's own _remove_staged and _stop_on_budget code and their tests. The block in the issue body lists what that code lacks. The written cost to build, keep and fix that code is about 40k tokens and about one day.
Key questions
- Which code clears the stage mark that a resume needs?:
_remove_stagedwrites None for every key ofSTAGE_REMOVAL_KEYS(src/devops_cli/roadmap/stage/stage.py:4208).STAGE_REMOVAL_KEYSis every plan key but the failure ledger (src/devops_cli/roadmap/stores/store.py:327), andstage.pendingis one of those keys (src/devops_cli/roadmap/stores/store.py:288)._resumable_branchesresumes a branch only whilestage.pendingis set (src/devops_cli/roadmap/stage/stage.py:3248). [sources: src/devops_cli/roadmap/stage/stage.py:4208, src/devops_cli/roadmap/stores/store.py:327, src/devops_cli/roadmap/stores/store.py:288, src/devops_cli/roadmap/stage/stage.py:3248] - What does the project say the kept App-only branch is for?: The docstring of
_remove_stagedsays the App-only branch of a Ready item is kept so the stage pipeline can resume on it (src/devops_cli/roadmap/stage/stage.py:4201), anddocs/ROADMAP_WORKFLOW.md:149anddocs/roadmap/stage.md:163say the next round resumes on the kept branch and plans the item again. The sentence ofdocs/roadmap/stage.md:163that the cleanup clears the record is what the code does today; the change corrects that sentence to the kept intent mark. [sources: src/devops_cli/roadmap/stage/stage.py:4201, docs/ROADMAP_WORKFLOW.md:149, docs/roadmap/stage.md:163] - Which issue must land before this fix?: None. The stage-on-phases design held this fix for refactor(roadmap): run stage on Coder in the runner image #6528 (
openspec/changes/archive/2026-11-21-6704-stage-on-phases/design.md:11), and that work landed as refactor(roadmap): the stage agent is stock Coder #6705, the owner decision in ADR 0036 that stage runs stockCoderwithpublish(docs/adr/0036-the-stage-agent-runs-stock-coder-and-publish-checks.md:13,openspec/changes/archive/2026-11-23-6705-stage-agent-stock-coder/proposal.md:5). refactor(roadmap): re-architect stage and implement on Coder #6519 is the tracker of the re-architecture, and a tracker names no blocker (docs/roadmap/refine.md:31), so this item carries no dependency and can be built now. (best practice) [sources: openspec/changes/archive/2026-11-21-6704-stage-on-phases/design.md:11, docs/adr/0036-the-stage-agent-runs-stock-coder-and-publish-checks.md:13, openspec/changes/archive/2026-11-23-6705-stage-agent-stock-coder/proposal.md:5, docs/roadmap/refine.md:31]- Chosen: Fix it now, with no dependency. The recorded wait was for refactor(roadmap): run stage on Coder in the runner image #6528, whose work landed as refactor(roadmap): the stage agent is stock Coder #6705 (ADR 0036), and the guard that keeps a budget stop is in the code (
src/devops_cli/roadmap/stage/stage_job_phases.py:1040), so the wait no longer holds. - Rejected: Wait for the refactor(roadmap): re-architect stage and implement on Coder #6519 tracker. A tracker names no blocker (
docs/roadmap/refine.md:31), and the item would then hold no test that passes before the whole re-architecture lands. - Rejected: Keep refactor(roadmap): run stage on Coder in the runner image #6528 as the dependency. refactor(roadmap): run stage on Coder in the runner image #6528 closed as not planned, so the dependency would never clear.
- Chosen: Fix it now, with no dependency. The recorded wait was for refactor(roadmap): run stage on Coder in the runner image #6528, whose work landed as refactor(roadmap): the stage agent is stock Coder #6705 (ADR 0036), and the guard that keeps a budget stop is in the code (
- Why is the kept mark safe for a new plan and for a budget stop?: A record that holds a recorded plan holds
stage.pr, andorphan_markreads an item with a pull request as no orphan (src/devops_cli/roadmap/stage/stage_pending.py:61), while_stage_onewrites the plan keys and clearsstage.pendingin one write (src/devops_cli/roadmap/stage/stage.py:4094). The phase stop already clearsstage.pendingbeside the stop (src/devops_cli/roadmap/stage/stage_job_phases.py:1040); the change adds the same clear to_stop_on_budget(src/devops_cli/roadmap/stage/stage.py:4156), which--phase alluses and which today keeps the mark, so a later orphan cleanup would erasestage.needs_splitandstage.file_capand resume the stopped item. [sources: src/devops_cli/roadmap/stage/stage_pending.py:61, src/devops_cli/roadmap/stage/stage.py:4094, src/devops_cli/roadmap/stage/stage_job_phases.py:1040, src/devops_cli/roadmap/stage/stage.py:4156] - What should the cleanup write when it keeps the App-only branch?: Keep
stage.pendingand clear the other removal keys; clear the mark when the cleanup deletes the branch; and clear the mark when a plan stops on the budget, so the stop and its owner question stand._resumable_branchesthen resumes on the kept branch, and_stage_oneclears the mark on a successful stage. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py:4208, src/devops_cli/roadmap/stores/store.py:327, src/devops_cli/roadmap/stage/stage.py:3248, src/devops_cli/roadmap/stage/stage.py:4094, src/devops_cli/roadmap/stage/stage.py:4156, src/devops_cli/roadmap/stage/stage_job_phases.py:1040]- Chosen: Keep the mark when the branch is kept, clear it on a delete and on a stop. The resume needs the mark, and the clear on a stop keeps
stage.needs_splitandstage.file_capand their owner question. - Rejected: Clear every removal key. This is the current defect: it clears
stage.pendingand strands the kept branch. - Rejected: Remove
stage.pendingfromSTAGE_REMOVAL_KEYSfor every cleanup. A cleanup that deletes the branch would leave a resume mark with no branch. - Rejected: Keep every removal key. Stale plan keys can block a new plan.
- Chosen: Keep the mark when the branch is kept, clear it on a delete and on a stop. The resume needs the mark, and the clear on a stop keeps
- Is the stage job's
<60grade a rule against this fix?: No. The grade table gives the owner actionRe-architect the workflow.for a job under 60% (docs/roadmap/job-success.md:85,src/devops_cli/roadmap/job_grade.py:137), which is the owner's action for the workflow and no ban on a defect fix. The recorded hold that froze incremental work on the stage job is a line in an item's Dependencies section (openspec/specs/roadmap-refine/waits/spec.md:221) that names chore(roadmap): hold incremental stage and implement work #6521 and not the tracker refactor(roadmap): re-architect stage and implement on Coder #6519 (docs/roadmap/refine.md:31), and this body carries no such hold. [sources: docs/roadmap/job-success.md:85, src/devops_cli/roadmap/job_grade.py:137, openspec/specs/roadmap-refine/waits/spec.md:221, docs/roadmap/refine.md:31]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 21, 2026
Both concern the stage orphan cleanup, but 5026 moves it to the status lane while the candidate fixes it clearing stage.pending while keeping the branch.dan-petty commentedon Nov 21, 2026
This item waits for the stage re-architecture in #6528. Stage grades under 60%, and the owner rule for such a job allows no incremental fix, only the re-architecture. #6528 must keep this case in view: when a cleanup keeps an App-only branch of a Ready item, the next stage round must resume on it.
devops-cli-service commentedon Nov 21, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (2)
Searches run:
Sources:
dan-petty commentedon Nov 22, 2026
The review of #6710 (PR A of #6528) tried the fix of this item that the body asks for:
_remove_stagedkeepsstage.pendingwhen it keeps the App-only branch. The fix makes the resume work, but it causes two new defects. So #6710 leaves this item out, and the re-architecture in #6528 takes it with the cases below in view.The review ran each case with the real git
stage_repofixture on head 16c91eb.stage.pendingkept, the Service stage round judges the item as an orphan again in each round, until a Job records a draft. Each removal sets every key ofSTAGE_REMOVAL_KEYSexceptstage.pendingto None,stage.needs_splitandstage.file_captoo. So the next round erases a budget stop of the resumed Job, and the item goes to a Job again while its owner question is open._orphanshas no guard for an item that a running stage Job holds. While the resumed Job runs, a Service round can judge the item as an orphan from the listing that it read first. If the Job records its draft between that read and the writes of the round, the removal erasesstage.branch,stage.prandstage.shaof the plan that the Job just published._resumable_branchesmatches every App-only branch of the issue by its number, but_stage_onepushes to the branch name of the current title. If the title changes between the dead Job and the resume, the item gets a new branch, and nothing deletes the kept branch.A plain design for #6528:
run_stage_roundalready reads the running Jobs forread_stage_round.refactor(roadmap): stage pushes the plan commit on the phases
fix(roadmap): a moved re-stage branch stops the plan push
refactor(roadmap): stage pushes the plan commit on the phases
fix(roadmap): a moved re-stage branch stops the plan push
5 remaining items
devops-cli-service commentedon Nov 25, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 25, 2026
Released in v0.219.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.219.0
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 17:09 UTC