Skip to content

ci: cancel superseded pull request runs - #2412

Merged
alexander-akait merged 2 commits into
mainfrom
ci/cancel-outdated-runs
Sep 18, 2026
Merged

alexander-akait merged 2 commits into
mainfrom
ci/cancel-outdated-runs

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

nodejs.yml already cancelled superseded jobs, but through three per-job concurrency groups that also cancel pushes to main, next and hot-middleware. This replaces them with one workflow-level group that only cancels pull request runs.

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Why the branch pushes should not be cancelled

That is the actual bug here. main, next and hot-middleware are built on push, those runs publish coverage, and two merges in quick succession cancel the first one's. A cancelled run also hides a breakage that is already on the branch, which is exactly when you want to know.

Why one workflow-level group rather than fixing the three in place

Adding the condition to the existing blocks would have been a smaller diff, but the per-job arrangement has two other costs:

  • It cancels job by job. Each old job dies only as its replacement is queued; a workflow-level group cancels the whole superseded run at once. This workflow is 14 jobs (12 test cells across three operating systems and four Node.js versions, plus lint and client).
  • Every matrix dimension has to be repeated in the group key. test currently spells out os, node-version and webpack-version; a dimension added later and forgotten would make cells cancel each other, which is a quiet and confusing failure. Keying on the workflow and ref cannot drift.

Happy to switch to the minimal version (keep the per-job groups, just add the condition) if you would rather keep the existing shape.

Verification

actionlint 1.7.7 is clean on all four workflows, and I checked that this means something by typo'ing the expression to github.event_nam, which it catches at exactly that line. The file is also Prettier- and cspell-clean using this repo's own configs.

release.yml is untouched: it already uses concurrency: ${{ github.workflow }}-${{ github.ref }}, whose string form leaves cancel-in-progress false, so releases queue instead of cancelling. dependabot.yml and dependency-review.yml are untouched too — short jobs, and cancelling the Dependabot one halfway could leave a pull request without the auto-merge it was about to enable.

The same change is going to enhanced-resolve (webpack/enhanced-resolve#673) and webpack-dev-server (webpack/webpack-dev-server#5742).

🤖 Generated with Claude Code

https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF


Generated by Claude Code

Summary by CodeRabbit

  • Chores
    • Improved automated workflow run management by grouping runs according to the workflow and branch or reference.
    • Pull request workflow runs now cancel superseded in-progress runs to reduce redundant checks.
    • Other workflow runs, including builds on key branches, continue independently without automatic cancellation.
    • This provides more predictable validation results while avoiding unnecessary duplicate processing.

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF
@changeset-bot

changeset-bot Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9acaad2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 0992afec-30f7-42f5-89a6-8b462b3e0c6e

📥 Commits

Reviewing files that changed from the base of the PR and between f79aba1 and 9acaad2.

📒 Files selected for processing (1)
  • .github/workflows/nodejs.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/nodejs.yml

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


Walkthrough

The GitHub Actions workflow now defines concurrency at the workflow level. Pull-request runs share groups based on the workflow and ref and can be cancelled. Other runs use unique groups based on github.run_id and are not cancelled. The previous job-level concurrency blocks for the lint, test, and client jobs are removed.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 9acaa

Pull requests are superseded as intended, while push runs cannot cancel or evict one another. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #673 requires the development dependency eslint to change from ^7.3.1 to ^7.4.0. The whole-PR diff changes only .github/workflows/nodejs.yml. The reviewed package.json declares `eslint… Update the dependency manifests and lockfile for eslint from the issue's required baseline to ^7.4.0. Run the relevant dependency and verification checks.
Out of Scope Changes check ⚠️ Warning The workflow diff adds workflow-level GitHub Actions concurrency and removes per-job concurrency settings. These changes do not implement or support the eslint dependency update required by issue #6… Remove the workflow concurrency changes from this PR, or link the workflow requirement to an appropriate issue and deliver it separately from #673.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: cancelling superseded pull request runs through CI concurrency configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Linked Issues check

Explanation

Issue #673 requires the development dependency eslint to change from ^7.3.1 to ^7.4.0. The whole-PR diff changes only .github/workflows/nodejs.yml. The reviewed package.json declares eslint as ^9.39.5, so the requested dependency update is not implemented.

Full details: Out of Scope Changes check

Explanation

The workflow diff adds workflow-level GitHub Actions concurrency and removes per-job concurrency settings. These changes do not implement or support the eslint dependency update required by issue #673. The actionlint, Prettier, and cspell results do not establish a connection to that issue.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5651107f-14d8-4425-8f60-3ea679b060c3

📥 Commits

Reviewing files that changed from the base of the PR and between 4f1c3a3 and f79aba1.

📒 Files selected for processing (1)
  • .github/workflows/nodejs.yml

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread .github/workflows/nodejs.yml Outdated
`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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF

Copy link
Copy Markdown
Member Author

Pushed a correction in 9acaad2 before anyone spent time reviewing the first version — the review on the sibling PR (webpack/enhanced-resolve#673) caught a real flaw that this PR had too.

cancel-in-progress: false protects only the run that is already executing. The concurrency group still holds at most one pending run, and GitHub evicts that pending run whenever a newer one enters the group, whatever the flag says — "any existing pending job or workflow in the same concurrency group will be canceled and the new queued job or workflow will take its place."

So keying every run on the ref did not actually deliver what this PR claims. With one main run executing and a second waiting, a third push would have evicted the second — exactly the "two merges in quick succession" case the change exists to protect, and it would have looked correct while failing.

The group is now:

group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Pull requests still group by ref and supersede as described above; every other run gets a group of one and can be neither cancelled nor evicted. actionlint 1.7.7, Prettier and cspell are clean on the result using this repo's own configs.


Generated by Claude Code

@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.04%. Comparing base (4f1c3a3) to head (9acaad2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2412      +/-   ##
==========================================
- Coverage   97.16%   97.04%   -0.13%     
==========================================
  Files          12       12              
  Lines        1660     1660              
==========================================
- Hits         1613     1611       -2     
- Misses         47       49       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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