Skip to content

fix: add concurrency groups to long-running CI workflows#3133

Merged
justin808 merged 2 commits intomainfrom
jg/3129-ci-concurrency-groups
Apr 13, 2026
Merged

fix: add concurrency groups to long-running CI workflows#3133
justin808 merged 2 commits intomainfrom
jg/3129-ci-concurrency-groups

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Apr 13, 2026

Summary

Closes #3129

  • Adds concurrency groups with cancel-in-progress: true to four long-running CI workflows: gem-tests.yml, integration-tests.yml, examples.yml, and playwright.yml
  • When multiple commits push to the same PR branch, stale runs are cancelled automatically, reducing runner pool contention and queue times (~5-10 minutes saved during peak activity)
  • Uses the standard GitHub pattern: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}

Test plan

  • Verify CI passes on this PR
  • Push a second commit to this PR branch while CI is running to confirm old runs get cancelled

🤖 Generated with Claude Code


Note

Low Risk
Low risk workflow-only change that primarily affects CI scheduling; main risk is inadvertently canceling desired parallel runs within the same PR if grouping is too broad.

Overview
Adds workflow-level concurrency to examples.yml, gem-tests.yml, integration-tests.yml, and playwright.yml so that new commits on the same PR cancel prior in-progress runs.

Concurrency grouping keys off the PR number (or falls back to the commit SHA), with cancel-in-progress enabled only for pull_request events to avoid canceling main-branch runs.

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

Summary by CodeRabbit

  • Chores
    • Added workflow concurrency configuration across multiple CI/CD pipelines to automatically cancel redundant runs when new commits are pushed.

Add concurrency groups to gem-tests, integration-tests, examples, and
playwright workflows. When multiple commits push to the same PR branch,
stale runs are now cancelled automatically, reducing runner pool
contention and queue times.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

Walkthrough

Adds concurrency configuration to four GitHub Actions workflow files (examples, gem-tests, integration-tests, and playwright), enabling automatic cancellation of in-progress runs when new commits are pushed to the same branch or pull request, reducing runner pool contention.

Changes

Cohort / File(s) Summary
Workflow Concurrency Configuration
.github/workflows/examples.yml, .github/workflows/gem-tests.yml, .github/workflows/integration-tests.yml, .github/workflows/playwright.yml
Added concurrency group configuration to each workflow, grouping runs by workflow name and branch/ref, with cancel-in-progress: true to automatically cancel earlier in-progress runs when new commits are pushed to the same branch.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Four workflows now heed the call,
No more runners wasting all,
When new commits make their way,
Old runs fade and workflows play,
Concurrency saves the day! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely summarizes the main change—adding concurrency groups to long-running CI workflows to prevent stale runs.
Linked Issues check ✅ Passed All coding requirements from issue #3129 are met: concurrency blocks with the specified group pattern and cancel-in-progress flag were added to all targeted workflows (gem-tests, integration-tests, examples, playwright).
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective of adding concurrency configurations to long-running workflows; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg/3129-ci-concurrency-groups

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 and usage tips.

Comment thread .github/workflows/gem-tests.yml Outdated
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 13, 2026

Greptile Summary

Adds a workflow-level concurrency block to examples.yml, gem-tests.yml, integration-tests.yml, and playwright.yml using the same pattern: PR events group by PR number with cancel-in-progress: true, while push-to-main and workflow_dispatch events group by commit SHA with cancel-in-progress: false, ensuring each main-branch commit keeps its own isolated run.

Confidence Score: 5/5

Safe to merge — workflow-only change with no impact on production code; concurrency logic is correct and consistent across all four files.

