Skip to content

Stop @claude review from cancelling itself - #5

Merged
mbloechli merged 4 commits into
mainfrom
fix-claude-review-self-cancel
Aug 5, 2026
Merged

Stop @claude review from cancelling itself#5
mbloechli merged 4 commits into
mainfrom
fix-claude-review-self-cancel

Conversation

@mbloechli

@mbloechli mbloechli commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@claude review has never actually completed: it starts, then kills itself ~30s in. First observed on Duatic/duatic_duarover_autonomy#43.

What happens

Time Event
16:03:16 mbloechli comments @claude review
16:03:24 run 31023403141 created (actor mbloechli), job starts 16:03:37
16:03:47 claude[bot] posts its "Reviewing PR #43" progress comment
16:03:52 run 31023440710 created (actor claude[bot]), job correctly skipped
16:04:28 run 31023403141 cancelled

Fix

Filter for new comments, that aren't calling the workflow to be executed before checking for concurrency

Claude's progress comment fires issue_comment a second time - it's posted
with the Claude App's installation token, and GitHub only suppresses
re-triggering for a workflow's own GITHUB_TOKEN. Because concurrency is
evaluated at run level, before the job's if:, that second run joined the
same per-PR group and cancel-in-progress killed the real review ~30s in,
before the job guard ever got to skip it. Observed on
Duatic/duatic_duarover_autonomy#43: run 31023403141 cancelled at 16:04:28,
36s after starting, by the skipped run 31023440710.

Only genuine requests now share the per-PR concurrency group; anything else
keys on the unique run id, so it cannot cancel a review in flight. Two real
requests on one PR still supersede each other. Also reject Bot comment
authors in the job guard, which forecloses a loop if Claude ever opens a
comment with the trigger phrase.
Passing github_token short-circuits the action's OIDC-to-App-token exchange
(src/github/token.ts returns OVERRIDE_GITHUB_TOKEN immediately), so Claude's
progress comment is made with the workflow's own GITHUB_TOKEN. GitHub does
not re-trigger workflows for events caused by GITHUB_TOKEN, so that comment
no longer starts a second run of this workflow on every review.

Reviews now post as github-actions[bot] instead of claude[bot], which is the
whole cost of the change.

The concurrency hardening stays, and is not redundant: issue_comment fires
for every comment on a PR, so an unrelated comment during a review still
starts a run, and concurrency is evaluated before the job's if:. Keyed on
the PR alone, a colleague posting 'LGTM' mid-review would cancel it.
Passing GITHUB_TOKEN removed one skipped run per review, but skipped runs
appear regardless - issue_comment fires for every comment on a PR and cannot
filter on text - so it bought little. The costs were real: reviews would post
as github-actions[bot], and a future fix mode's commits would not trigger CI,
since GitHub suppresses workflow runs for commits made with GITHUB_TOKEN.

The concurrency fix is what actually stops the self-cancellation, and it
covers Claude's progress comment and unrelated PR comments alike.
@mbloechli mbloechli self-assigned this Aug 5, 2026
@mbloechli
mbloechli merged commit 0c95265 into main Aug 5, 2026
1 check passed
@mbloechli
mbloechli deleted the fix-claude-review-self-cancel branch August 5, 2026 16:36
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