Repository navigation
Description
Problem
A review after the merge of PR #6009 (#5027, the fix-checks Jobs) found these defects. Write safety holds (bot pull requests only, lease on the judged head, no push to main), but the Job queue can waste or block the model places that implement and stage share (roadmap.model_jobs).
- The retry cap resets each day.
fix_checks_row.py(about lines 284-285) reads the attempt count and the backoff only from Job objects, andcronjob-runner.yamldeletes ended Jobs after 24 hours (ttlSecondsAfterFinished: 86400). Then_next_attempt([])gives attempt 1 again: a pull request that still fails on the same head and check starts a full chain each day (up to 5 Jobs of about 3.5 hours for outcomenone; a knownerrorruns again). - Two fix Jobs can work one head at once. The unit key holds the check (
steps/watch.py, about line 190;watch_row.py, about line 354), and FAILED comes while other checks still run: lint fails first and starts Job (head, lint); a test shard fails 30 minutes later and starts Job (head, shard). The lease stops the second push, but both model places can be in use for up to 3.5 hours. - A waiting (suspended) fix Job can hold a place for all time.
model_slots(job_launcher.py, about line 157) counts each suspended fix Job in the cluster, but only the watch row of its own repository resumes it, and a suspended Job has no deadline and no TTL. If a repository leavesservice.reposor its watch row keeps failing, two such Jobs stop all implement and stage work in every repository. - The watch row fails on each Kubernetes error.
watch_row.py(about line 659) calls the fix-checks round with no guard and lists Jobs each round, so aClusterJobErrororConfigurationErrorfails the whole row and counts toward the suspension of the row. - A Job that its deadline killed is tried again as outcome
none, so a step that is always slow runs up to 4 more times. - The docstring of
fix_checks_row.py(about lines 36-37) says that the Service writes nothing to GitHub, but in modeon_ready_after_fix(watch_row.py, about line 397) runs the step in the Service pod: it can mark a pull request ready or post a comment, and when a check fails between the two reads it raisesRoadmapImplementErrorbecause no repair is given. - The new dashboard panel (
sum by (result)) can show about 13 series; the dashboard rule allows 3 series and Other.
Expected behavior
- The attempt count, the outcome and the next allowed time of each unit live in the item record (
FixChecksRecordKey, keyed by the unit), so a Job TTL does not reset them. - One fix unit for each pull request head (
<pr>:<head>), or no new unit while a fix Job of the same pull request runs or waits. - A waiting fix Job counts against the places only while its repository is in
service.repos, and a waiting Job older than a limit is deleted with a log line. - The fix-checks round of the watch row catches a Kubernetes error, logs it and counts it, and the rest of the row goes on.
- A Job that ended with
DeadlineExceededis not tried again; it counts as its own outcome. - The docstring says what the Service writes, and
_ready_after_fixhandles a check that fails between the reads. - The panel shows at most 3 results and Other.
- A test for each item fails on the base.
Related
- feat(roadmap): the watch row starts fix-checks Jobs #5027, feat(roadmap): The watch row starts fix-checks Jobs #6009, fix(roadmap): Guard fix-checks against a live Job and a repeated failure #5983, chore(k8s): Let six model Jobs run at once in the cluster #6017 (model_jobs 6), feat(roadmap): track the Service step jobs #5014.
Proposed design
Problem statement
A review after the merge of PR #6009 found defects in the fix-checks Jobs of the roadmap. The Job queue can waste or block the model places that implement and stage share: a daily Job TTL resets the retry cap, two Jobs can work one head, a suspended Job can hold a place for all time, a cluster error fails the whole watch row, and a Job that its deadline killed is tried again. The docstring of the row is wrong, _ready_after_fix raises on a check that fails between its reads, and the dashboard panel shows about 13 series where the chart rule allows 3 and Other.
Acceptance criteria
Requirement: Attempt state persists in the item record
The fix-checks round SHALL read and write the attempt count, the outcome and the next allowed time of each fix unit in the item record under FixChecksRecordKey, keyed by the unit key.
Scenario: A Job TTL does not reset the retry cap
- WHEN the ended Jobs of a unit are deleted after their TTL, and the round judges the unit again
- THEN the round takes the stored attempt count, the stored outcome and the stored next allowed time, and starts no Job before that time
Requirement: One fix unit for each pull request head
The unit key of a fix unit MUST be <pr>:<head>, so a second failing check on one head starts no second Job.
Scenario: Two checks fail on one head
- WHEN lint fails and a test shard fails later on the same pull request head
- THEN the round starts one fix Job for the head and writes one unit
Requirement: A waiting fix Job counts only while its repository is managed
A suspended fix Job SHALL count against the model places only while its repository is in service.repos, and the Service MUST delete a waiting Job older than the limit and write one log line.
Scenario: A waiting Job is older than the limit
- WHEN a suspended fix Job is older than the limit, or its repository left
service.repos - THEN the Service deletes the Job, writes one log line, and the Job no longer counts against the model places
Requirement: The watch row survives a Kubernetes error in the fix-checks round
The fix-checks round of the watch row MUST catch ClusterJobError and ConfigurationError, log the error, count it, and let the rest of the row continue.
Scenario: The Job list raises ClusterJobError
- WHEN the fix-checks round lists the Jobs and the cluster raises
ClusterJobError - THEN the row logs the error, counts it, and the other work of the row still runs
Requirement: A Job that its deadline killed is not tried again
The fix-checks round SHALL record DeadlineExceeded as its own outcome and MUST NOT start another Job for that unit.
Scenario: A fix Job ends with DeadlineExceeded
- WHEN the fix Job of a unit ends with the reason
DeadlineExceeded - THEN the round stores the outcome
deadline_exceededand starts no further Job for the unit
Requirement: The docstring and the ready step state what the Service writes
The docstring of fix_checks_row.py SHALL name each GitHub write that the Service makes in mode on, and _ready_after_fix MUST handle a check that fails between its two reads.
Scenario: A check fails between the two reads of the ready step
- WHEN
_ready_after_fixreads the checks, and a check fails before the second read - THEN
_ready_after_fixhandles the failure and raises noRoadmapImplementError
Requirement: The fix-checks panel shows at most three results and Other
The fix-checks dashboard panel in k8s/devops/dashboards/roadmap-service-telemetry.json MUST show at most 3 results and Other.
Scenario: More than three results exist
- WHEN the panel query finds more than three distinct results
- THEN the panel shows the three largest results and one Other series
Requirement: A regression test for each defect
The change MUST add one test for each defect of this issue that fails on the base revision and passes with the change.
Scenario: The new tests run on the base revision
- WHEN the new tests run against the base revision
- THEN each new test fails
Existing Tool Considered
No alternatives check has run (alternatives is null). The need is a fix inside devops-cli's own fix-checks Job queue: the attempt state, the unit key, the reaping of a suspended Job, the error handling of the watch row, the deadline outcome and the row docstring are roadmap-specific, and no open, maintained tool or library covers them (a web search for an open Kubernetes job-queue controller returned no covering project). The change edits existing modules (fix_checks_row.py, watch_row.py, job_launcher.py, steps/fix_checks.py, stores/store.py) and the dashboard JSON, and adds one test for each defect. Written cost: about 40,000 tokens to build, keep and fix the change, and about one working day of elapsed time.
Key questions
- Where do the attempt count, the outcome and the next allowed time of a fix unit live?: In the item record, under
FixChecksRecordKey, keyed by the unit key<pr>:<head>. The record outlives the Job, so a Job TTL resets nothing. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:347, src/devops_cli/roadmap/steps/fix_checks.py:350, src/devops_cli/roadmap/steps/fix_checks.py:411]- Chosen: The item record (
FixChecksRecordKey). The store already holdsFixChecksRecordKey, andfix_checks.pyalready reads it, so the state outlives the Job TTL. - Rejected: Kubernetes Job annotations.
cronjob-runner.yamldeletes ended Jobs after 24 hours, so the state dies with the Job. - Rejected: A Valkey key. A Valkey entry has a TTL and is derived state. The item record is the durable copy of a unit.
- Chosen: The item record (
- What is the unit key of a fix unit?:
<pr>:<head>. One unit covers one pull request head, so two failing checks start one Job. (best practice) [sources: src/devops_cli/roadmap/watch_row.py:354, src/devops_cli/roadmap/steps/fix_checks.py:351]- Chosen:
<pr>:<head>. One head gets one unit, so a second failing check starts no second Job and spends no second model place. - Rejected:
<head>:<check>. The current form. FAILED arrives while other checks run, so a second check starts a second Job for the same head. - Rejected:
<pr>alone. A new head after a push needs its own unit. One key for the pull request would block the new head.
- Chosen:
- What limit ends a waiting fix Job, and where does the setting live?: A new setting
roadmap.fix_checks.suspended_max_seconds, default 14400. The Service deletes a suspended Job older than the limit and writes one log line. (best practice) [sources: docs/CLUSTER.md:73, src/devops_cli/roadmap/job_launcher.py:157]- Chosen: A new bounded setting
roadmap.fix_checks.suspended_max_seconds. A suspended Job has no deadline and no TTL, so the Service needs its own bounded wait. The settings parser validates it. - Rejected: Reuse
roadmap.implement.deadline_ceiling_seconds. That setting bounds an implement Job, not a waiting fix Job. One setting would then hold two meanings. - Rejected: Rely on the Job TTL. A suspended Job has no TTL, so it holds a model place for all time.
- Chosen: A new bounded setting
- How does the fix-checks round of the watch row handle a Kubernetes error?: It catches
ClusterJobErrorandConfigurationError, logs the error, counts it, and lets the rest of the row continue. (best practice) [sources: src/devops_cli/roadmap/watch_row.py:659, docs/ERRORS.md:43, docs/ERRORS.md:47]- Chosen: Catch, log, count and continue. The row fails on each cluster error now, and each failure counts toward the suspension of the row.
- Rejected: Let the round raise. One cluster error then fails the whole row and stops its other work.
- Rejected: Retry the round inside the row. The sweep runs the row again on its interval. An inner retry holds the lane.
- What outcome does a Job that ended with
DeadlineExceededget, and is it tried again?: Its own outcomedeadline_exceeded. The round starts no further Job for the unit. (best practice) [sources: src/devops_cli/k8s/cluster_job_api.py, src/devops_cli/roadmap/fix_checks_row.py:291]- Chosen: Its own outcome, no retry. A step that is always slow would run up to 4 more times as outcome
none. - Rejected: Outcome
nonewith a retry. The current behavior. It spends up to 4 more model places on a step that cannot finish. - Rejected: Outcome
error. It is not a provider or code error, and it would get the wait of the wrong class.
- Chosen: Its own outcome, no retry. A step that is always slow would run up to 4 more times as outcome
- What does
_ready_after_fixdo when a check fails between its two reads?: It treats the pull request as not ready, logs the failed check and returns without raisingRoadmapImplementError. (best practice) [sources: src/devops_cli/roadmap/watch_row.py:397, src/devops_cli/roadmap/steps/ready.py, src/devops_cli/exceptions/roadmap.py:61]- Chosen: Re-read the checks and skip the ready step. The fix place is already spent. A raised error fails the row and gives no repair.
- Rejected: Pass the failure as a repair to the fix round. It spends a second model place on one check.
- Rejected: Raise
RoadmapImplementError. The current behavior. It fails the watch row on a check that failed between the reads.
- What does the docstring of
fix_checks_row.pysay about the GitHub writes of the Service?: It must name each write that the Service makes in modeon:_ready_after_fixruns the ready step in the Service pod, so the Service can mark a pull request ready and post a comment. The current docstring atfix_checks_row.py:36-37says that the Service writes nothing to GitHub, and that claim is false. (best practice) [sources: src/devops_cli/roadmap/fix_checks_row.py:36, src/devops_cli/roadmap/watch_row.py:397, src/devops_cli/roadmap/steps/ready.py]- Chosen: Name each write of mode
on._ready_after_fixruns the ready step in the Service pod, so the Service writes to GitHub. - Rejected: Keep the current docstring. It says the Service writes nothing to GitHub, and a reader takes that as a safety claim.
- Chosen: Name each write of mode
- Where does the dashboard rule that allows 3 series and Other live, and what is its text?: The rule is C7 of
docs/DESIGN.md: 'At most 3 colored series (chart.max-series), in the ordercat.1tocat.3, plus "Other" incolor.data.neutral. Color follows the entity.' The tokenchart.max-seriesis 3 insrc/devops_cli/design/tokens-base.json(and--chart-max-series: 3insrc/devops_cli/design/tokens-base.css). The offending panel is 'Service Fix-Checks Jobs by Result' ink8s/devops/dashboards/roadmap-service-telemetry.json, whose querysum by (result) (increase(devops_cli_service_fix_checks_jobs_total{job=~"$job",repo=~"$repo"}[1h]))returns one series for eachresultvalue. [sources: docs/DESIGN.md:110, docs/DESIGN.md:225, src/devops_cli/design/tokens-base.json:49, k8s/devops/dashboards/roadmap-service-telemetry.json:862] - How does the fix-checks panel query keep at most 3 results and Other?: Keep
sum by (result)and bound it in the query: take the three largest results withtopk(3, ...)and add oneOtherseries as the total minus those three, so the panel has at most 4 series, per C7 ofdocs/DESIGN.md. (best practice) [sources: docs/DESIGN.md:225, src/devops_cli/design/tokens-base.json:49, k8s/devops/dashboards/roadmap-service-telemetry.json:862]- Chosen:
topk(3, ...)plus a computedOtherseries. C7 allows 3 colored series plus Other; the query itself bounds the series count and the test attests/grafana/test_grafana_dashboards.py:999reads the panel query. - Rejected: A Grafana transform on the current query. The panel has no transform today, and the rule is stated on the query, which the dashboard test reads.
- Rejected: Keep
sum by (result)and let the legend list every result. That is the current defect: about 13 series againstchart.max-series= 3.
- Chosen:
- Do the cited lines hold the code that the issue names?: Yes.
fix_checks_row.py:284-285returns attempt 1 when no Job exists (_next_attempt([])),watch_row.py:353-354builds the fix unit from the check of the head,watch_row.py:659callsrun_fix_checks_roundwith no guard,job_launcher.py:157-168counts each suspended fix Job in the cluster, and the docstring atfix_checks_row.py:36-37says that the Service writes nothing to GitHub. [sources: src/devops_cli/roadmap/fix_checks_row.py:284, src/devops_cli/roadmap/watch_row.py:353, src/devops_cli/roadmap/watch_row.py:659, src/devops_cli/roadmap/job_launcher.py:157, src/devops_cli/roadmap/fix_checks_row.py:36]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 16, 2026
The retry cap resets daily and suspended Jobs can block all implement and stage work, causing active resource waste and potential total blockage.Both guard fix-checks Jobs against concurrent or repeated work, but #5983 covers two specific gaps while the candidate fixes seven defects including queue bounds, suspension, and error handling.devops-cli-service commentedon Nov 16, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
test(roadmap): register roadmap.fix_checks.max_wait_minutes
docs(openspec): archive 6018-fix-checks-queue-bounded
devops-cli-service commentedon Nov 16, 2026
Released in v0.169.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.169.0
devops-cli-service commentedon Nov 16, 2026
Live since 2026-11-16 21:30 UTC