Skip to content

fix(ci): claude bot's own comment shouldn't cancel its in-flight review#111

Merged
EricAndrechek merged 1 commit into
mainfrom
claude-review-bot-cancel
May 12, 2026
Merged

fix(ci): claude bot's own comment shouldn't cancel its in-flight review#111
EricAndrechek merged 1 commit into
mainfrom
claude-review-bot-cancel

Conversation

@EricAndrechek

Copy link
Copy Markdown
Member

What's happening

When Claude review runs on a PR push, it ends by posting a sticky review comment. That comment fires an issue_comment created webhook, which re-fires the Claude PR review workflow. The new run is in the same concurrency group as the still-in-flight pull_request run, so cancel-in-progress: true cancels the original — while it's still finalising the comment it just posted. The new run then evaluates the job-level if: (comment body doesn't contain @claude or /review) and skips, but the damage is done: the original run shows as cancelled on the PR and any post-comment cleanup the action wanted to do gets cut.

Observed on PR #7:

  • 25736516663 (pull_request, 13:08:39) → cancelled
  • 25736559325 (issue_comment, 13:09:26) → skipped (no @claude//review match)

Fix

Make cancel-in-progress an expression: ${{ github.event.sender.type != 'Bot' }}.

  • Human pushes a new commit or types /reviewsender.type == 'User'cancel-in-progress: true → stale run cancelled, same as before.
  • Claude (or any other Bot account) triggers an issue_commentsender.type == 'Bot'cancel-in-progress: false → the in-flight run finishes; the bot-triggered run still gets filtered out at the job-level if: and skips harmlessly.

Test plan

  • Push a commit to a PR → Claude review runs to completion and the run shows as success (not cancelled).
  • Push two commits in quick succession → second push cancels the first run as before (human → human).
  • Manually type /review while a review is in progress → still cancels (intended — user explicitly asked).

🤖 Generated with Claude Code

`cancel-in-progress: true` meant the issue_comment fired by Claude
posting its sticky review comment cancelled the still-running
pull_request workflow that posted it. The new run gets filtered out
at the job-level `if:` (comment isn't @claude or /review) so it
skips, but only after taking out its parent run on the way in.

Make cancel-in-progress conditional on the new event's sender not
being a Bot. Human pushes / human /review comments still cancel
stale runs as before; Claude's bot comment (or any other bot
comment that would have been filtered anyway) now lets the in-flight
run complete.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@github-actions github-actions Bot added github_actions Pull requests that update GitHub Actions code area/infra CI, build, deploy, Docker, release labels May 12, 2026
@EricAndrechek EricAndrechek merged commit c7c3ef3 into main May 12, 2026
5 of 7 checks passed
@EricAndrechek EricAndrechek deleted the claude-review-bot-cancel branch May 12, 2026 13:23
EricAndrechek added a commit that referenced this pull request May 12, 2026
## Two related noise sources

Both produce red workflow runs on PR pushes that don't reflect actual
problems and were flooding the inbox.

### 1. `claude-review.yml` failing on PRs that edit Claude's own files

The Anthropic action runs a self-validation step that fails when its own
workflow file (`.github/workflows/claude-review.yml`) or the prompt
template (`.github/prompts/pr-review.md`) is in the PR's diff. Every PR
touching Claude's wiring (#105, #108, #109, #110, #111, #113, the merge
commit of #115) has logged a noisy red Claude check that resolves itself
once the change merges.

**Fix:** in `claude-review.yml`'s gate step, query the PR's changed
files; if either path is in the diff, set `skip=true` and exit 0. The
check shows success, the action never runs, the change still takes
effect on the next PR's review.

### 2. `dependabot-automerge.yml push failure` ghost runs on every
branch push

#115 added `reviewers: ${{ replace(env.ADMINS, ',', ' ') }}` to convert
the comma-separated `ADMINS` env var to the space-separated form the
composite expects. Problem: `replace()` isn't a GitHub Actions
expression function. The valid list is `contains`, `startsWith`,
`endsWith`, `format`, `join`, `toJSON`, `fromJSON`, `hashFiles`, plus
status checks. An unknown function fails workflow validation, and GitHub
records a failed run with the file path (not the workflow's `name:`) as
the display name and no jobs — every push to any branch since #115
merged.

**Fix:** replace the bad expression with a real bash step that uses
parameter expansion (`${ADMINS//,/ }`) to write `ADMINS_SPACE` to
`$GITHUB_ENV`. The composite's `with:` then references
`env.ADMINS_SPACE`. Both steps gated on `update-type ==
version-update:semver-major` so they only run when actually needed.

## Test plan

- [ ] This PR's own Claude check: success (skip-gate catches the
self-modification).
- [ ] After merge, branch pushes no longer trigger the ghost
`.github/workflows/dependabot-automerge.yml push failure` runs.
- [ ] Next major-version Dependabot PR: both admins assigned correctly
via `ADMINS_SPACE`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra CI, build, deploy, Docker, release github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant