Repository navigation
Description
Problem Description
The stage job takes the same refused items again and again, with no limit. A plan that the deterministic gates refuse two times ends the item with RoadmapStageError: The change fails its checks, also after a second try. The item then gets the failure class plan_defect. The stage job holds the item for 6 hours only, and then takes it again. Nothing counts the attempts, and nothing returns the item to New.
The cause in the code (origin/main 0ac2f76):
RETRY_AFTERinsrc/devops_cli/roadmap/failure.py:161setsFailureClass.PLAN_DEFECTtotimedelta(hours=6)._Judge._failed_latelyinsrc/devops_cli/roadmap/stage/stage.py:614reads onlystage.failed_atandstage.failed_class. It holds the item untilfailed_at + retry_after.StageRecordKeyinsrc/devops_cli/roadmap/stores/store.py:217has no failure count.- The stage job returns a refused reply to the model one time only (
CONST_ROADMAP_STAGE_GATE_RETURNS = 1,src/devops_cli/config/constants.py:3293, used nearsrc/devops_cli/roadmap/stage/stage.py:1183). priority_orderputs the same high-priority items first, so each 3-item round takes them again after 6 to 11 hours.- The row breaker in
src/devops_cli/roadmap/run.pycounts only failed rounds in a row, and new input runs the row at once. After 06:20Z on 2026-11-10, staged rounds came between the failed rounds, so the breaker did not trip again.
The loop holds the one model lane. Stage error rows took 71,951 s (about 20 h) of the lane in 48 hours, about 56% of its busy time. The refine, intake and alternatives rows wait behind it. 157 Ready items wait in devops-cli.
Some refusals are gate false positives, and other issues cover them: #4463 (trace gate citation forms) and #4467 (module-test and caller gates). This issue covers only the missing limit on attempts.
Reproduction Steps
- Query Loki from 2026-11-08T23:45Z to 2026-11-10T23:45Z:
{namespace="devops", app_kubernetes_io_name="roadmap-service"} |= "Service job execution failed" |= "the stage job failed for". - Parse the
RoadmapStageErrortext of each item in each failed round. - Count the failures of each item and the time between them.
- Read
RETRY_AFTERinsrc/devops_cli/roadmap/failure.pyand_failed_latelyinsrc/devops_cli/roadmap/stage/stage.py. No code counts the attempts.
Expected vs Actual Behavior
Expected: after a set number of plan_defect failures (for example 3), the stage job stops taking the item. It returns the item to New with the refused gate sentences as evidence, as AGENTS.md rule 2 says (devops roadmap return). The other Ready items then get the lane. The count resets when the item body changes or when a person sets it Ready again.
Actual: the stage job takes the same items every 6 to 11 hours with no limit.
- 47 fully failed stage rounds in 48 hours (38 on 2026-11-09, 9 on 2026-11-10), with 141 item failures: 81
RoadmapStageErroron 44 items, 58StructuredOutputValidationError, 2AIClientError. - 59 items failed at least once, and 27 failed more than 2 times.
- feat(roadmap): Name the test module for a changed function #3389, fix(pr): Require a replay score in stage-change PRs #3398 and fix(roadmap): Check a class claim against the staged source #3407 failed 6 times each. feat(roadmap): Verify a claimed missing check in helpers and base #3416, fix(roadmap): halt implement step on consecutive command refusals #4043 and feat(roadmap): the stage plan states constant claims in a structured field #3388 failed 5 times each. fix(pr): Require a replay score in stage-change PRs #3398 failed at 00:21, 06:49, 13:22 and 20:30 on 2026-11-09, and at 07:43 and 18:33 on 2026-11-10.
- 6 plan pull requests were staged in the window (docs(openspec): plan #3647 Read CNPG Clusters in the placement test #4268, docs(openspec): plan #3414 Refuse a behavior group that omits its test #4351, docs(openspec): plan #3443 Name the test case that a change invalidates #4352, docs(openspec): plan #4004 Add the planner run-command allow-list builder #4357, docs(openspec): plan #3429 Validate the implement plan with OpenSpec #4419, docs(openspec): plan #3462 Accept a test helper group in the plan check #4435), so about 4% of the attempts staged a plan.
- 95 "stage reply refused" lines. 72 of them have
limit=noneandfinish_reason=tool_call, so the run limits do not cut the runs. The gates refuse finished plans. - The breaker logged "failed 3 rounds in a row" 14 times, the last at 05:23Z on 2026-11-10. Each time, new input ran the row again at once.
Still occurring: failed rounds at 18:33, 20:24 and 21:11Z on 2026-11-10, and the last refused reply at 23:18Z.
Items in the loop: #3076, #3387, #3388, #3389, #3398, #3407, #3416, #3423, #3447, #3453, #3532, #3576, #3577, #3592, #3599, #3612, #3634, #3637, #3642, #4028, #4043.
Environment Diagnostics
- DevOps CLI Version: 0.110.0 (the live roadmap-service pod)
- Python Version: 3.14
- OS & Architecture: Linux x86_64
- Execution Environment: Roadmap Service (the stage row in the cluster)
Logs, Traces, or Terminal Output
# Loki, 2026-11-08T23:45Z to 2026-11-10T23:45Z
{namespace="devops", app_kubernetes_io_name="roadmap-service"} |= "Service job execution failed" |= "the stage job failed for"
# 47 rounds, 141 item failures, 81 RoadmapStageError on 44 items
# Prometheus, lane time of the stage row
devops_cli_roadmap_row_seconds{row="stage", repo="dan-petty/devops-cli"}
# error rows: 47 rows, 71,951 s, mean 1,531 s; success rows: 17,582 s
sum by (lane) (devops_cli_service_job_seconds_total)
# model lane busy 127,932 s, 74% of 48 h, 99.3% of the last 6 h
RoadmapStageError: The change fails its checks, also after a second try: Group 1 changes `src/devops_cli/lang/en/messages.py` and names no existing test of that module. ...Related: #4204 (closed: refused-reply logs, no cap), #4411 (model study), #3398 (replay score before a gate merges; it is itself in the loop), #4463, #4467.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Proposed design
Problem statement
The stage job retries an item after each deterministic gate refusal with no limit. This holds the model lane and delays refine, intake and alternatives. The change adds a cap of 3 plan_defect failures per item and returns the item to New with the refused gate sentences. The count resets on a body edit or a later Ready set by a person.
Acceptance criteria
Requirement: Plan defect count
The stage job SHALL record each plan_defect failure of an item in the item's job record.
Scenario: Third plan defect is recorded
- WHEN The stage job records a third
plan_defectfailure for one item. - THEN The item's job record holds the
plan_defectcount 3 and the body hash of the failed body.
Requirement: Cap at three
The stage job MUST stop selecting an item after 3 plan_defect failures on the same body.
Scenario: Fourth attempt is refused
- WHEN An item has 3
plan_defectfailures on its current body and the stage job selects it again. - THEN The stage job selects no fourth attempt and returns the item to
New.
Requirement: Return to New with evidence
The stage job SHALL return a capped item to New with the refused gate sentences as the comment evidence.
Scenario: Capped item returns with gate text
- WHEN The stage job returns an item after the
plan_defectcap. - THEN The status write sets
Newand the comment holds each refused gate sentence from the item's refused reply record.
Requirement: Body edit reset
The stage job MUST treat a plan_defect count as zero when the item body hash differs from the recorded hash.
Scenario: Edited body starts a new count
- WHEN An item has a recorded
plan_defectcount for one body hash and its body hash changes. - THEN The stage job selects the item and the next
plan_defectfailure records a count of 1.
Requirement: Ready reset
The stage job MUST clear the plan_defect count when it returns the item to New, so a later person setting it Ready starts at zero.
Scenario: Ready after a return
- WHEN The stage job returned an item to
Newafter the cap and a person sets itReadyagain. - THEN The item has no
plan_defectcount and the stage job selects it.
Requirement: Other failure classes
The stage job MUST keep the RETRY_AFTER wait for a failure class other than plan_defect and MUST not count it toward the cap.
Scenario: Provider failure does not count
- WHEN The stage job records a
providerfailure for an item with aplan_defectcount of 2. - THEN The
plan_defectcount stays 2 and the item waits for theproviderretry time.
Requirement: Successful stage reset
The stage job SHALL clear the plan_defect count when it stages the item.
Scenario: Staged item clears count
- WHEN The stage job stages an item that holds a
plan_defectcount. - THEN The item's job record holds no
plan_defectcount.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library covers an item-level retry cap inside this roadmap stage job. The change builds on the existing job record, return path and refused-reply record. Written cost: 30k tokens to build, 10k tokens to keep and fix each year, and 1 day elapsed.
Key questions
- Which failures count toward the cap?: Only
plan_defectfailures count toward the cap. Aprovider,parser,ci_infraorhead_movedfailure keeps its existing wait and does not increase the count. (best practice) [sources: src/devops_cli/roadmap/failure.py:161, docs/roadmap/stage.md:83]- Chosen: Count only plan_defect. This matches the issue scope: gate refusals loop, and fix(roadmap): the trace gate refuses valid citation forms #4463 and fix(roadmap): the module-test and caller gates refuse correct plans #4467 cover false positives.
- Rejected: Count every failure class. A provider outage or parser error is not a refused plan and already has a retry wait.
- Rejected: Count no failure class. This leaves the loop in place.
- Where does the stage job store the count?: The stage job stores the count in the item's job record under a new
StageRecordKeymember. It stores the body hash in a second member next tostage.failed_atandstage.failed_class. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:217, src/devops_cli/roadmap/stage/stage.py:614, src/devops_cli/roadmap/body_hash.py]- Chosen: Job record key. It survives a Service restart, is per item, and matches the existing stage failure fields.
- Rejected: In-memory ledger. A restart loses the count and the loop returns.
- Rejected: Separate per-item file. It adds a store and a cleanup path for one integer.
- What is the cap?: The cap is 3
plan_defectfailures on the same body. A fixed constant holds the cap, asCONST_ROADMAP_STAGE_GATE_RETURNSholds the gate return limit. (best practice) [sources: src/devops_cli/config/constants.py:3293, docs/roadmap/stage.md:83]- Chosen: Cap at 3. It is small enough to stop the lane loop and large enough to allow a transient gate miss.
- Rejected: Cap at 1. One refusal may be a false positive that fix(roadmap): the trace gate refuses valid citation forms #4463 or fix(roadmap): the module-test and caller gates refuse correct plans #4467 fixes.
- Rejected: Cap at 6. The observed loop reaches 5 or 6 failures and holds the lane for days.
- How does the stage job return the item to New?: The stage job uses the existing roadmap return path that
devops roadmap returnuses. It writes the statusNewand the evidence comment in one item write. It adds no new command. (best practice) [sources: AGENTS.md, .agents/skills/devops-roadmap/SKILL.md:13, src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/stores/store.py]- Chosen: Reuse roadmap return. AGENTS.md rule 2 names
devops roadmap return, and one write path avoids a partial status. - Rejected: Add a stage-specific return command. It duplicates the existing return behavior and its tests.
- Rejected: Only stop selecting the item. The item stays Ready and no other job can act on it.
- Chosen: Reuse roadmap return. AGENTS.md rule 2 names
- What evidence goes into the return comment?: The return comment holds the gate sentences from the existing refused reply record at
roadmap/stage/<owner>/<repo>/<n>.refused.json. The job masks and bounds each sentence. (best practice) [sources: k8s/README.md:698, src/devops_cli/roadmap/stage/stage.py, src/devops_cli/lang/en/messages.py]- Chosen: Use the refused reply record. The record already holds the refused replies and their problems until the item is staged.
- Rejected: Re-run the gates to collect evidence. A re-run costs a model call and may give different text.
- Rejected: Comment only the failure count. AGENTS.md rule 2 asks for the evidence that the premise fails.
- When does the count reset?: The count clears when the body hash differs, when the stage job returns the item to
New, and when a stage run stages the item. A person who setsReadyafter that return starts at zero. (best practice) [sources: src/devops_cli/roadmap/body_hash.py, src/devops_cli/roadmap/stage/stage.py:614, docs/roadmap/stage.md:83]- Chosen: Body hash plus return and success clear. It covers the two reset cases in the issue without a new timeline read.
- Rejected: Body hash only. A person setting Ready again would still hit the old count.
- Rejected: Time window only. A slow loop would still hold the lane.
- Does this change the row breaker or the gate false positives?: No. This item adds the per-item cap only. The row breaker stays as it is, and fix(roadmap): the trace gate refuses valid citation forms #4463 and fix(roadmap): the module-test and caller gates refuse correct plans #4467 cover the gate false positives. (best practice) [sources: src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/failure.py:161]
- Chosen: Per-item cap only. The issue states this scope, and the cap stops the loop without a breaker change.
- Rejected: Also change the row breaker. The breaker counts failed rounds, not item attempts, and the issue leaves it out.
- Rejected: Also fix gate false positives. Other issues own the trace and module-test gates.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 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.The loop consumes 56% of the model lane and blocks 157 Ready items for over 48 hours.Unblocking the lane lets 157 waiting items progress through refine, intake and alternatives.Requires adding a failure count to StageRecordKey, checking it in _failed_lately, and returning the item to New; spans three files but the logic is bounded.Both touch the stage retry mechanism in failure.py and stage.py, but #4060 sets the wait time per failure class while this candidate adds a count limit that stops retries entirely.devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 2f6114f (see proposed design in issue body).
devops-cli-service commentedon Nov 11, 2026
Released in v0.112.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.112.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 14:13 UTC