Repository navigation
Conversation
When a self-hosted runner is reclaimed while a job's main "Run" step is executing, the job finalizes as conclusion=failure with the "Run" step at conclusion=cancelled. The check reports red having executed zero tests and published zero CIDB rows, and the hourly infra-retry workflow does not rerun it, for two independent reasons. The jq classifier switches on the "Run" step's conclusion with arms for an absent step, "skipped" and "failure"-under-120s, plus an "else false" default. "cancelled" lands in the default and is scored a real test failure; the run gate requires every failed job to be infra, so one such job suppresses the whole rerun. For run 32413924641 the workflow's own log shows "Checking run .../32413924641" followed by "Not an infrastructure failure, skipping." Separately, the candidate window is anchored on createdAt, but a run only becomes listable once it completes, so a run longer than the 6h window already has a createdAt older than the cutoff at the first invocation that could see it. Measured against the workflow's 100 actual fire times (the nominal ':43' is not when it fires; the observed minute-of-hour spans 0-59 with gaps up to 77.6 min), 175 of 399 recent failed runs are unreachable by any fire, 122 of them at attempt 1; under an updatedAt anchor, 0 are. Three of the unreachable runs are ones the current classifier already calls infra, and none was ever retried. The window length is deliberately unchanged: only the anchor was wrong. --limit is raised because the list is ordered by createdAt while eligibility is now by completion, so a long run sits deep in it; the deepest eligible position measured is 131, and MAX_RERUNS is untouched so a wider scan cannot increase the number of reruns. Verified on two runner-reclaim runs, 32413924641 (AST fuzzer (amd_debug, targeted)) and 32306491684 (Stress test (amd_msan)): the classifier extracted from master scores both false, the one extracted from this branch scores both true. A user cancel or a cascade cancel cannot be affected, because it makes the job itself "cancelled", which the .conclusion == "failure" pre-filter removes before any "Run"-step arm is reached: across 60 deliberately-cancelled runs (3798 jobs) there are zero (job failure, Run cancelled) pairs and zero verdict changes, and none of those runs is returned by "gh run list --status failure". Across 120 attempt-1 failed runs the only verdict change is run 32413924641 itself, with no run losing a retry it already got. The "null" conclusion arm is deliberately left to the separate open ClickHouse#115569 rather than duplicated here.
Internal second-model review — 0 blockers, 0 majors (click to expand)An independent cold review plus a second-model gate reviewed this change before it was pushed. Result: 0 blockers, 0 majors, 0 changes requested. Two cosmetic comment nits were dropped as Checks that were run independently of the change's own evidence
Nits, not blocking
Noted for a reviewerNo in-tree test is added. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-review-slot-11:20260821-065200 |
|
Workflow [PR], commit [70ce7f6] Summary: ✅ AI ReviewSummaryThis PR fixes one real classifier gap by treating a failed job whose Findings❌ Blockers
Final VerdictChanges requested. |
|
cc @maxknv, could you review this? When a self-hosted runner is reclaimed mid- |
The candidate scan is ordered by createdAt while eligibility is by updatedAt, so a fixed --limit is a prefix of a different order than the one being filtered: an eligible run can sit behind more than <limit> newer-created runs and be dropped forever. Simulating the selector at 42 historical fire times over 1000 recent failed runs, the deepest eligible list index reaches 214, so --limit 200 does drop an eligible run (1 of 1746 across those fires). Bounding on createdAt instead makes the scanned set a contiguous prefix of the listing's own order, which is what removes the hole rather than widening it: the same simulation misses 0 of 1746. The 24h floor is 4x the largest attempt-1 duration observed beyond the window (9.42h), and costs a median of 267 listed runs against a 1000 cap that is warned about if it is ever reached. The alternative of paging until the oldest returned run predates the updatedAt cutoff was measured and rejected: because updatedAt is not monotonic in this listing (457 inversions of 999), that stopping rule terminates early and misses 1306 of the same 1746 eligible runs. MAX_RERUNS is untouched, so a wider scan still cannot cause more reruns.
|
Agreed on the premise, and it refutes a claim I had made: I had recorded that nothing eligible sits I did not use the suggested stopping rule, because it measures worse than the fixed limit it would
What the change does instead is bound the scan on The scan is bounded, not unbounded, so to be precise about what it does guarantee: eligibility |
| --limit 50 \ | ||
| --json databaseId,attempt,createdAt \ | ||
| --jq ".[] | select(.attempt == 1 and .createdAt >= \"$cutoff\") | .databaseId") | ||
| --created ">=$scan_floor" \ |
There was a problem hiding this comment.
updatedAt >= "$cutoff" is the eligibility contract here, but --created ">=${scan_floor}" silently adds a second one: createdAt >= now-24h. That still misses any attempt-1 PR run that spends more than 18 hours between creation and failure.
That is not just theoretical for this workflow. GitHub can leave self-hosted jobs queued for up to 24 hours before failing them, and a pull_request.yml run can then execute for hours after that, so a runner-starved PR can still fail within the last 6 hours while being older than this createdAt floor. Those are exactly the incidents this retry job is supposed to recover, and they will still age out permanently here.
Please either derive the bound from an enforced maximum lifetime of pull_request.yml, or page/fail in a way that still guarantees completeness with respect to recent updatedAt values.
There was a problem hiding this comment.
The premise is right and the description now states it: --created is a second condition on top of updatedAt. I corrected the body. On the mechanism and the two remedies, measurements below.
The 24h queue limit cancels, it does not fail. Per the Actions limits page, "a job can be in the queue for 24 hours before it is automatically cancelled". The selector pre-filters --status failure. Over 7 days of pull_request.yml, run-level cancelled ids intersected with failure ids give 0 overlap (1000 and 999 ids fetched; self-intersection 999/999 as a control). A 24h-queued run never enters the scanned set.
Magnitude is zero in a complete population. Fetched per-day so nothing truncates, each day's total_count asserted, 0 days short: 4928 failed runs, 2732 at attempt 1. Create-to-fail span p50 4.63h, p90 6.29h, max 9.42h; above 12h 0, above the 18h this needs 0. Every run above 24h (42, up to 318h) is attempt 2+, excluded by construction. Requirement is 6h cutoff + 9.42h = 15.42h, so 24h holds 1.56x.
Paging until the oldest predates the cutoff is the rule measured last round at 1306 missed against 1. Re-confirmed why: over 900 listed runs createdAt has 0 inversions while updatedAt has 407, so an updatedAt stopping rule ends a createdAt-ordered stream early.
Deriving the bound from an enforced maximum lifetime is not reachable. Those maxima are 35 days per run and 5 days per self-hosted job; a 5-day floor would list 2339 runs at the worst fire, and the runs API stops at 1000 results: page 11 at per_page=100 returns 0 while page 10 returns 100 of 4929, and per_page=50 page 21 is likewise 0 (a 447-run day paginates fully as a control). Asking for that bound reintroduces silent truncation.
Simulating 323 hourly fires over the full population: 24h/1000 misses 0 and never reaches the cap; 48h leaves 990 of 1000; 72h binds at 163 of 323 fires. 24h is the only floor with headroom on both sides, and a warning fires if the cap ever binds.
|
The job retry is implemented outside of this repo in Lambda. this change adds conflicts |
|
Understood, and I will not reopen this. One question before I close my side out: does the Lambda treat a job whose
One observation, since it bears on the conflict you describe: I also have two older open PRs against that same file, #115569 and #113564. If it is being |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
When a self-hosted runner is reclaimed mid-
Run, the job endsfailurewith theRunstepcancelled. The check goes red having run zero tests and published zero CIDB rows, and the hourlyinfra-retry workflow does not rerun it, for three reasons.
No classifier arm for a
cancelledRunstep: it falls intoelse falseand is scored a realfailure, while the gate needs every failed job to be infra. The cron's log for run 32413924641
ends
Not an infrastructure failure, skipping.The window was anchored on
createdAt, but a run only becomes listable once it completes, so arun longer than the 6h window is already outside it when first seen. Against actual fire times,
175 of 399 recent failed runs are unreachable; under an
updatedAtanchor, 0 are. The windowlength is unchanged.
The scan is bounded on
createdAtrather than a fixed--limit: the listing is ordered bycreatedAtwhile eligibility is byupdatedAt, so a fixed prefix truncates a different order thanthe one filtered. The deepest eligible index reaches 214, so a 200 limit drops a run.
That floor is a second condition on top of
updatedAt, so reaching it needs an attempt-1 lifetimeabove 18h; across a complete 14-day population the longest is 9.42h, giving 1.56x spare. It cannot
widen, since the runs API stops at 1000 results and a 5-day floor needs 2339 at the worst fire.
Over 323 simulated fires, 24h under a 1000 cap misses nothing and never reaches it; 72h binds at
163. A warning fires if it does.
MAX_RERUNSis untouched, so a wider scan cannot add reruns. Verified on runs 32413924641and 32306491684:
falsebefore,trueafter. Across 60 deliberately cancelled runs there are no(job failure, Run cancelled)pairs, since such a run's conclusion is itselfcancelled.Related: #115569
Related: #113564