Repository navigation
Description
Problem
A refine round plans all its items first and writes after, so a Service stop loses the finished work of the round. A stop now comes often, because each release rolls the Service.
src/devops_cli/roadmap/run.py:544runs the plan and then the writes. A round took at least about 13 minutes.service.drain_timeout_secondsis 120 in the live ConfigMap.- Refine wrote no comment from 2026-11-05T12:18:55Z to at least 14:37Z. Before that, the longest gap in 11 hours was 59 minutes.
- Five rollouts fell in the first part of that gap, 22 to 35 minutes apart, at 12:35Z, 13:01Z, 13:25Z, 14:00Z and 14:22Z, and one more at 14:34Z. Each came 4 to 10 minutes after a release.
- At 13:25Z the log shows the stop of a devops-cli model round. For the other rollouts, the log gives no proof, because no line records the start or the end of a refine round.
The stop is the likely cause, not a proved one. GitHub budget holds fall in the same gap, and the data cannot divide the time between the two. A lost round also spends its model tokens again in the next round, on the same items.
Expected
Refine writes each item when that item is done. A stop ends the round and loses at most the item in progress. The log has one line when a refine round starts and one when it ends, with the counts.
Acceptance criteria
- A test: a round of 3 items that stops after item 2 has written items 1 and 2, and the next round takes item 3 first.
- A test:
plan_refinewithout--confirmstill writes nothing. - A test: a round logs its start and its end with the counts of items taken, written and failed.
- Run live: refine writes during a period of three rollouts in 2 hours.
Existing tool considered
Existing project code. #3560 keeps the work of a stopped implement step in the same way. No new tool.
Related
Proposed design
Problem statement
A refine round plans all its items before it writes any of them. A Service stop in the round loses every finished item, and the next round spends its model tokens on the same items again. Refine must write each item when that item is done.
Acceptance criteria
Requirement: Per-item write in the round
The refine round SHALL write each item's result as soon as that item's refinement finishes, before it takes the next item.
Scenario: Round of three items stops after item two
- WHEN A refine round of 3 items stops after it writes item 2.
- THEN Items 1 and 2 carry their refine result, and the next round takes item 3 first.
Requirement: No write without confirm
The refine round MUST write no item when plan_refine runs without --confirm.
Scenario: Plan run without confirm
- WHEN
plan_refineruns on a round of 3 items without--confirm. - THEN The round writes no comment, label or body change to any of the 3 items.
Requirement: Failed item does not stop the round
The refine round SHALL count an item whose write fails as failed and SHALL continue with the next item.
Scenario: Write of item two fails
- WHEN The write of item 2 fails in a round of 3 items.
- THEN The round writes item 3, counts taken=3, written=2 and failed=1, and leaves item 2 New.
Requirement: Round start and end log
The refine round SHALL log one line at its start and one line at its end, and the end line MUST give the counts of items taken, written and failed.
Scenario: Round with one failed item
- WHEN A refine round takes 3 items, writes 2 and fails 1.
- THEN The log holds one start line with the number of items taken and one end line with taken=3, written=2 and failed=1.
Existing Tool Considered
No alternatives check has run on this issue. The change modifies existing project code, src/devops_cli/roadmap/run.py and src/devops_cli/roadmap/refine.py, and no open tool or library covers the per-item write of a roadmap job. The written cost is about 40k output tokens to build with its tests, about 5k tokens a month to keep, and about 3k tokens for each fix, over about 2 days of elapsed time.
Key questions
- Where does the round write an item's result?: The round writes each item inside its loop, as soon as that item's refinement finishes, before it takes the next item. (best practice) [sources: src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/refine.py]
- Chosen: Write each item inside the round loop after its refinement finishes. A stop loses at most the item in progress, and no second pass writes the items again.
- Rejected: Keep the batch write after all items. A stop loses every finished item of the round, which is the defect.
- Rejected: Write from a background thread while planning continues. It adds concurrency with no gain, and a stop still loses the item in progress.
- How does the next round take the items that a stopped round did not write?: The write sets the item to Ready, so
select_candidatesreturns it no more. The next round starts with the items that remain. (best practice) [sources: src/devops_cli/roadmap/refine.py, src/devops_cli/roadmap/run.py]- Chosen: Use the item's new status so the next round skips it. The status already records the finished work, and no new state can go stale.
- Rejected: Keep a round cursor in a file. It adds state that a crash or a second lane can make stale, against ADR 0001.
- What happens when the write of one item fails?: The round logs the failure, counts the item as failed, leaves the item New and continues with the next item. (best practice) [sources: src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/failure.py]
- Chosen: Log the failure, count it and continue. One bad item does not stop the other items, and the next round takes the item again.
- Rejected: Abort the round at the first failed write. One item that fails stops the rest of the round and loses their work.
- What does a refine round log?: The round writes one start line with the number of items taken and one end line with the counts of items taken, written and failed, through the existing logger. (best practice) [sources: src/devops_cli/roadmap/run.py]
- Chosen: One start line and one end line through the existing logger. The two lines show the start and the end of each round, and the counts show what a stop lost.
- Rejected: One line for each item only. No line records the start or the end of a round, so a lost round stays unseen.
- Does
plan_refinewithout--confirmstill write nothing?: Yes.plan_refinestays a planner that returns the plan, and the round writes only when--confirmis set. (best practice) [sources: src/devops_cli/roadmap/refine.py, src/devops_cli/commands/roadmap.py, tests/roadmap/test_roadmap_refine.py]- Chosen: Keep the write behind
--confirm. A plan run stays read-only, and its tests keep the same contract. - Rejected: Write on every plan run and drop
--confirm. A plan run would change issues with no person's request.
- Chosen: Keep the write behind
- Which existing tool or library covers this need?: No alternatives check has run. The need is a change to existing project code, and no open tool or library covers it. [sources: src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/refine.py]
- How is the live run check done?: The live run waits on three rollouts of the Service in 2 hours, which is outside this item. It moves to a new issue and does not hold this item. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/run.py]
- Chosen: Defer the live run to a new issue. The code and its tests can be delivered now, and the live check needs a release period.
- Rejected: Hold this item until the live run happens. It keeps a testable fix in New for a release period that no code change starts.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 5, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.Recurring data loss and wasted model tokens on every release rollout, but the system recovers by retrying.Prevents loss of completed work and avoids re-spending model tokens on already-finished items.Requires changing the write pattern from batch to incremental, adding start/end log lines, and three new tests.Both change refine round behaviour in run.py, but #3483 fixes wait re-evaluation while the candidate changes the write order to per-item.devops-cli-service commentedon Nov 6, 2026
Status set to Ready at 27c7019 (see proposed design in issue body).
Moved to new items: #3793.
devops-cli-service commentedon Nov 7, 2026
Released in v0.77.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.77.2
devops-cli-service commentedon Nov 7, 2026
Live since 2026-11-07 06:18 UTC
fix(roadmap): write each stage and alternatives item when done (#4080)
docs(openspec): plan #3703 Share one tracker rule with refine (#5901)