Skip to content

fix(ci): change concurrency group to per-SHA to prevent HEAD commits from missing CI runs #246

Closed

Description

@don-petry

Problem

When the Claude Code agent (or any automation) pushes multiple commits to a branch in rapid succession, required CI checks frequently never run on the HEAD commit. The PR shows "Pending Checks" indefinitely and becomes unmergeable without manual intervention (close/reopen).

Root Cause

Two factors combine:

  1. cancel-in-progress: true on a per-ref concurrency group — Each new push cancels the in-flight CI run for the previous commit. If the final commit is pushed while an earlier run is mid-cancellation, GitHub may not fire a new pull_request: synchronize event (or the event is dropped), leaving the HEAD commit with no CI run.

  2. GitHub does not retroactively run required checks — Once a commit becomes the PR HEAD with no CI results attached, the checks show as "pending" forever. There is no automatic retry.

This has been observed across all 8 repos in the petry-projects org — 146+ PRs were blocked simultaneously requiring manual close/reopen to re-trigger CI.

The pattern that triggers the issue (currently in every CI workflow in the org):

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

Solution

Change the concurrency group to include the commit SHA, giving each commit its own slot so CI always runs to completion:

concurrency:
  group: ci-${{ github.ref }}-${{ github.sha }}
  cancel-in-progress: true

This ensures:

  • Every HEAD commit always gets a CI run
  • Concurrent runs on the same branch are still bounded (one run per commit, not unbounded)
  • cancel-in-progress: true becomes a no-op in practice (no two pushes share the same SHA), which is the desired behavior

Scope

Apply to all CI workflow files across the org that use the ci-${{ github.ref }} concurrency pattern. The claude-code-reusable.yml concurrency groups (claude-review-comments-*, claude-ci-fix-*, claude-issue-*) are intentional per-PR/per-SHA groupings and should not be changed.

References

Activity

  1. don-petry commented on May 12, 2026

    @don-petry
    ContributorAuthor

    Claude finished @don-petry's task in 4m 5s —— View job • claude/issue-246-20260512-0059 • [Create PR ➔](https://github.com/petry-projects/.github/compare/main...claude/issue-246-20260512-0059?quick_pull=1&title=Issue%20%23246%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23246%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Fixing CI Concurrency Group Pattern

    • Gather context (read AGENTS.md and CI standards)
    • Find all workflow files with problematic concurrency pattern
      • .github/workflows/ci.yml — ci-${{ github.ref }} → fixed
      • .github/workflows/feature-ideation-tests.yml — feature-ideation-tests-${{ github.ref }} → fixed
      • standards/ci-standards.md — documents the old pattern → updated
      • All other concurrency groups (auto-rebase, dependabot-update-and-merge, feature-ideation, claude-*, compliance-audit) are intentional and unchanged
    • Apply fix to ci.yml
    • Apply fix to feature-ideation-tests.yml
    • Update standards/ci-standards.md
    • Commit and push changes
    • Create PR — #247
    • Self-review — diff is 3 one-line changes, no scope creep, claude-code-reusable.yml and all single-instance groups correctly excluded

    CI Status (PR #247) — mostly green ✓

    Check Result
    Lint ✅ SUCCESS
    ShellCheck ✅ SUCCESS
    Agent Security Scan ✅ SUCCESS
    Feature Ideation Tests ✅ SUCCESS
    SonarCloud ✅ SUCCESS
    Dependency audit ✅ SUCCESS
    AgentShield ✅ SUCCESS
    CodeRabbit ✅ SUCCESS
    CodeQL ⏳ In progress

    No CODEOWNERS file found — @don-petry please review and merge PR #247 once CodeQL completes.
    | View PR #247

  2. don-petry commented on May 12, 2026

    @don-petry
    ContributorAuthor

    Ensure this is defined and compliance enforced as a standard in .github

  3. added a commit that references this issue on May 13, 2026
    803cc69
  4. added 5 commits that reference this issue on Jun 8, 2026
    77dce10
    9249638
    9dd2dbc
    8780a6c
    338e028
  5. added a commit that references this issue on Aug 7, 2026
    279d390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions