From e4353d9742ced1c1910a38adc8ee50c59c0fbb78 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 25 Aug 2026 15:32:25 +0200 Subject: [PATCH] refactor(ci): derive the manual cancel override from the event force_cancel_in_progress existed so a manual sweep could supersede a running orchestrator on any ref. It was a flag every caller had to remember to pass, and only one ever did. A called workflow inherits github.event_name from its caller, so the orchestrator can see for itself that a human dispatched the run. The input is gone; the group reads the event instead. Automatic triggers keep following the ref alone -- everything but main -- and a manual dispatch supersedes everywhere, main included, because someone typed it. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/call-orchestrator.yml | 7 +------ .github/workflows/entry-manual-steer.yml | 1 - docs/contributing/artefact/git/pipeline.md | 4 ++-- docs/contributing/tools/github/actions/configuration.md | 4 ++-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/call-orchestrator.yml b/.github/workflows/call-orchestrator.yml index 128fe07503..be528068fd 100644 --- a/.github/workflows/call-orchestrator.yml +++ b/.github/workflows/call-orchestrator.yml @@ -87,15 +87,10 @@ on: required: false type: boolean default: false - force_cancel_in_progress: - description: "When true, a new run always cancels the running orchestrator on the same ref, including on main, which is otherwise never cancelled." - required: false - type: boolean - default: false concurrency: group: infinito-test-${{ github.ref }} - cancel-in-progress: ${{ inputs.force_cancel_in_progress || github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.event_name == 'workflow_dispatch' || github.ref != 'refs/heads/main' }} permissions: actions: read diff --git a/.github/workflows/entry-manual-steer.yml b/.github/workflows/entry-manual-steer.yml index b3e261655c..af8ab6b095 100644 --- a/.github/workflows/entry-manual-steer.yml +++ b/.github/workflows/entry-manual-steer.yml @@ -123,5 +123,4 @@ jobs: workspace_track: ${{ inputs.workspace_track }} instructions: ${{ inputs.instructions }} tor: ${{ inputs.tor }} - force_cancel_in_progress: true secrets: inherit diff --git a/docs/contributing/artefact/git/pipeline.md b/docs/contributing/artefact/git/pipeline.md index 68db383131..e5d8a4f3d2 100644 --- a/docs/contributing/artefact/git/pipeline.md +++ b/docs/contributing/artefact/git/pipeline.md @@ -127,8 +127,8 @@ The final `done` job aggregates all deploy, install, and development gates. CI i ## Concurrency 🔀 - PR pipelines use `cancel-in-progress: true` so only the newest run per PR and event type is active. The group does not always reap a long orchestrator sweep, which then leaves the newer run parked on `pending`; [entry-cancel-superseded.yml](../../../../.github/workflows/entry-cancel-superseded.yml) cancels those leftovers through the API, see [cancel/README.md](../../../../scripts/github/cancel/README.md). -- The orchestrator and the push entry workflow (`entry-push-latest.yml`) cancel in-progress runs on every ref except `main`, which is never cancelled. A `pull_request_target` run inherits `refs/heads/main` as its ref, so the orchestrator does not cancel there either; per-PR supersession is handled by the entry workflow's own `pr-ci-*` group. See [configuration.md](../../tools/github/actions/configuration.md). -- The manual entry workflow (`entry-manual-steer.yml`) sets `cancel-in-progress: true` on its own group and passes `force_cancel_in_progress: true` into the orchestrator, so a manual run cancels on both levels, `main` included. +- The orchestrator and the push entry workflow (`entry-push-latest.yml`) cancel in-progress runs on every ref except `main`, which no automatic trigger cancels. A `pull_request_target` run inherits `refs/heads/main` as its ref, so the orchestrator does not cancel there either; per-PR supersession is handled by the entry workflow's own `pr-ci-*` group. See [configuration.md](../../tools/github/actions/configuration.md). +- The manual entry workflow (`entry-manual-steer.yml`) sets `cancel-in-progress: true` on its own group, and the orchestrator's group cancels for `workflow_dispatch` regardless of ref, so a manual sweep supersedes on both levels, `main` included. See [configuration.md](../../tools/github/actions/configuration.md) for all repository variables that control CI behaviour. diff --git a/docs/contributing/tools/github/actions/configuration.md b/docs/contributing/tools/github/actions/configuration.md index 0eb6b763b2..e6d8cd29e8 100644 --- a/docs/contributing/tools/github/actions/configuration.md +++ b/docs/contributing/tools/github/actions/configuration.md @@ -15,7 +15,7 @@ Repository variables are set under **Settings → Secrets and variables → Acti ## Cancelling in-progress runs 🛑 -Not a variable: cancellation is keyed on the ref. Every run on a branch other than `main` is cancelled by a newer run in the same concurrency group; runs on `main` are not, because a half-finished pipeline on the default branch is worse than a queued one. The one exception is a manual dispatch, which supersedes everywhere — see below. +Not a variable: cancellation is derived from the trigger. Every automatic run on a branch other than `main` is cancelled by a newer run in the same concurrency group; automatic runs on `main` are not, because a half-finished pipeline on the default branch is worse than a queued one. A manual dispatch always supersedes, `main` included: someone typed it, so it is the intent that counts, not the ref. ```yaml cancel-in-progress: ${{ github.ref_name != 'main' }} @@ -27,7 +27,7 @@ cancel-in-progress: ${{ github.ref_name != 'main' }} [call-orchestrator.yml](../../../../../.github/workflows/call-orchestrator.yml) compares `github.ref` for the same reason: a called workflow inherits the caller's ref, which is `refs/pull//merge` for a `pull_request` caller but `refs/heads/main` for a `pull_request_target` one. The `ci-orchestrator` job of `entry-pr-change-orchestrate.yml` is fenced to `github.event_name == 'pull_request'`, so the ref the orchestrator sees from that caller is always the merge ref; widening that fence would silently put fork runs into main's group. -The manual entry workflow overrides the rule deliberately: its own group is `cancel-in-progress: true`, and it passes `force_cancel_in_progress: true` into the orchestrator, so a manual sweep supersedes a running one even on `main`. +`entry-manual-steer.yml` declares `cancel-in-progress: true` outright on its own group, and the orchestrator reads `github.event_name` — which a called workflow inherits from its caller — so a manual sweep supersedes on both levels without an input to pass down. ## `CI_SYNC_MAIN_SOURCE_REPOSITORY` 🔄