All findings are P2 or below. The concurrency pattern correctly scopes PR runs by PR number (with cancellation) and main-branch runs by SHA (without cancellation). The previously raised playwright.yml concern is fully addressed in the current implementation.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/examples.yml Adds workflow-level concurrency block; PR events group by PR number with cancellation, non-PR events group by SHA without cancellation.
.github/workflows/gem-tests.yml Adds identical concurrency block; same correct pattern applied consistently.
.github/workflows/integration-tests.yml Adds identical concurrency block; SHA-based cache keys in matrix jobs are unaffected by cancellation semantics.
.github/workflows/playwright.yml Adds concurrency block; no pull_request trigger means cancel-in-progress is always false and group is always SHA-based, giving each main-branch commit an isolated run — the previously raised concern is correctly resolved.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Workflow triggered] --> B{Event type?}
    B -->|pull_request| C["group = '{workflow}-pr-{pr_number}'"]
    B -->|push to main / workflow_dispatch| D["group = '{workflow}-{sha}'"]
    C --> E["cancel-in-progress: true"]
    D --> F["cancel-in-progress: false"]
    E --> G[New commit cancels prior PR run]
    F --> H[Each commit gets isolated run, no cancellation]
Loading

Reviews (2): Last reviewed commit: "fix: use PR-number concurrency groups an..." | Re-trigger Greptile

Comment thread .github/workflows/playwright.yml Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef2222e114

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/gem-tests.yml Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 13, 2026

Review: Add concurrency groups to CI workflows

Overall this is a solid, low-risk improvement using the standard GitHub pattern. Adding concurrency cancellation to the three workflows that also run on pull_request (gem-tests.yml, integration-tests.yml, examples.yml) is a clear win — PR branches get stale-run cancellation, and even if main push runs cancel each other, CI was already verified at the PR level.

One concern worth addressing — playwright.yml:

Unlike the other three workflows, playwright.yml only triggers on push to main (not on pull_request). This makes it the sole per-commit verification for Playwright tests. With the current cancel-in-progress: true and a shared concurrency key based on github.ref, two merges to main in quick succession will cause the first commit's Playwright run to be cancelled — leaving it permanently unverified.

The fix is to use github.sha as the group key so each commit on main gets its own isolated run:

concurrency:
  group: ${{ github.workflow }}-${{ github.sha }}
  cancel-in-progress: true  # still cancels duplicate workflow_dispatch re-runs of the same SHA

See the inline comment for the specific change. The other three files look good as-is.

Comment thread .github/workflows/playwright.yml Outdated
- Use github.event.pull_request.number for concurrency group key instead
  of github.head_ref, preventing cross-fork collisions when two PRs share
  the same branch name (e.g. patch-1)
- Fall back to github.sha for non-PR events so each main push gets its
  own isolated run
- Only cancel in-progress runs for pull_request events, matching the
  pattern already used in benchmark.yml — main branch runs are never
  cancelled so every merge commit is verified

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@justin808
Copy link
Copy Markdown
Member Author

Review feedback addressed in b33ddc6

All review comments have been addressed with a single commit that updates the concurrency configuration in all four workflows.

Changes made

1. Main branch runs are no longer cancelled (raised by @cursor[bot], @greptile-apps[bot], @claude[bot])

  • Changed cancel-in-progress: true to cancel-in-progress: ${{ github.event_name == 'pull_request' }}
  • Main branch pushes now always run to completion, matching the pattern already used in benchmark.yml
  • Especially important for playwright.yml which only runs on main pushes

2. Fork-safe concurrency group keys (raised by @chatgpt-codex-connector[bot])

  • Replaced github.head_ref || github.ref with github.event.pull_request.number (PR number, unique per PR) with github.sha fallback for non-PR events
  • Two fork PRs with the same branch name (e.g. patch-1) no longer cancel each other's CI runs

Concurrency behavior after this change

Event Group key Cancel in-progress?
Pull request workflow-pr-{number} Yes
Push to main workflow-{sha} No
workflow_dispatch workflow-{sha} No

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because on-demand usage is turned off. To enable Bugbot Autofix, turn on on-demand usage and set a spend limit in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b33ddc6. Configure here.

Comment thread .github/workflows/playwright.yml
Comment thread .github/workflows/playwright.yml
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 13, 2026

Review

The approach is correct and safe. A few things worth noting:

The concurrency expression works as intended

group: ${{ github.event.pull_request.number && format('{0}-pr-{1}', github.workflow, github.event.pull_request.number) || format('{0}-{1}', github.workflow, github.sha) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
  • On PR events: groups by {workflow}-pr-{number} → new commits cancel stale runs for the same PR ✓
  • On push to main or workflow_dispatch: groups by {workflow}-{sha} (unique per commit) + cancel-in-progress: false → runs on main are never cancelled ✓
  • No cross-workflow collisions since each workflow has a unique name in the group key ✓

playwright.yml concurrency block is a no-op

playwright.yml only triggers on push: branches: [main] and workflow_dispatch, never on pull_request. This means the concurrency block never groups or cancels anything there. See inline comment. Not a blocker, but worth clarifying intent.

Other PR-triggering workflows were skipped

lint-js-and-ruby.yml and package-js-tests.yml both run on PRs but weren't covered. These are presumably shorter-running than the four targeted here, but they'd benefit from the same treatment if there's queue contention on those too.

PR description vs. implementation

The description says "Uses the standard GitHub pattern: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}" but the actual implementation uses PR number + SHA fallback — which is a better approach (avoids ambiguity with branch names containing slashes, more explicit about main-branch protection). Minor nit: the description could be updated to match the actual pattern used.

@justin808 justin808 merged commit e7aef5c into main Apr 13, 2026
54 checks passed
@justin808 justin808 deleted the jg/3129-ci-concurrency-groups branch April 13, 2026 06:37
justin808 added a commit that referenced this pull request Apr 18, 2026
…ages

* origin/main:
  Fix initial page startup race for late-loading client bundles (#3151)
  chore: apply prettier formatting to tracked docs files (#3153)
  docs: comprehensive RSC API documentation and registration consolidation (#3140)
  Split rspec-package-tests into parallel generator/unit shards (#3134)
  fix: add concurrency groups to long-running CI workflows (#3133)
  refactor: add RenderRequest, JsCodeBuilder, and RenderingStrategy abstractions (#3094)
  fix: address deferred review items from PR #2849 (#3093)
  Add complimentary OSS license policy for React on Rails Pro (#3123)
  fix: centralize CI docs-only detection and add CLI flag validation (#3091)
  refactor: replace stub-throw + Object.assign with capability-based composition (#3096)
  Enhance address-review with parallel fixes, self-review, and Greptile verification (#3121)
  fix: Doctor no longer fails custom projects for missing bin/dev (#3117)
  fix: cap webpack <5.106.0 to prevent ExecJS SSR breakage (#3095)
  Add Rspack + RSC compatibility tests and documentation (#1828) (#3120)
  Add error scenarios hub and test pages (#2497)
  docs: document polyfill requirements for web-targeted server bundles (#3092)
  docs: RSC integration pitfalls from tutorial app (#3087)
  docs: fix render function/helper API documentation (#3088)
  Doctor: accept TS/TSX server bundle suffixes (#3111)
  feat: add CI guard requiring sidebar updates when adding docs (#3089)
justin808 added a commit that referenced this pull request Apr 18, 2026
## Summary

Closes #3129

- Adds `concurrency` groups with `cancel-in-progress: true` to four
long-running CI workflows: `gem-tests.yml`, `integration-tests.yml`,
`examples.yml`, and `playwright.yml`
- When multiple commits push to the same PR branch, stale runs are
cancelled automatically, reducing runner pool contention and queue times
(~5-10 minutes saved during peak activity)
- Uses the standard GitHub pattern: `group: ${{ github.workflow }}-${{
github.head_ref || github.ref }}`

## Test plan

- [ ] Verify CI passes on this PR
- [ ] Push a second commit to this PR branch while CI is running to
confirm old runs get cancelled

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk workflow-only change that primarily affects CI scheduling;
main risk is inadvertently canceling desired parallel runs within the
same PR if grouping is too broad.
> 
> **Overview**
> Adds **workflow-level `concurrency`** to `examples.yml`,
`gem-tests.yml`, `integration-tests.yml`, and `playwright.yml` so that
**new commits on the same PR cancel prior in-progress runs**.
> 
> Concurrency grouping keys off the PR number (or falls back to the
commit SHA), with `cancel-in-progress` enabled only for `pull_request`
events to avoid canceling main-branch runs.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b33ddc6. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Added workflow concurrency configuration across multiple CI/CD
pipelines to automatically cancel redundant runs when new commits are
pushed.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
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.

Add concurrency groups to gem-tests CI workflow

1 participant