Skip to content

ci: a cancelled run's gates end cancelled, not failed (Part of #7455) - #7465

Merged
squid-shepherd[bot] merged 2 commits into
mainfrom
fix/7455-cancelled-gates
Nov 1, 2026
Merged

squid-shepherd[bot] merged 2 commits into
mainfrom
fix/7455-cancelled-gates

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

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 cancelled inputs 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 41 env fix runs on 10-29..31 found only cancelled checks. #7432 taught ci_digest to read this as a rerun. This PR fixes the source.

What

Five jobs change from if: always() && <draft clause> to if: !cancelled() && <draft clause>: full-suite, ground-truth, det, equivalence-e2e and crucible. 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. Five always() audit jobs are left alone: they aggregate nothing and finished success in 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.py is new. Docs are in docs/ci.md and docs/ci_experiments_log.md. docs_read_by_tests.txt is 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:

Case What the gate does Evidence
Run cancelled, gate not started Ends cancelled 77 of 78 main Smoke runs of 10-21..24 under this same condition; the other ended success; none skipped. Check runs on the commit agreed in the 3 sampled. On a PR, shard and db2 in run 41321330516
A needed job hits timeout-minutes, run stays alive Runs and fails. The job reports cancelled, but cancelled() stays false Probe run 41330481108: a single job and a matrix leg each left a !cancelled() gate at failure
A needed job fails Runs and fails, as before Same probe; shell tests
Run cancelled before any job exists No check appears, so the required check stays expected and blocks 22 of the 100 sampled runs had no full-suite job. GitHub's behaviour here is from its docs, not tested

Then the result itself:

  • GitHub's docs list success, skipped and neutral as passing, so cancelled does not pass. The docs do not say outright that it blocks, and I did not test that directly.
  • ci-gate is a separate required check. pr_check.classify files a cancelled check as failed and ci_digest triages it infra, so ci-gate stays pending during reruns, then failure when they run out. It only goes success if a same-name run on that SHA succeeded, which is the existing rule and means that tree was proven.
  • That rule does shift one case. GitHub takes the newest check, so a newer cancelled still blocks there, but ci-gate now reads it as passed where a failure used 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 a skipped job. They also run each gate's real shell on cancelled inputs. Putting always() back, or making ground-truth accept cancelled, fails them.

Runner cost

This adds no job, and PR reach is unchanged. It saves the gate job on every cancelled run, including det and crucible, which check out and install before they fail. I did not measure that saving.

Not verified

  • This form has now been seen on real cancelled PR runs: all five gates ended cancelled on this PR's own runs (comment below). Those cancels used gh run cancel, not a new push.
  • That a cancelled required check blocks merge was not tested alone. It rests on GitHub's docs and on ci-gate.
  • Fail-fast sibling cancels were not exercised: in the probe the second leg finished before the first started. The gate still reads the matrix result, which is failure in that case.
  • The probe's manual-cancel workflow (run 41330481091) was never actually cancelled, so it proves nothing about cancels. The cancel evidence is the real runs above.
  • The probe is from 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, or success if they finished before the cancel. Any skipped is a bug: revert this at once. failure means the cancel came after the gate started in a way this reasoning missed. Also watch the env fix-run count fall on the churn chart.

🤖 Generated with Claude Code

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]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 1, 2026
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 1, 2026 18:22
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd squid-shepherd Bot added the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 1, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

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.

Workflow Run Gate Result Runner used
GitGalaxy Smoke Tests 41336070972 full-suite cancelled none
Equivalence E2E 41336070868 equivalence-e2e cancelled none
Det Sweep 41336070979 det cancelled none
Mainframe Ground Truth 41336070977 ground-truth cancelled none
CICS Crucible 41336070962 crucible cancelled none

The check runs on the commit, which GitHub evaluates for required checks, read cancelled too. None was failure or skipped. ci-gate stayed pending, and ci_digest triaged all five gates as infra, so they went to a rerun and not to a worker.

The PR read BLOCKED during this, but that does not isolate the result: ci-gate was pending and other checks were still running. So "a cancelled required check blocks merge" still rests on GitHub's docs and on ci-gate.

These cancels came from gh run cancel, not from a new push. Both are run cancels, and the 77 main runs were superseded the other way.

@squid-shepherd squid-shepherd Bot added shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md and removed shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md labels Nov 1, 2026
@squid-shepherd
squid-shepherd Bot disabled auto-merge November 1, 2026 18:49
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

PR #7465 @ 5009335: 3 failed check(s)

