Repository navigation
ci: a cancelled run's gates end cancelled, not failed (Part of #7455) - #7465
Conversation
The five aggregate gates ran under always(), so after a cancel they saw cancelled inputs and exited 1. GitHub showed a failed check and workers were sent to fix it. Use !cancelled() instead. The gate's shell is unchanged, so a job that timed out in a live run still fails it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No description provided. |
|
No description provided. |
|
Live check on this PR's own runs, head 5009335. I cancelled all five gate workflows while their parts were still queued or running, as a superseded run would be, then reran them.
The check runs on the commit, which GitHub evaluates for required checks, read The PR read These cancels came from |
|
PR #7465 @ 5009335: 3 failed check(s) == ground-truth (failure) -- real == ground-truth part 2/2 (failure) -- main == shard 1/2 (failure) -- main |
|
CI shepherd: the head of this PR (aa6e02f) is not the one a maintainer labelled |
|
No description provided. |
|
No description provided. |
Part of #7455 (item 2).
Why
When a PR's run is cancelled because a newer one replaced it, its final gate job still ran, saw
cancelledinputs and exited 1. GitHub then showed a failed check on a run that had found nothing wrong. Workers were sent to fix these: 22 of 41envfix runs on 10-29..31 found only cancelled checks. #7432 taughtci_digestto read this as a rerun. This PR fixes the source.What
Five jobs change from
if: always() && <draft clause>toif: !cancelled() && <draft clause>:full-suite,ground-truth,det,equivalence-e2eandcrucible. Their shell is unchanged. Smoke's older main-only cancel clause goes too, since the new form covers it.These are the whole class. In a sample of 108 cancelled PR runs across all workflows, these five were the only jobs that ended
failure. Fivealways()audit jobs are left alone: they aggregate nothing and finishedsuccessin the sampled cancelled runs. They do keep a runner busy after a cancel, which could be its own small saving.tests/tools/test_cancelled_gates.pyis new. Docs are indocs/ci.mdanddocs/ci_experiments_log.md.docs_read_by_tests.txtis regenerated.Why required checks stay safe
The risk is a gate ending
skipped, because a skipped required job reads as green. So each way a gate could end was checked:cancelledsuccess; noneskipped. Check runs on the commit agreed in the 3 sampled. On a PR,shardanddb2in run 41321330516timeout-minutes, run stays alivecancelled, butcancelled()stays false!cancelled()gate atfailurefull-suitejob. GitHub's behaviour here is from its docs, not testedThen the result itself:
success,skippedandneutralas passing, socancelleddoes not pass. The docs do not say outright that it blocks, and I did not test that directly.ci-gateis a separate required check.pr_check.classifyfiles a cancelled check as failed andci_digesttriages itinfra, soci-gatestayspendingduring reruns, thenfailurewhen they run out. It only goessuccessif a same-name run on that SHA succeeded, which is the existing rule and means that tree was proven.cancelledstill blocks there, butci-gatenow reads it as passed where afailureused to hold it. It needs an earlier success on the same SHA, so nothing unproven gets through.The tests pin each gate's
if:to the exact text, because any other false condition is askippedjob. They also run each gate's real shell oncancelledinputs. Puttingalways()back, or makingground-truthacceptcancelled, fails them.Runner cost
This adds no job, and PR reach is unchanged. It saves the gate job on every cancelled run, including
detandcrucible, which check out and install before they fail. I did not measure that saving.Not verified
cancelledon this PR's own runs (comment below). Those cancels usedgh run cancel, not a new push.cancelledrequired check blocks merge was not tested alone. It rests on GitHub's docs and onci-gate.failurein that case.scratch/7455-cancel-probe, which predates this work and is not mine. I left it in place.How to check after merge
Take any superseded PR run, for example with
gh run list --status cancelled --event pull_request, then:gh api repos/squid-protocol/gitgalaxy/actions/runs/RUN/attempts/1/jobs --jq '.jobs[]|[.name,.conclusion]|@tsv'The five gates must read
cancelled, orsuccessif they finished before the cancel. Anyskippedis a bug: revert this at once.failuremeans the cancel came after the gate started in a way this reasoning missed. Also watch theenvfix-run count fall on the churn chart.🤖 Generated with Claude Code