From bc6110ad2eb6066f3e6972356c6e672d0dee48ba Mon Sep 17 00:00:00 2001 From: Mobeen Abdullah Date: Wed, 12 Aug 2026 02:42:01 +0500 Subject: [PATCH 1/2] ci(root): stop a main run from cancelling the commit before it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On `main` `github.ref` is one string for every push, so each merge superseded and cancelled the previous commit's in-flight run. Measured over the last eight commits: `Browser tests` 2 success / 5 cancelled, and the three `Integration` legs 3 success / 5 cancelled — on exactly the same five commits, which is what points at one shared cause rather than two flaky jobs. A required check reporting `cancelled` is indistinguishable from one that failed, so the habit it teaches is to merge past red. That is the cost worth fixing, more than the missing coverage. Cancellation stays for pull requests, where a new push makes the previous verdict irrelevant and the minutes are worth saving. `preview.yml` carries the same setting and is left alone: it triggers on pull requests only. --- .github/workflows/ci.yml | 12 +++++++++++- .github/workflows/integration.yml | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce12291912..078028c3f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,19 @@ on: permissions: contents: read +# Superseding is right for a branch under review and wrong for `main`. +# +# On a pull request a new push makes the previous run's verdict irrelevant, so +# cancelling it saves minutes and loses nothing. On `main` every commit is a +# distinct artifact somebody will later ask "was that green?" about, and +# `github.ref` is the same string for every push there — so each merge cancelled +# the previous commit's run. With several lanes merging, most `main` commits +# never reached a verdict at all, and a REQUIRED check that reports `cancelled` +# is indistinguishable from one that failed. That trains people to merge past +# red, which is the actual cost. concurrency: group: ci-${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: ci: diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index e81f0528f0..84e80af3b3 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -22,9 +22,12 @@ on: permissions: contents: read +# Scoped to pull requests for the same reason as the CI workflow: on `main` +# `github.ref` is one string for every push, so each merge cancelled the +# previous commit's run and left a required check reporting `cancelled`. concurrency: group: integration-${{ github.ref }} - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: integration: From 88dfa98865f999660ce9d8a4e3a2b1f4dd254000 Mon Sep 17 00:00:00 2001 From: Mobeen Abdullah Date: Wed, 12 Aug 2026 02:57:30 +0500 Subject: [PATCH 2/2] ci(root): give every main commit its own concurrency group MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switching cancellation off preserved the RUNNING job and not the queued one. A concurrency group holds at most one running and one pending run, so three merges in quick succession displace the middle commit while it is still queued — the same missing verdict, reached a different way. Keyed by `github.sha` on push there is nothing to displace. Pull requests keep the shared per-ref group, where superseding is what you want. --- .github/workflows/ci.yml | 24 +++++++++++++++--------- .github/workflows/integration.yml | 11 ++++++----- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 078028c3f2..a52feeea08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,16 +15,22 @@ permissions: # Superseding is right for a branch under review and wrong for `main`. # # On a pull request a new push makes the previous run's verdict irrelevant, so -# cancelling it saves minutes and loses nothing. On `main` every commit is a -# distinct artifact somebody will later ask "was that green?" about, and -# `github.ref` is the same string for every push there — so each merge cancelled -# the previous commit's run. With several lanes merging, most `main` commits -# never reached a verdict at all, and a REQUIRED check that reports `cancelled` -# is indistinguishable from one that failed. That trains people to merge past -# red, which is the actual cost. +# every push shares one group and cancels the last: minutes saved, nothing lost. +# +# On `main` every commit is a distinct artifact somebody will later ask "was that +# green?" about, so each push gets a group of its OWN. Sharing a `github.ref` +# group there cancelled the previous commit's run on every merge, and a REQUIRED +# check reporting `cancelled` is indistinguishable from one that failed — which +# trains people to merge past red. +# +# The group has to differ per commit rather than the cancellation merely being +# switched off. A group holds at most one running AND one pending run, so with +# three merges in quick succession the third displaces the second while it is +# still queued: the middle commit ends up cancelled regardless of +# `cancel-in-progress`. Keyed by `github.sha`, there is nothing to displace. concurrency: - group: ci-${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + group: ci-${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} + cancel-in-progress: true jobs: ci: diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 84e80af3b3..6685faab6a 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -22,12 +22,13 @@ on: permissions: contents: read -# Scoped to pull requests for the same reason as the CI workflow: on `main` -# `github.ref` is one string for every push, so each merge cancelled the -# previous commit's run and left a required check reporting `cancelled`. +# Keyed per commit on `main` for the same reason as the CI workflow: a shared +# `github.ref` group cancelled the previous commit's run on every merge, and +# switching cancellation off is not enough — a group holds one running and one +# pending run, so a third merge displaces the second while it is still queued. concurrency: - group: integration-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + group: integration-${{ github.event_name == 'pull_request' && github.ref || github.sha }} + cancel-in-progress: true jobs: integration: