Skip to content

Commit 866055f

Browse files
ooplesfranklinicclaude
authored
ci: always cancel in-progress shard runs to stop queue pile-up (#1792)
cancel-in-progress was false for pull_request events, so every synchronize (and every master push) stacked another full 49-shard matrix in the queue instead of superseding the prior run. Against the free-tier 20-concurrent-job cap this saturated the pool for hours — fresh runs sat pending with 0 jobs dispatched (observed on PR #1789). Set cancel-in-progress to true for all events so the latest commit's run supersedes the stale one and frees runners immediately. The head run always completes (nothing newer supersedes it); only superseded SHAs are cancelled, which is the correct signal. Co-authored-by: franklinic <franklin@ivorycloud.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 06d6280 commit 866055f

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

.github/workflows/sonarcloud.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,21 @@ concurrency:
6060
# downstream check (branch-protection, PR mergeability, release tagging)
6161
# actually consumes. The intermediate-SHA loss is acceptable.
6262
group: build-${{ github.event.pull_request.number || github.ref }}
63-
# cancel-in-progress is TRUE for push/master events (a newer master tip supersedes
64-
# the prior in-flight run — only the latest tip needs a green signal, saves ~45min)
65-
# but FALSE for pull_request events: a rapid synchronize must NOT kill an in-progress
66-
# test-shard run, because cancelling mid-shard marks in-flight tests as FAILED and
67-
# leaves the 49-shard matrix with no completed signal to verify a PR against
68-
# (observed repeatedly on #1719: DQNAgent / FastConformer "failures" that pass
69-
# locally were cancellation artifacts). GitHub still supersedes only PENDING runs in
70-
# the group, so at most one run is queued per PR — bounded (≤1 in-progress + ≤1 pending),
71-
# no matrix pile-up, so the extra runner time per PR is capped, not unbounded. The
72-
# obvious alternative — keep cancel-in-progress: true but treat cancelled jobs as
73-
# neutral in required checks — does not fit here: GitHub reports a cancelled required
74-
# check as FAILING (not neutral), which is exactly the false-red branch-protection
75-
# signal this setting exists to avoid.
76-
cancel-in-progress: ${{ github.event_name != 'pull_request' }}
63+
# cancel-in-progress is TRUE for ALL events (push AND pull_request). Only the latest
64+
# commit on a branch/PR needs a green signal; letting a superseded 49-shard run keep
65+
# executing just burns CI on a SHA nobody is on. With the GitHub free-tier 20-concurrent
66+
# cap, NOT cancelling meant every synchronize/master push stacked another full matrix in
67+
# the queue (≤1 in-progress + ≤1 pending PER PR, times many open PRs + master, saturated
68+
# the pool for hours — the queue was so backed up that fresh runs sat pending with 0 jobs
69+
# dispatched). Cancelling the in-flight run the moment a newer commit arrives frees the
70+
# pool immediately, so the CURRENT tip's run actually gets runners.
71+
#
72+
# Trade-off accepted: a mid-matrix cancel marks that (now-stale) run's in-flight shards
73+
# cancelled, and GitHub reports a cancelled required check as failing — but that is the
74+
# SUPERSEDED SHA, not the head. The freshly-triggered run for the new tip is the
75+
# authoritative signal every downstream check (branch protection, mergeability) consumes;
76+
# its shards run to completion because nothing newer supersedes it.
77+
cancel-in-progress: true
7778

7879
env:
7980
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1

0 commit comments

Comments
 (0)