Skip to content

fix(examples): add concurrency groups to PR review workflows#969

Open
odysseus0 wants to merge 1 commit intoanthropics:mainfrom
odysseus0:fix/add-concurrency-and-timeout-to-pr-review-examples
Open

fix(examples): add concurrency groups to PR review workflows#969
odysseus0 wants to merge 1 commit intoanthropics:mainfrom
odysseus0:fix/add-concurrency-and-timeout-to-pr-review-examples

Conversation

@odysseus0
Copy link

Problem

Every PR review example in this repo is missing a concurrency group. Without it, every push to an open PR starts a new review job without cancelling the previous one.

On an active branch this causes a pile-up of concurrent jobs that all share the same API token. This leads to rate limiting, and since there's no timeout either, jobs hang indefinitely until GitHub's 6-hour job limit kills them.

Fix

Add a concurrency block with cancel-in-progress: true to all PR-triggered workflow examples:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
  cancel-in-progress: true

Files changed:

  • examples/pr-review-comprehensive.yml
  • examples/pr-review-filtered-authors.yml
  • examples/pr-review-filtered-paths.yml
  • docs/solutions.md — all 7 inline PR review YAML blocks + a note in Best Practices

Why cancel-in-progress: true is almost always correct for PR reviews

A PR review is always reviewing the latest commit. If a new push comes in while a review is running, that review is already stale — there's no value in letting it finish. Cancelling it immediately frees the runner and the API token for the review that actually matters.

🤖 Generated with Claude Code

Without a concurrency group, every push to an open PR starts a new review
job without cancelling the previous one. On an active branch this causes a
pile-up of concurrent jobs all sharing the same API token, leading to rate
limiting and jobs that hang indefinitely until GitHub's 6-hour job limit.

Add `concurrency.cancel-in-progress: true` (grouped by workflow + PR number)
to all three PR review example files and all seven PR review blocks in
docs/solutions.md. Also document the footgun in the Best Practices section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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