Skip to content

chore(ci): add concurrency control to all workflows#133

Merged
avrabe merged 3 commits into
mainfrom
chore/ci-concurrency-control
May 3, 2026
Merged

chore(ci): add concurrency control to all workflows#133
avrabe merged 3 commits into
mainfrom
chore/ci-concurrency-control

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 2, 2026

Summary

Adds a top-level concurrency: block to every .github/workflows/*.yml, per the org-wide CI Concurrency Hardening brief. Cancels superseded PR runs; never cancels runs on main, tags, releases, or scheduled events.

Classification

File Variant Notes
ci.yml default cancel-in-progress conditional on pull_request
bench.yml default same as ci.yml
fuzz.yml default same as ci.yml
fixtures.yml scheduled unique group per run_id; never cancel (each weekly run is independent data)
release.yml release group by ref; never cancel (mid-publish cancellation would leave registry / tag / attestation state inconsistent)

Note on the brief's head_ref pattern

The brief's canonical default pattern is ${{ github.workflow }}-${{ github.head_ref || github.ref }}. The repo's pre-commit hook flags any expression referencing github.head_ref as a workflow-injection risk (it's in the documented risky-inputs list).

This PR uses github.ref alone, which:

  • Is NOT in the hook's risky-inputs list.
  • Is unique per branch (refs/heads/<name>) and per PR (refs/pull/<N>/merge).
  • Produces equivalent grouping for both push and pull_request events.
  • Combined with the conditional cancel-in-progress: ${{ github.event_name == 'pull_request' }}, still delivers the brief's stated behavior: cancel superseded PR runs, preserve main / tag / schedule / dispatch runs.

Verification plan (per brief §"Verification")

  • yamllint (via python -c yaml.safe_load) — clean on all 5 files
  • PR's own CI run passes
  • Push a no-op follow-up commit; earlier PR run shows as Cancelled within ~30s
  • Post-merge main run completes normally (not cancelled)

Out of scope

Per the brief: runner migration, job parallelization, cache strategy changes, permission minimization. Each tracked separately.

avrabe and others added 3 commits May 2, 2026 15:18
Adds a top-level `concurrency:` block to every workflow file, per the
org-wide CI Concurrency Hardening brief. Cancels superseded PR runs;
never cancels runs on `main`, tags, releases, or scheduled events.

Classification per workflow:

* ci.yml, bench.yml, fuzz.yml — default variant (cancel-in-progress
  conditional on pull_request event_name)
* fixtures.yml — scheduled variant (unique group per run via run_id;
  cancel-in-progress: false). Each weekly fixture run is independent
  data and must complete.
* release.yml — release variant (group by ref, cancel-in-progress:
  false). A cancelled release mid-publish would leave registry / tag
  / attestation state inconsistent.

Note: the brief's canonical pattern is `${{ github.head_ref ||
github.ref }}`. The repo's pre-commit hook flags any expression
referencing `github.head_ref` as a workflow-injection risk. Since
`github.ref` alone is unique per branch (refs/heads/<name>) and per PR
(refs/pull/<N>/merge), and is NOT in the hook's risky-inputs list, we
use `github.ref` here. Grouping is equivalent for both push and
pull_request event types, and the conditional `cancel-in-progress`
still cancels superseded PR runs while preserving main / tag /
schedule / dispatch runs.

Expected effect locally: 30-40% reduction in CI compute and clearing
of any queued superseded jobs once an agent or developer pushes
multiple commits to a PR within minutes.

Out of scope: runner migration, job parallelization, cache strategy
changes, Lean proof splitting, permission minimization (separate
follow-up tickets).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 205b44a into main May 3, 2026
9 checks passed
@avrabe avrabe deleted the chore/ci-concurrency-control branch May 3, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant