From fc31dd153ee3540602491e2bafbab0a9976fc36c Mon Sep 17 00:00:00 2001 From: yakimoto <66892052+yakimoto@users.noreply.github.com> Date: Mon, 24 Aug 2026 13:15:00 -0400 Subject: [PATCH] fix(pr-agent): discriminate the concurrency group by event and by pr/issue Concurrency is evaluated at WORKFLOW level, before any job `if:`, so a run the reusable lane would skip has already joined the group and evicted whatever was in it. PRs and Issues share one number sequence, so the old key collapsed every event on number N onto one group under cancel-in-progress. Measured across the fleet: 118 of 137 callers carried the undiscriminated key. On claude-workstation, the worst case, that cost 29 success / 1,625 cancelled / 5,735 skipped across 7,389 all-time runs. Both discriminators are load-bearing: `event_name` separates a push-triggered pull_request review from an issue_comment on the same PR, and the pr/issue kind separates issue_comment on PR #N from issue_comment on Issue #N. Proven live on claude-workstation#3617 before this fan-out: pr_agent concluded success with the agent step actually run, not cancelled and not skipped. Refs wave-pen#420, wave-pen#386 --- .github/workflows/pr-agent.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-agent.yml b/.github/workflows/pr-agent.yml index 5d4ce23..e0a91b5 100644 --- a/.github/workflows/pr-agent.yml +++ b/.github/workflows/pr-agent.yml @@ -12,8 +12,18 @@ permissions: pull-requests: write contents: read +# Concurrency is evaluated at WORKFLOW level, before any job `if:` — so a run that +# the reusable lane would skip has already entered this group and evicted whatever +# was in it. PRs and Issues also share ONE number sequence. The group therefore +# needs both discriminators, and neither is redundant: +# - `event_name` keeps a push-triggered `pull_request` review from being +# cancelled by an `issue_comment` on the same PR. +# - the `pr`/`issue` kind keeps `issue_comment` on PR #30 from colliding with +# `issue_comment` on Issue #30, which `event_name` alone does not separate. +# Measured fleet-wide: 118 of 137 callers carried the undiscriminated key +# (wave-pen#386, #420). concurrency: - group: pr-agent-${{ github.event.pull_request.number || github.event.issue.number || github.ref }} + group: pr-agent-${{ github.event_name }}-${{ (github.event.pull_request.number || github.event.issue.pull_request) && 'pr' || 'issue' }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }} cancel-in-progress: true jobs: