Skip to content

Fix concurrency bug in Claude Code review workflow#7732

Merged
adamsachs merged 1 commit intomainfrom
fix/claude-review-concurrency
Mar 23, 2026
Merged

Fix concurrency bug in Claude Code review workflow#7732
adamsachs merged 1 commit intomainfrom
fix/claude-review-concurrency

Conversation

@adamsachs
Copy link
Copy Markdown
Contributor

Description Of Changes

Move the concurrency group from workflow-level to job-level in the Claude Code review workflow. This fixes a race condition where unrelated PR comments (that don't contain /code-review) would cancel an in-progress review.

The bug: Any issue_comment event on a PR triggers the workflow, which enters the concurrency group and cancels the running review job. The new run then evaluates the job's if condition, finds the comment doesn't match, and skips — leaving no review running.

The fix: A job whose if evaluates to false is skipped entirely and never enters the concurrency group, so it can't cancel anything. Moving concurrency from workflow-level to job-level is all that's needed.

Event Job if Concurrency group Effect
PR opened (non-draft) true Enters group, cancels prior run Runs review
Random comment on PR false Job skipped, never enters group No cancellation
/code-review comment true Enters group, cancels prior run Runs review

Code Changes

  • .github/workflows/claude-code-review.yml - Move concurrency block from workflow-level into the claude-review job

Steps to Confirm

  1. Open a PR to trigger the Claude Code review workflow
  2. While the review is running, post an unrelated comment on the PR
  3. Verify the in-progress review is not cancelled by the unrelated comment
  4. Post a /code-review comment and verify it does cancel and restart the review

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • No UX review needed
  • Followup issues:
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

Move the concurrency group from workflow-level to job-level so that
unrelated PR comments (which trigger `issue_comment` but fail the job's
`if` filter) don't cancel an in-progress review. A skipped job never
enters the concurrency group, preventing false cancellations.
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Mar 23, 2026 7:34pm
fides-privacy-center Ignored Ignored Mar 23, 2026 7:34pm

Request Review

@adamsachs adamsachs marked this pull request as ready for review March 23, 2026 19:35
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 23, 2026

Greptile Summary

This PR fixes a concurrency race condition in the Claude Code review workflow by moving the concurrency block from workflow-level to job-level. The root cause was that any issue_comment event (even unrelated ones) would enter the workflow-level concurrency group and cancel an in-progress review before the job's if condition could gate execution.

  • Root cause correctly identified: At workflow-level, concurrency group entry happens before if evaluation; at job-level, a skipped job (if: false) never enters the group.
  • Fix is minimal and correct: The single structural change — moving concurrency under the claude-review job — is the appropriate remedy with no side effects.
  • Concurrency group expression preserved: ${{ github.event.pull_request.number || github.event.issue.number }} continues to work correctly for both pull_request and issue_comment event types, as it did before.
  • Cancel-in-progress semantics unchanged: Intentional triggers (/code-review comments or PR opens/reopens) still correctly cancel and restart a prior review within the same PR.

Confidence Score: 5/5

  • Safe to merge — minimal, well-reasoned workflow fix with no logic regressions.
  • The change is a single structural move of 3 YAML lines. The fix is mechanically correct: job-level concurrency is only entered when the job actually executes (i.e., the if condition is true), so unrelated comments can no longer cancel a running review. No new logic is introduced and existing trigger/permission/step behaviour is entirely unchanged.
  • No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/claude-code-review.yml Moves the concurrency block from workflow-level to job-level, correctly preventing unrelated issue_comment events from cancelling an in-progress review job.

Reviews (1): Last reviewed commit: "Fix concurrency bug in Claude Code revie..." | Re-trigger Greptile

@adamsachs adamsachs added this pull request to the merge queue Mar 23, 2026
Merged via the queue into main with commit 5279a17 Mar 23, 2026
42 of 44 checks passed
@adamsachs adamsachs deleted the fix/claude-review-concurrency branch March 23, 2026 20:04
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.

2 participants