== ground-truth (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/41336070977/job/124940558417
repro: python tests/tools/pr_gates.py --ratchets --only-ratchets ground-truth (when a ground-truth part failed too, run that part's repro)
errors:
##[error]Process completed with exit code 1.
log tail:
##[endgroup]
##[group]Operating System
Ubuntu
24.04.5
LTS
##[endgroup]
##[group]Runner Image
Image: ubuntu-24.04
Version: 20261025.353.1
Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20261025.353/images/ubuntu/Ubuntu2404-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20261025.353
##[endgroup]
##[group]GITHUB_TOKEN Permissions
Contents: read
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Complete job name: ground-truth
##[group]Run echo "ground-truth warm: $WARM, parts: $PARTS (tested-tree skip: $SKIP, plan mode: $MODE, layout: $LAYOUT, warm planned: $PLANNED_WARM)"
echo "ground-truth warm: $WARM, parts: $PARTS (tested-tree skip: $SKIP, plan mode: $MODE, layout: $LAYOUT, warm planned: $PLANNED_WARM)"
# #4935: "skipped" is a pass only when the gate proved this tree green on the PR; otherwise it is a failure
# #5164: ... or when the plan found no ground-truth input in the PR (mode none). An empty mode is not none.
ok() { test "$1" = "success" || { test "$1" = "skipped" && { test "$SKIP" = "true" || test "$MODE" = "none"; }; }; }
# #5543: ... or when the layout needs no warm job (a cache hit on the scans, or the busy layout): the parts then warm for themselves
{ ok "$WARM" || { test "$WARM" = "skipped" && test "$PLANNED_WARM" = "false"; }; } && ok "$PARTS"
shell: /usr/bin/bash -e {0}
env:
WARM: skipped
PARTS: failure
SKIP:
MODE: full
PLANNED_WARM: false
LAYOUT: busy
##[endgroup]
ground-truth warm: skipped, parts: failure (tested-tree skip: , plan mode: full, layout: busy, warm planned: false)
##[error]Process completed with exit code 1.
Cleaning up orphan processes

== ground-truth part 2/2 (failure) -- main
https://github.com/squid-protocol/gitgalaxy/actions/runs/41336070977/job/124937435359
repro: stale base (main changed these tests since this branch): git merge origin/main
failing tests: tests/cobol_mainframe/test_address_5079.py::test_the_system_areas_are_modelled_on_every_surface_and_no_text_says_the_spec_refuses_them
errors:
fail-on-cache-miss: false
E AssertionError: addressCwa
tests/cobol_mainframe/test_address_5079.py:179: AssertionError
FAILED tests/cobol_mainframe/test_address_5079.py::test_the_system_areas_are_modelled_on_every_surface_and_no_text_says_the_spec_refuses_them - AssertionError: addressCwa
##[error]Process completed with exit code 1.
log tail:
env:
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
GITGALAXY_MAINFRAME_CORPORA: /home/runner/work/gitgalaxy/gitgalaxy/.mainframe_corpora
MAINFRAME_ENGINE_KEY: 1beea1648f93162c30d1b3d6bbd76f9265784bccb73f3ee2e49eb0c5d2106659
PYTHONUTF8: 1
pythonLocation: /opt/hostedtoolcache/Python/3.12.15/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
##[endgroup]
With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: test-times-ground-truth-part-2.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 152096
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is bfb421955b9e284bcd461dd68dc46c3a98bc93163fede50710fcfb491efa33e7
Finalizing artifact upload
Artifact test-times-ground-truth-part-2 successfully finalized. Artifact ID 13095523639
Artifact test-times-ground-truth-part-2 has been successfully uploaded! Final size is 152096 bytes. Artifact ID is 13095523639
Artifact download URL: https://github.com/squid-protocol/gitgalaxy/actions/runs/41336070977/artifacts/13095523639
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.0
Temporarily overriding HOME='/home/runner/work/_temp/b5635c4a-b303-48de-955f-442364594d25' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

== shard 1/2 (failure) -- main
https://github.com/squid-protocol/gitgalaxy/actions/runs/41336070868/job/124937426011
repro: stale base (main changed these tests since this branch): git merge origin/main
failing tests: tests/cobol_mainframe/test_address_5079.py::test_the_system_areas_are_modelled_on_every_surface_and_no_text_says_the_spec_refuses_them
errors:
fail-on-cache-miss: false
E AssertionError: addressCwa
tests/cobol_mainframe/test_address_5079.py:179: AssertionError
FAILED tests/cobol_mainframe/test_address_5079.py::test_the_system_areas_are_modelled_on_every_surface_and_no_text_says_the_spec_refuses_them - AssertionError: addressCwa
##[error]Process completed with exit code 1.
log tail:
pythonLocation: /opt/hostedtoolcache/Python/3.12.15/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.21-9/x64
JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.21-9/x64
MAVEN_ARGS: -ntp
GITGALAXY_ORACLE_PREBUILT: 1
##[endgroup]
With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: test-times-equivalence-e2e-shard-1.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 56743
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is 486f801dff708d88e7c4b3bba56c533818e4f68bad39356f8a7eba46d7f66a75
Finalizing artifact upload
Artifact test-times-equivalence-e2e-shard-1 successfully finalized. Artifact ID 13094999456
Artifact test-times-equivalence-e2e-shard-1 has been successfully uploaded! Final size is 56743 bytes. Artifact ID is 13094999456
Artifact download URL: https://github.com/squid-protocol/gitgalaxy/actions/runs/41336070868/artifacts/13094999456
Post job cleanup.
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.0
Temporarily overriding HOME='/home/runner/work/_temp/01223c76-6181-4bb1-aaa6-e6fb2a6c6634' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-shepherd squid-shepherd Bot added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Nov 1, 2026
@squid-shepherd squid-shepherd Bot removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 1, 2026
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (aa6e02f) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd
squid-shepherd Bot marked this pull request as draft November 1, 2026 18:51
@squid-shepherd squid-shepherd Bot added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md labels Nov 1, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Nov 1, 2026
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 1, 2026 18:57
@squid-shepherd squid-shepherd Bot added the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 1, 2026
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 1, 2026 18:57
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd squid-shepherd Bot removed the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 1, 2026
@squid-shepherd
squid-shepherd Bot merged commit 6ca801f into main Nov 1, 2026
97 of 125 checks passed
@squid-shepherd
squid-shepherd Bot deleted the fix/7455-cancelled-gates branch November 1, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant