From f79aba171242de7306b3a40eb4d18d0535c75270 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 18 Sep 2026 15:52:28 +0000 Subject: [PATCH 1/2] ci: cancel superseded pull request runs The three per-job concurrency groups already cancelled a superseded job when its replacement was queued, but they cancelled pushes to `main`, `next` and `hot-middleware` the same way. Those runs publish coverage, 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, it covers jobs that have no group of their own, 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 | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index db3e08695..7af22dfe7 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -12,6 +12,15 @@ on: - next - hot-middleware +# A new commit supersedes the previous one's jobs, so stop paying for them: the +# matrix below fans out across three operating systems and four Node.js +# versions. Runs for the branches this also builds on push (`main`, `next`, +# `hot-middleware`) are never cancelled — they publish coverage 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,9 +38,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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -67,10 +73,6 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: test-${{ matrix.os }}-v${{ matrix.node-version }}-${{ matrix.webpack-version }}-${{ github.ref }} - cancel-in-progress: true - steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -99,10 +101,6 @@ jobs: # every OS and node version. One job runs it, off the matrix. runs-on: ubuntu-latest - concurrency: - group: client-${{ github.ref }} - cancel-in-progress: true - steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 From 9acaad22989a56c0f02e45217c570d1907500126 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 18 Sep 2026 16:04:46 +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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 7af22dfe7..f4c7fa689 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -14,11 +14,14 @@ on: # A new commit supersedes the previous one's jobs, so stop paying for them: the # matrix below fans out across three operating systems and four Node.js -# versions. Runs for the branches this also builds on push (`main`, `next`, -# `hot-middleware`) are never cancelled — they publish coverage and a cancelled -# one would hide a breakage that is already on the branch. +# versions. 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`, `hot-middleware`) publish coverage, 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: