From fcd1d14ff916586e445a2973de48d8cbe8373934 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 18 Sep 2026 15:52:38 +0000 Subject: [PATCH 1/2] ci: cancel superseded pull request runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The two per-job concurrency groups already cancelled a superseded job when its replacement was queued, but they cancelled pushes to `main`, `next` and `v4` the same way. Those runs publish the coverage later comparisons are measured against, and cancelling one also hides a breakage that is already on the branch. Replace them with a single workflow-level group that only cancels pull request runs. Besides fixing that, it cancels the whole superseded run at once rather than job by job as each replacement is queued — the test matrix is 48 jobs — it covers `upload-coverage`, which had no group of its own and could otherwise publish coverage for a commit already superseded, and a matrix dimension added later cannot be forgotten in a group key. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF --- .github/workflows/nodejs.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index f40d672505..4ade488a31 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -12,6 +12,16 @@ on: - next - v4 +# A new commit supersedes the previous one's jobs, so stop paying for them: the +# matrix below fans out to 48 test jobs (three operating systems, four Node.js +# versions, four shards). Runs for the branches this also builds on push +# (`main`, `next`, `v4`) are never cancelled — they publish the coverage later +# comparisons are measured against, and a cancelled one would hide a breakage +# that is already on the branch. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + permissions: contents: read @@ -29,10 +39,6 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: lint-${{ matrix.os }}-v${{ matrix.node-version }}-${{ github.ref }} - cancel-in-progress: true - steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -76,10 +82,6 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: test-${{ matrix.os }}-v${{ matrix.node-version }}-${{ matrix.webpack-version }}-${{ matrix.shard }}-${{ github.ref }} - cancel-in-progress: true - steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 From 2a57d729b4ceec968aef29571225efda10c276e1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 18 Sep 2026 16:04:48 +0000 Subject: [PATCH 2/2] ci: give non-pull-request runs a concurrency group of their own `cancel-in-progress` only protects the run that is already executing. A concurrency group holds at most one pending run, and GitHub cancels that pending run whenever a newer one enters the group, whatever `cancel-in-progress` says. Keying every run of the workflow on the ref therefore did not deliver what the comment promised: with one branch run executing and a second waiting, a third push would have evicted the second. Group only pull request runs by ref; give everything else `github.run_id`, so each is a group of one that can be neither cancelled nor evicted. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF --- .github/workflows/nodejs.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 4ade488a31..92182cbcd4 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -14,12 +14,15 @@ on: # A new commit supersedes the previous one's jobs, so stop paying for them: the # matrix below fans out to 48 test jobs (three operating systems, four Node.js -# versions, four shards). Runs for the branches this also builds on push -# (`main`, `next`, `v4`) are never cancelled — they publish the coverage later -# comparisons are measured against, and a cancelled one would hide a breakage -# that is already on the branch. +# versions, four shards). Only pull request runs share a group; every other run +# gets a group of its own (`github.run_id`), because a group holds at most one +# pending run and a later push would otherwise evict the one waiting — +# `cancel-in-progress` protects the running run, not the queued one. The +# branches this also builds on push (`main`, `next`, `v4`) publish the coverage +# later comparisons are measured against, and losing one of those runs would +# also hide a breakage that is already on the branch. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: