You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs(openspec): plan #5562 Retry a stage attempt on a provider timeout - #5592
This change makes a stage Job retry an attempt whose failure class has the action retry. A provider timeout, a clone failure, a timeout of the plan and a moved head exit 75, the one code that backoffLimit 2 and the pod failure policy of the stage Job retry. The pod writes the result line of the attempt with its class and infra=true, and leaves the check-out and the claim, so the next pod plans the same item. A class that a retry cannot help, such as plan_defect, keeps exit 1, and the deadline end keeps 143. No manifest changes: the policy already retries only exit 75, and a case of the k8s row of devops ci pins that rule. The gateway fallback for deepseek-v4.1-flash-1017 is a separate item.
An agent vetted this plan before a merge (shepherd, 2026-11-14). Verdict: needs fix. Each point below blocks a correct build.
The retried pod plans nothing for the main case of the issue, a provider timeout. During plan_stage, StageWriter.settle -> _recording -> _record_failures (src/devops_cli/roadmap/stage/stage.py:3560, :3732) already writes stage.failed_at and stage.failed_class=provider on the item before run_stage_job sees the result. The stage Job selects with named=False (stage_job.py calls plan_stage(named=False); stage.py:588-591 adds _failed_lately), and RETRY_AFTER[provider] is 1 hour (failure.py). Thus the next pod leaves the item out in its failure wait. Proof by scratch test in a detached worktree (since removed): pod 1 with AIClientError(status=504) gives exit 1, stage.failed_at=NOW, stage.failed_class=provider. The record then got the state that the plan wants (stage.job kept, no stage.job_result). Pod 2 at NOW+30 s gave exit 0, result 'skipped', 0 model calls, no stage.pr, and it checked in, which cleared the check-out. The existing test test_a_failed_plan_exits_1_and_checks_in_with_the_failure already asserts that stage.failed_at is present after a failed plan. The design is wrong when it says that only a check-in writes FAILED_AT (design.md 'Write no check-in...'). Fix the plan: for an attempt that exits 75, clear the failure marks in stage_job.py, or skip them in the writer, or make _failed_lately pass when the check-out names the Job of the pod. Name the changed path (probably src/devops_cli/roadmap/stage/stage.py). Add a test that runs a second run_stage_job after the 504 and asserts that it plans and stages the item. Test 1.1 asserts only the check-out marks, so it passes while the retry does nothing. ci_infra from a failed write (applied.failed) has the same defect. head_moved (wait 0) and a clone failure that is raised (no marks written) work.
Paths that the change must touch and that the plan does not name: src/devops_cli/roadmap/stage/stage.py (_record_failures/StageWriter._recording or _failed_lately: the retry must not leave the item in its failure wait), docs/roadmap/stage.md (line 175 exit-code rule), src/devops_cli/lang/en/help.py (stage_job_item help, lines 1805-1808), docs/commands/roadmap.md (generated from help, line 133), k8s/devops/cronjob-stage.yaml (comment lines 32-36 only), k8s/devops/roadmap-service/admissionpolicy.yaml (comment lines 13 and 180 only), tests/gate/k8s_checks/stage_job.py (docstring line 80; existing check that group 2 repeats), src/devops_cli/roadmap/stage/stage_submit.py (recovery after backoff limit writes a second result line)
Points that do not block:
Group 2 repeats checks that exist. tests/gate/k8s_checks/stage_job.py:79 check_the_stage_job_runs_again_only_after_an_eviction_and_ends_by_its_deadline already pins backoffLimit 2 and the exact podFailurePolicy (Ignore DisruptionTarget, FailJob NotIn [75] for container stage). job_admission_policy.py:547 check_the_stage_job_from_the_template_passes_in_every_image_form already asserts no refusal for the template stage Job. The rule-break cases at :594-596 also exist. Better: update the docstring at stage_job.py:80 ('Exit 75 is the evicted exit... Any other exit fails the Job, so the Service decides each later attempt'), which the change makes wrong, and drop task 2.1. The verify command 'uv run devops ci --check --only k8s' is a real command form.
The plan does not name texts that the change makes wrong (AGENTS rule 8): docs/roadmap/stage.md:175 ('1 for a failure of the item, 75 for a SIGTERM before the time budget ends'); src/devops_cli/lang/en/help.py:1805-1808 (stage_job_item: '1 failure, 75 evicted') and the generated docs/commands/roadmap.md:133; the comment in k8s/devops/cronjob-stage.yaml:32-36 ('Any other exit ends the Job, and the Service decides each later attempt'); the comments in k8s/devops/roadmap-service/admissionpolicy.yaml:13 and :180 ('only after exit 75, the evicted exit'); the 'The result line' and 'Ends that fail' paragraphs of the stage_job.py module docstring (task 1.2 updates only the Ends list).
The plan does not state the end of a Job whose three pods all exit 75. The Job fails with its backoff limit, and stage_submit.py _recover/_end_of (FAILED) checks in with classify_failure of the log tail and writes one more result line. The last attempt then counts twice in the job grades, which goes against the rule 'each attempt counts once' (fix(roadmap): eval grades counts the result lines of Job pods #5556). Name the rule, for example: the recovery writes no line when the pod already wrote one.
proposal.md says 'Write the result line of that attempt with its class and infra=true'. For head_moved and timeout, the line computes infra=false (INFRA_CLASSES in job_result.py:125 holds provider, ci_infra, oom and limit_reached). design.md and the spec say this correctly. Correct the proposal sentence.
Prose is close to ASD-STE100, but many Feasibility bullets in proposal.md are long sentences (more than 25 words) with chained clauses. This is not a block.
An agent vetted this plan before a merge (2026-11-14). Verdict: ready.
Updated plan to handle _failed_lately in src/devops_cli/roadmap/stage/stage.py so attempts retried under the same Job checkout are not skipped by the 1-hour failure wait.
Added test in tests/roadmap/stage/test_roadmap_stage_job_entry.py verifying that a retried attempt after an HTTP 504 successfully plans and stages the item.
Updated src/devops_cli/roadmap/stage/stage_submit.py to prevent duplicate result lines when recovering a Job whose pods already logged results.
Aligned ## Criteria exactly with the issue acceptance criteria.
Updated documentation and comments across docs/CLUSTER.md, docs/roadmap/stage.md, src/devops_cli/lang/en/help.py, docs/commands/roadmap.md, k8s/devops/cronjob-stage.yaml, k8s/devops/roadmap-service/admissionpolicy.yaml, and tests/gate/k8s_checks/stage_job.py.
Rebased on origin/main and verified with devops roadmap plan-check 5592 (all checks passed).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope/openspecOpenSpec changes, specs and their checkstype/docsType docs: a change to the documentsverdict/fix-planVerdict Needs fix of a plan: an open finding keeps the plan in draft until a fix
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plans #5562
This change makes a stage Job retry an attempt whose failure class has the action retry. A provider timeout, a clone failure, a timeout of the plan and a moved head exit 75, the one code that backoffLimit 2 and the pod failure policy of the stage Job retry. The pod writes the result line of the attempt with its class and infra=true, and leaves the check-out and the claim, so the next pod plans the same item. A class that a retry cannot help, such as plan_defect, keeps exit 1, and the deadline end keeps 143. No manifest changes: the policy already retries only exit 75, and a case of the k8s row of devops ci pins that rule. The gateway fallback for deepseek-v4.1-flash-1017 is a separate item.
Change:
openspec/changes/5562-a-stage-job-retries-a-provider/