Skip to content

ci: keep ineligible runs out of the review concurrency group - #2348

Merged
heskew merged 2 commits into
mainfrom
review-concurrency-eligibility
Aug 26, 2026
Merged

ci: keep ineligible runs out of the review concurrency group#2348
heskew merged 2 commits into
mainfrom
review-concurrency-eligibility

Conversation

@heskew

@heskew heskew commented Aug 26, 2026

Copy link
Copy Markdown
Member

What this changes, concretely

Both review callers use a shared concurrency group per PR with cancel-in-progress: true, so a newer run can cancel an in-flight review. GitHub evaluates that cancellation when the new run is queued — before any job if: runs. That means an event that was never going to produce a review could still kill one in progress:

  • opt-in mode: any push, or flipping ready without the opt-in label, cancelled a running label-triggered review; the replacement run then skipped, so the requested review silently never completed;
  • both modes: applying an unrelated label (e.g. bug) mid-review did the same — the replacement died at the reusable's exact-label authorize gate.

The fix

The concurrency group key now ends in eligible only for events that would actually produce a review; every other event gets a unique github.run_id suffix, i.e. its own group, so it can never cancel anything. "Would produce a review" means, per caller:

  • the provider's own opt-in label was just applied (labeled + label.name == 'claude-review' / 'gemini-review'), or
  • any non-label event while *_ALWAYS_ON is on, or
  • a draft flipped ready while it carries the opt-in label.

The review job's if: uses the identical predicate (kept textually in sync — Actions YAML has no anchors), so eligible runs both start the review and may supersede an in-flight one, and ineligible runs do neither.

Findings by @kriszyp and the Codex pass on the pin-bump series (harper-pro#766, #2330/#2331); the unrelated-label variant predated this series in always-on mode and is closed by the same change. Full event matrix in the fa04115 commit message.

Merge order: this before #2330/#2331 — the sync PRs carry this fix and must stay byte-identical to main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01S94XethbGXpAb4DRKMD4kt

kriszyp review finding on the pin-bump series: workflow-level
cancel-in-progress fires before job if:, so in opt-in mode an
ineligible event (a push, or a ready-flip without the opt-in label)
cancels an in-flight label-triggered review and then skips — silently
losing the requested review. Ineligible runs now take a unique run_id
group and can never cancel an eligible one; eligible runs keep
cancelling each other (the debounce contract).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94XethbGXpAb4DRKMD4kt
@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.

Comment thread .github/workflows/claude-review.yml Outdated
Review finding (Codex + kriszyp, independently): the eligibility
predicate admitted every labeled event, so in opt-in mode an unrelated
label applied mid-review joined the eligible concurrency group,
cancelled the running review, and the replacement then failed the
reusable's exact-label gate — no completed review. The same
unrelated-label cancellation existed in always-on mode before this
series (any labeled event shared the group and authorize then skipped).

The labeled branch now requires the provider's own label, in both the
concurrency predicate and the review job gate, and unrelated-label
events are ineligible in both modes.

Event matrix (opt-in / always-on):
- labeled(provider label): eligible / eligible — supersedes in-flight
- labeled(other): ineligible / ineligible (was: cancelled + no review)
- synchronize: ineligible / eligible
- ready_for_review + label: eligible / eligible
- ready_for_review, no label: ineligible / eligible
- opened, reopened: ineligible / eligible

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94XethbGXpAb4DRKMD4kt

@kriszyp kriszyp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still not sure what this does, but ok.
🤖 Reviewed with Codex

Comment thread .github/workflows/claude-review.yml Outdated
Comment thread .github/workflows/gemini-review.yml Outdated
@heskew
heskew merged commit d394a71 into main Aug 26, 2026
54 of 57 checks passed
@heskew
heskew deleted the review-concurrency-eligibility branch August 26, 2026 21:08
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