Repository navigation
Fix the CI infrastructure auto-retry and rerun an infra job in a mixed run - #117282
Conversation
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex) over 3 rounds, beside an
Severity: ❌ blocker / My own cold reads raised no finding in the shipped logic in any of the three rounds. They Two further imprecisions I found and am disclosing rather than amending, since neither changes Session id: cron:clickhouse-review-slot-8:20260831-071900 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20260831-042400 |
|
Workflow [PR], commit [023b4ac] Summary: ✅ AI ReviewSummaryThis PR fixes several real gaps in the hourly infrastructure auto-retry and adds a new partial-rerun path for mixed runs. The remaining issue is that the new "exactly one infra job in a mixed run" recovery is not implemented consistently: Findings
Final VerdictChanges needed: the new mixed-run retry path still misses a real class of single-infra mixed runs. |
|
cc @maxknv, could you review this? The hourly infra auto-retry never acted on the |
…d run The hourly auto-retry in `retry_infra_failures.yml` has never acted on the `infra` label that ClickHouse#109673 added. Five independent defects sit in the same block, and all of them were measured on live runs. 1. A fork run carries no pull request number. GitHub populates `.pull_requests` only for a head branch in the base repository: it is populated for 0 of 33 sampled fork heads and for 7 of 7 same-repo heads. The whole Praktika-result path was gated on that number, so it was dead on every fork pull request. It is now resolved from the head reference when absent, which also revives the `Config Workflow` updated-description path for fork pull requests. 2. The job-name-to-filename normalization did not match praktika's. `Utils.normalize_string` ends with `res.rstrip("_")`, which the workflow's `sed` lacked, so every job name ending in a parenthesis built a key that does not exist: 155 of the 170 job names in the generated `pull_request.yml` mismatch. `curl -sf` treats the resulting 403 as a failure and the loop broke on the first one, so one failed parametrized job anywhere in a run killed the path. The construction is deleted rather than patched. 3. The failed-sub-result test compared `"failure"` and `"error"` against `Result.Status`, which is uppercase, so it was always false and any failed job with a readable unlabelled result was classified as infrastructure. Fixing only the URL would therefore have started rerunning genuinely failing runs; the two had to change together. 4. The label predicate matched only a bare string. `Result.set_label` stores labels as dicts, so the docker image pre-pull failure on integration jobs writes the dict form. `33b1f35c0ad` fixed exactly this and `7d022e880fef` reverted it across every workflow file, asking in its own description for the fix to be reapplied separately. One real artifact carries 191 dict labels beside 1 bare string, so both encodings must match. 5. The only available action was a whole-run rerun, which is correctly refused when the run also carries a real failure. All three runs that have ever carried the label are mixed, so 3 of 3 uses of the label were unrecoverable. The classification now reads the run's `result_pr.json` once. That is the same artifact `_finish_workflow` reads to compute `Mergeable Check`, so the retry decision and the merge decision can no longer disagree, and it is fresher than the per-job files. The job-level heuristic's own verdicts are deliberately not folded into that count: a `Run` step that fails in under two minutes is a timing proxy that also fires on a real fast failure such as `Style check`, so inside this path the artifact alone decides. Precedence between the two paths is asymmetric and unchanged: the artifact is read only when the heuristic has not already selected the run, so it can promote a candidate the heuristic rejected but never vetoes one it accepted. Each failed job gets a three-way verdict joined to the artifact by the entry's own `ext.run_url`: the S3 key names a pull request and a commit but no run, and 3 head commits in a 200-run sample carried two runs each, so the per-job join is what stops a candidate being classified from another run's entries. A single unclassifiable job abandons the whole candidate, because a re-run `Finish Workflow` returns early on an `OK` entry without consulting GitHub's own job conclusion and could otherwise post a green `Mergeable Check` over a real failure. A mixed run with exactly one infrastructure job now has that job rerun. GitHub's partial-rerun semantics are undocumented, so they were measured on a purpose-built probe: a per-job rerun re-executes the target, its dependents and `Finish Workflow`, carries every non-dependent job over with byte-identical timings and runner, and increments `run_attempt`; a second rerun with a previous attempt's job id is refused with 403 "Only jobs from the current attempt can be re-run". A job that had SUCCEEDED is re-executed if it depends on the target, but only 3 of the 170 generated jobs lack the `!contains(needs.*.outputs.pipeline_status, 'failure')` guard, so at most one job that could have passed is affected, and re-running the rest is the recovery rather than collateral. Exactly one job per run per tick, since the rerun makes every other job id stale. Two changes to existing behaviour. `Mergeable Check` is a commit status posted to the run's own head commit, and a rerun reuses the original event, so a run whose commit is no longer the head of its pull request can never unblock it; that precondition now applies to both actions rather than only to the `Config Workflow` path, which strictly reduces reruns. And a run sharing its commit with a concurrent run is left alone rather than acted on from a shared artifact. `MAX_RERUNS` and the candidate selector are untouched, so the tick's upper bound is unchanged. Validated with an uncommitted harness that extracts the step body from the YAML, driven over the 16 real pull-request-and-commit pairs that produced a `SQLLogic test` job-level failure in 30 days, beside the same harness running the unmodified step. The unmodified step takes no action on the mixed run 33331951492; this one reruns its single infrastructure job. The daemon death itself is a host condition, out of reach here: five distinct `m8g.4xlarge` hosts lost their daemon inside 36 minutes on 2026-08-30. Co-Authored-By: Claude Opus 5 <[email protected]>
f017e0d to
023b4ac
Compare
Related: #109673 (the
infralabel this acts on)Related: #113564 (candidate selector)
Related: #115569 (job-level heuristic)
Related: #116701 (duplicate runs at one commit)
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
The hourly auto-retry has never acted on the
infralabel #109673 added. ASQLLogic testjobkilled at exit 125 by a host docker daemon death 67 minutes in is labelled correctly and
never retried (job log).
Five defects sit in one block of
retry_infra_failures.yml:is dead on every fork PR;
and the loop breaks on the first;
it is always false; fixing only the URL would start rerunning real failures;
set_labelwrites;a mixed run was unrecoverable.
Classification now reads the run's
result_pr.jsononce, the artifactFinish Workflowreadsfor
Mergeable Check, joining each entry to its job byext.run_url. A mixed run with exactlyone infra job gets that job rerun, which also reruns its dependents and
Finish Workflow; theall-infra case still reruns whole.
Two side effects.
Mergeable Checkis a commit status and a rerun keeps the original commit, soa run whose commit is no longer its pull request's head is now skipped; that narrows the existing
whole-run path too. A run sharing a commit with a concurrent run is left alone rather
than acted on from an artifact both wrote, which #116701 would fix at its source.
Untouched: the daemon death is a host condition (five distinct
m8g.4xlargehosts inside 36minutes); two or more infra jobs in one run;
master.ymlruns; the legacyhlabelsform.Measurements and validation
Each defect, measured on live runs:
.pull_requestsis populated for 0 of 33 fork heads sampledand for 7 of 7 same-repo heads; the normalization omits praktika's
rstrip("_"), so 155 of170 job names build a key that does not exist; praktika statuses are
FAILandERROR, neverfailureorerror;33b1f35c0adfixed the dict-form label and7d022e880fefreverted itasking for a reapply; all three runs that have ever carried the label are mixed, so 3 of 3 uses
of the label were unrecoverable.
Validated over the 16 real (PR, commit) pairs that produced a
SQLLogic testjob-level failurein 30 days. The step body was extracted from the YAML and driven over them with the rerun call
stubbed, beside the same harness running master's step.
32038224339, whose pull request is now closed at a different commitSQLLogic testin run33331951492, a mixed run still at its pull request's headSQLLogic testof #116805's run, which the guard skips because that PR has moved onTwo of the 16 runs share their commit with a concurrent run, and their
result_pr.jsondoescarry entries stamped by both, so the per-job join is what keeps them from being acted on. Only
3 of the generated workflow's 170 jobs lack the
pipeline_statusguard, so a per-job rerunre-runs at most one job that could have passed.
The three open pull requests above merge cleanly with this change.
Workflow [PR]
Sync PR [sync-upstream/pr/117282]
Version info
26.10.1.2095-master(included in26.10and later)