Repository navigation
Description
Problem Description
A person closes a plan pull request with no merge after the implement job worked on it. The implement record of the item stays: implement.job, implement.stopped, implement.failure, implement.branch and implement.pr. No path that sends the item back for a new plan clears these keys:
- The
implement: retryclear removes onlyimplement.stopped,implement.failureandimplement.check(src/devops_cli/roadmap/stop_clear.py:314-329,_marks). devops roadmap returnwrites only the Status (src/devops_cli/roadmap/return_item.py:62-68).- The stage job's rejection clears only the stage keys (
src/devops_cli/roadmap/stage/stage.py:2998-3011,_reject_plan).
Only the implement job's own return clears the run keys (src/devops_cli/roadmap/implement/implement_run.py:860-880, _return_to_new).
The kept keys stop the new plan in three places:
implement.jobstays, sostage_ready(src/devops_cli/roadmap/stage/stage_ready.py:95) and fix-plan (src/devops_cli/roadmap/steps/fix_plan.py:300) leave out the new draft. A new draft withplan/needs-fixwaits for a person.implement.branchandimplement.prstay, andrecorded_branchreads that pair before the stage pair (src/devops_cli/roadmap/implement/implement.py:237-248). While no plan is on the default branch,_routereturns it, and_pull_reasonfinds the closed pull request (implement.py:474-484). The implement job leaves out the new draft.- After
devops roadmap return,implement.stoppedstays. When refine sets the item Ready, the status sweep derives Blocked from the stop (src/devops_cli/roadmap/status_sync.py:191-198facts_of, called bysync_statuses). A stop of classtypesorplan_defecthas no automatic clear rule, so the item waits for animplement: retrybefore the stage job can plan it again.
Reproduction Steps
- Item refactor(ai): rank the benchmark with numpy and pytrec-eval #1928: the implement job stopped on plan PR docs(openspec): plan #1928 Rank the embedding benchmark with numpy #5140 (class
types). On 2026-11-12 a person closed docs(openspec): plan #1928 Rank the embedding benchmark with numpy #5140 with no merge and commentedimplement: retry. The record still holdsimplement.jobdevops-cli-runner-20261112-163430-77e5,implement.branchrefactor/1928-rank-the-benchmark-with-numpy-and andimplement.pr5140. - Item test(warnings): Turn all warnings into errors with reasoned exceptions #1878: the implement job stopped on plan PR docs(openspec): plan #1878 Fail tests on warnings and mark ty advisory #5105 (class
plan_defect, stopgroup 1). A person closed docs(openspec): plan #1878 Fail tests on warnings and mark ty advisory #5105 and randevops roadmap return 1878. The record still holdsimplement.stopped,implement.jobandimplement.pr5105. - Read
stop_clear._marks,return_item.apply_returnandstage._reject_planon main: none of them writes anImplementRecordKeyother than the three of the retry clear.
Expected vs Actual Behavior
Expected: when the stage job records a rejected plan, it clears the implement keys of the run on that plan, as _return_to_new does. The new draft then flows: stage_ready and fix-plan read it, the implement job takes it, and the status sweep does not set Blocked again.
Actual: the new draft of #1928 will be left out by implement (it reads closed #5140), and #1878 will go back to Blocked after refine sets it Ready.
Environment Diagnostics
Main at 0a14161 (release 0.123.0).
Logs, Traces, or Terminal Output
Source: the plan PR backlog triage of 2026-11-12 (rule 11 finding 1), extended with the return and route evidence above.
Source: #5140
Alternatives check of 2026-11-22: none.
Tool: none found.
Reason: Searches for tooling that clears stale per-item job state on a closed, unmerged plan pull request found only unrelated pages (workflow engines, stale-element docs, issue triage guides); no external tool manages this repository's implement record keys.
Lacks:
- Clearing implement.job, implement.stopped, implement.failure, implement.branch and implement.pr on a rejected plan
- Clearing the same run keys from
devops roadmap return - Reading only a live implement Job in stage_ready and fix_plan
- Status sweep not deriving Blocked from a cleared implement stop
Proposed design
Problem statement
A person closes a plan pull request with no merge after the implement job ran. The stage job records the rejection but leaves implement.job, implement.stopped, implement.failure, implement.branch and implement.pr. The stale keys hide the new plan, route the implement job to the closed pull request, and derive Blocked. The fix clears the run keys on the stage rejection and on devops roadmap return. It also makes stage_ready and fix_plan read only a live implement Job.
Acceptance criteria
Requirement: Rejected plan clears implement run keys
The stage job SHALL clear the implement run keys of an item when it records a rejected plan.
Scenario: Rejected plan clears the implement record
- WHEN the stage job records a closed plan pull request as rejected for an item that holds
implement.job,implement.stopped,implement.failure,implement.branchandimplement.pr - THEN the item's job record holds no
implement.job,implement.stopped,implement.failure,implement.branchorimplement.pr
Requirement: Manual return clears implement run keys
devops roadmap return SHALL clear the implement run keys when it returns an item to New.
Scenario: Manual return clears the implement record
- WHEN an item holds
implement.job,implement.stopped,implement.failure,implement.branchandimplement.pr, and a person runsdevops roadmap returnwith an evidence comment - THEN the item's job record holds no
implement.job,implement.stopped,implement.failure,implement.branchorimplement.pr
Requirement: Status sweep does not derive Blocked after rejection
The status sweep SHALL NOT derive Blocked from an implement stop after a rejected-plan clear.
Scenario: Ready after rejected plan
- WHEN the stage job records a rejected plan for an item, and refine sets the item Ready
- THEN
sync_statusesderives Ready from the clearedimplement.stopped
Requirement: Implement job does not route to the closed plan
The implement job SHALL NOT route to the closed plan pull request after the stage job records it as rejected.
Scenario: No branch from the closed plan
- WHEN the stage job records a closed plan pull request as rejected for an item that holds
implement.branchandimplement.pr - THEN
recorded_branchreturns no branch from those cleared keys
Requirement: Stage ready reads only a live implement Job
stage_ready SHALL use job_holds to decide whether a live implement Job holds an item.
Scenario: Finished Job does not hide a new draft
- WHEN an item has
implement.jobset andimplement.job_stateset to a finished value, and a new plan draft exists - THEN
stage_readydoes not skip the new plan draft because of the finished Job
Requirement: Fix-plan reads only a live implement Job
fix_plan SHALL use job_holds to decide whether a live implement Job holds an item.
Scenario: Finished Job does not hide a fix plan
- WHEN an item has
implement.jobset andimplement.job_stateset to a finished value, and a plan draft needs a fix - THEN
fix_plandoes not skip the plan draft because of the finished Job
Existing Tool Considered
No open, maintained tool covers this need. The alternatives check of 2026-11-16 found none. actions/stale and the Temporal cancellation documentation do not manage this repository's implement record keys. The change builds its own code: a small edit to the clear path and two readers, about 5,000 tokens and under one hour to keep and fix.
Key questions
- Which paths that send an item back to New must clear the implement run keys?: The stage job's rejected-plan record and
devops roadmap returnmust clear the run keys. Theimplement: retryclear stays as it is. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/return_item.py, src/devops_cli/roadmap/stop_clear.py]- Rejected: Clear in the stage job only. test(warnings): Turn all warnings into errors with reasoned exceptions #1878 uses
devops roadmap returnand would stay Blocked. - Chosen: Clear in the stage job and
devops roadmap return. Both paths send the item back for a new plan, and both leave the stale keys. - Rejected: Also clear in
implement: retry. A retry continues the implement job and needs its branch and pull request record.
- Rejected: Clear in the stage job only. test(warnings): Turn all warnings into errors with reasoned exceptions #1878 uses
- Which implement record keys does the clear remove?: The clear removes the run keys that
_return_to_newclears:implement.job,implement.stopped,implement.failure,implement.branchandimplement.pr. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/roadmap/implement/implement.py, src/devops_cli/roadmap/stores/store.py]- Rejected: Clear only
implement.stoppedandimplement.failure.implement.branchandimplement.prstill route the implement job to the closed plan. - Chosen: Clear the run keys that
_return_to_newclears. This removes the job, stop, branch and pull request that block the new plan. - Rejected: Clear every implement key. This erases digest, continuation and kept-work records that are not part of the run.
- Rejected: Clear only
- Where should the shared run-key clear live?: In
src/devops_cli/roadmap/implement/record_clear.py, as a small function that returns the run-key marks.implement_run.py,stage.pyandreturn_item.pyimport it. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/return_item.py, src/devops_cli/roadmap/stores/store.py]- Rejected: Duplicate the marks in each caller. The three paths would drift.
- Rejected: Import
_return_to_newfromimplement_run.py. The private run function carries more than the marks and can create an import cycle. - Chosen: Add a small helper module. Each caller imports the same marks with no cycle.
- Should
stage_readyandfix_planreadjob_holdsinstead of the bareimplement.job?: Yes.stage_ready._recorded_pullandfix_plan._record_reasonmust calljob_holds, the live-Job predicate thatfix-checksalready uses. (best practice) [sources: src/devops_cli/roadmap/status_sync.py, src/devops_cli/roadmap/steps/fix_plan.py, src/devops_cli/roadmap/stage/stage_ready.py]- Rejected: Keep the bare
implement.jobread. A finished Job keeps the key and hides a new draft. - Chosen: Read
job_holds. This checks the live Job state and ignores a finished Job.
- Rejected: Keep the bare
- Should the rejected-plan clear use the same Status write as the return to New?: Yes. The clear passes the run-key marks to the one Status write that returns the item to New. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/status_sync.py, src/devops_cli/roadmap/return_item.py]
- Rejected: Write the clear before the Status write. A failed Status write leaves the record and the Status apart.
- Chosen: Pass the marks to the Status write. One write changes the record and the Status together.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Both touch recorded_branch and implement.pr in implement.py, but 4041 prevents premature pickup of staged items while this clears stale records after a rejection.dan-petty commentedon Nov 16, 2026
A note from #5983 (PR #5986): the step
fix-checksnow leaves out an item that a live implement Job holds. It readsjob_holds(src/devops_cli/roadmap/status_sync.py:170:implement.jobset andimplement.job_stateempty), not the bareimplement.job. The bare key stays after the Job ends, so it would stopfix-checkson every implement draft.fix_plan._record_reason(src/devops_cli/roadmap/steps/fix_plan.py:532) andstage_ready._recorded_pull(src/devops_cli/roadmap/stage/stage_ready.py:99) still read the bare key. Point 1 of this issue also goes away if those two readjob_holds, independent of the clear of the record.devops-cli-service commentedon Nov 16, 2026
Alternatives check: none
Reason: The need is a fix inside this project's own roadmap module: clear the stale implement record keys (
implement.job,implement.stopped,implement.failure,implement.branch,implement.pr) when the stage job records a rejected plan, reusing the clearing that_return_to_newalready performs. Searches surfaced only generic stale-issue/PR automation (e.g. actions/stale), workflow cancellation/reset docs and state-machine glossaries; none of these is a library that manages this repository's own implement record keys or the GitHub-label record of ADR 0016, so no external tool covers the need.Tool: none found
Lacks:
Searches run:
Sources:
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Status set to Ready at 1812dd2 (see proposed design in issue body).
devops-cli-service commentedon Nov 25, 2026
Released in v0.218.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.218.2
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 08:43 UTC