Skip to content

Cancel superseded PR runs in the test workflows - #7170

Merged
albertvillanova merged 3 commits into
mainfrom
cancel-superseded-test-runs
Sep 11, 2026
Merged

albertvillanova merged 3 commits into
mainfrom
cancel-superseded-test-runs

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Sep 10, 2026

Copy link
Copy Markdown
Member

What does this PR do?

build_pr_documentation.yml cancels a PR's in-flight run when a new commit is pushed to the same branch. tests.yml and tests-experimental.yml do not, so every push to an open PR leaves the previous run occupying runners until it finishes on its own, testing a commit nobody will merge.

Over 2026-08-26 to 2026-09-10, 341 PR runs of tests.yml were superseded by a newer commit on the same branch and kept running anyway. 64 GPU-hours of that was spent after the superseding run had already been created. That capacity is shared, so those runs also sit ahead of other PRs in the queue.

tests.yml books five GPU jobs per run (four on aws-g6e-4xlarge, one on aws-g5-12xlarge-cache), around 77 runner-minutes per full matrix.

This adds the same concurrency block the doc workflow already uses, keyed on the pull request number. github.event.pull_request.number is empty for push events, so the group falls back to the unique github.run_id and pushes to main and to ci-* branches are never cancelled. Only PR runs superseded by a newer commit on the same PR are.

The doc workflow keys on github.head_ref, which is only the branch name and is shared across forks, so two PRs that both use a branch called patch-1 would cancel each other. Bugbot caught that on the first version of this PR. No two open PRs share a head branch name today, but 130 of the 182 open ones come from forks, so the collision is reachable and the PR number costs nothing. build_pr_documentation.yml still carries the head_ref form and could be aligned separately.

The 64 hours is the reclaimable part, not the full 352 hours those runs consumed, and it counts tests.yml only, so the estimate is conservative.

Part of #7169.


Note

Low Risk
CI-only workflow configuration; no application or test logic changes, only earlier termination of obsolete PR runs.

Overview
Adds GitHub Actions concurrency to tests.yml and tests-experimental.yml so an older workflow run is cancelled when a newer commit triggers another run for the same PR.

Each workflow uses group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} with cancel-in-progress: true, matching the pattern already used for PR doc builds. PRs share one group per workflow via the PR number; non–pull-request triggers fall back to run_id, so pushes to main and ci-* are not cancelled by each other.

Reviewed by Cursor Bugbot for commit 4dca50d. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@albertvillanova
albertvillanova force-pushed the cancel-superseded-test-runs branch from b6f8c0a to 5dd210e Compare September 10, 2026 14:06

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5dd210e. Configure here.

Comment thread .github/workflows/tests.yml
@albertvillanova
albertvillanova added this pull request to stack #7173 September 10, 2026 14:13

@qgallouedec qgallouedec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, long due

@albertvillanova
albertvillanova merged commit f622980 into main Sep 11, 2026
9 checks passed
@albertvillanova
albertvillanova deleted the cancel-superseded-test-runs branch September 11, 2026 05:03
@albertvillanova albertvillanova added the 🔧 maintenance CI, tooling, tests, or repo upkeep label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 maintenance CI, tooling, tests, or repo upkeep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants