Skip to content

fix(ci): key main concurrency on commit SHA so every commit runs - #1767

Merged
slin1237 merged 1 commit into
mainfrom
fix/ci-main-concurrency-per-commit
Jun 17, 2026
Merged

slin1237 merged 1 commit into
mainfrom
fix/ci-main-concurrency-per-commit

Conversation

@key4ng

@key4ng key4ng commented Jun 17, 2026 •

Copy link
Copy Markdown
Member

Description

Problem

CI runs for commits on main were being cancelled. On push to main, the concurrency group resolved to a single shared group keyed on github.ref_name (always main):

group: gateway-tests-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}

GitHub Actions allows only one in-progress + one pending run per concurrency group. When commits land on main faster than CI completes, each new push supersedes and cancels the previously-pending run before it can finish. This was observed in a recent burst of four commits within ~2 minutes — three runs were cancelled in 25–49s and only the latest survived.

Solution

Key the push-to-main case on github.sha instead of github.ref_name, so each commit on main gets its own concurrency group and always runs to completion. PR behavior is unchanged: per-PR group with cancel-in-progress so superseded PR runs are still dropped to save CI resources.

Changes

  • pr-test-rust.yml (PR Test (SMG)) — push-to-main concurrency group now keys on github.sha.
  • pr-test-mlx.yml (PR Test (MLX)) — same fix for the identical pattern (consistency).

cancel-pr-workflows.yml keys cleanup on the per-PR groups, which are unchanged, so PR-close cleanup is unaffected.

Test Plan

  • Trigger: push multiple commits to main in quick succession.
  • Before: only the latest commit's run survives; earlier runs cancelled within seconds.
  • After: each commit on main runs to completion in its own concurrency group.
  • PR runs still cancel superseded runs on new pushes (per-PR group + cancel-in-progress).

Trade-off: every main commit now runs full CI in parallel, increasing concurrent runner usage during rapid merge bursts. This is the intended behavior.

Checklist
  • cargo +nightly fmt passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • (Optional) Documentation updated
  • (Optional) Please join us on Slack #sig-smg to discuss, review, and merge PRs

Summary by CodeRabbit

  • Chores
    • Improved CI/CD pipeline concurrency handling for test workflows to optimize test execution and resource utilization across push events and pull requests.

On push to main the concurrency group resolved to a single shared
group keyed on github.ref_name (always 'main'). GitHub Actions keeps
only one in-progress + one pending run per group, so rapid commits to
main supersede and cancel the previously-pending run before it can
finish.

Key the push-to-main case on github.sha instead, giving each commit
its own group so it always runs to completion. PR behavior is
unchanged: per-PR group with cancel-in-progress to drop superseded
runs. Applied to both PR Test (SMG) and PR Test (MLX).

Signed-off-by: key4ng <rukeyang@gmail.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3dd48460-2b0f-4649-9ef5-b06da27d541b

📥 Commits

Reviewing files that changed from the base of the PR and between 6ac222f and c46173d.

📒 Files selected for processing (2)
  • .github/workflows/pr-test-mlx.yml
  • .github/workflows/pr-test-rust.yml

📝 Walkthrough

Walkthrough

Two GitHub Actions workflow files (pr-test-mlx.yml and pr-test-rust.yml) update their concurrency.group expression to use github.sha instead of github.ref_name for non-pull-request (push) events. Pull request events continue to group by PR number.

Changes

CI Concurrency Group Key Update

Layer / File(s) Summary
Per-commit SHA concurrency grouping
.github/workflows/pr-test-mlx.yml, .github/workflows/pr-test-rust.yml
Both workflows replace github.ref_name with github.sha in the concurrency.group ternary expression for push events, so each commit to main gets a unique concurrency group and is not cancelled by subsequent pushes. PR-triggered runs retain per-PR-number grouping. Inline comments are added in the MLX workflow describing the cancellation semantics.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • lightseekorg/smg#678: Modifies pr-test-rust.yml concurrency settings, directly overlapping with the same concurrency.group and cancel-in-progress fields changed here.
  • lightseekorg/smg#1530: Changes concurrency.group and cancel-in-progress logic in both pr-test-mlx.yml and pr-test-rust.yml, the same two files modified in this PR.
  • lightseekorg/smg#1536: Also modifies concurrency grouping and cancellation configuration in both pr-test-mlx.yml and pr-test-rust.yml.

Suggested labels

ci

Suggested reviewers

  • CatherineSue
  • XinyueZhang369
  • slin1237
  • claude

Poem

🐇 Hoppity-hop through the workflow lanes,
Each commit now runs on its very own chains!
No SHA gets stomped by a sibling ahead,
The main branch's jobs no longer get shred.
Every push lands safe — no cancellation dread! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: updating CI concurrency configuration to key on commit SHA instead of ref name for main branch pushes, ensuring each commit runs independently rather than being cancelled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-main-concurrency-per-commit

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

@github-actions github-actions Bot added the ci CI/CD configuration changes label Jun 17, 2026

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

Looks good — the fix correctly gives each main-branch commit its own concurrency group by keying on github.sha instead of github.ref_name. Both affected workflows are updated consistently, PR cancellation behavior is unchanged, and no other workflows had this pattern.

@slin1237
slin1237 merged commit cac6755 into main Jun 17, 2026
46 checks passed
@slin1237
slin1237 deleted the fix/ci-main-concurrency-per-commit branch June 17, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD configuration changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants