Skip to content

claude-code-review: run on Claude-bot pushes#900

Open
d-morrison wants to merge 3 commits into
mainfrom
claude/compassionate-edison-igt5sg
Open

claude-code-review: run on Claude-bot pushes#900
d-morrison wants to merge 3 commits into
mainfrom
claude/compassionate-edison-igt5sg

Conversation

@d-morrison

@d-morrison d-morrison commented Jun 9, 2026

Copy link
Copy Markdown
Owner

What

Make the Claude Code Review workflow (.github/workflows/claude-code-review.yml) run on Claude-bot commits, which it was silently skipping.

Why

The job if: (and the mirrored concurrency.cancel-in-progress expression) skipped every bot-actor push via the generic endsWith(github.actor, '[bot]') / github.event.sender.type == 'Bot' rule. That rule was added to stop other bots' pushes from triggering reviews, but it also excluded Claude's own commits — which are exactly the AI-authored diffs we most want a second pass over.

Inspecting recent Claude-authored commits in this repo, they are committed under:

  • the claude user account (login claude, id 81847, noreply@anthropic.com) — used by Claude Code on the web and the @claude agent, and
  • claude[bot] when a push goes through the Claude GitHub App.

Both forms were being filtered out, so a Claude push to a PR left it stuck on whatever verdict existed before.

Change

Add two clauses to both the job if: and the concurrency.cancel-in-progress expression (kept identical, per the existing in-sync invariant):

|| github.actor == 'claude' || github.actor == 'claude[bot]'

Why this is recursion-safe

The original bot filter existed partly to avoid the self-trigger / frozen-comment loop documented in the concurrency comment (PR #809). Letting Claude-bot pushes through does not reintroduce it:

  • This workflow is review-only — the review step's --disallowedTools "Bash(git commit:*)" … list means the reviewer can never commit, hence never push, hence can never fire a synchronize event that re-triggers itself.
  • The @claude agent's own commits are pushed with GITHUB_TOKEN, which by design does not fire synchronize (claude.yml dispatches this workflow explicitly via workflow_dispatch instead), so those are not double-reviewed.

The load-bearing comments in both spots were updated to explain the exception and the safety argument.

Verification

  • python3 -c "import yaml; ..." parses the workflow and confirms the if: and cancel-in-progress expressions are byte-identical (the comments require them to stay in sync).

Per CLAUDE.md, this is a .github/CI/infra-only change kept in its own dedicated PR (no book content touched).

Known CI note — claude-review check fails on this PR (expected)

The claude-review check fails here with:

App token exchange failed: 401 Unauthorized - Workflow validation failed. The workflow file must exist and have identical content to the version on the repository's default branch. ... this is normal and you should ignore this error.

This is inherent to editing claude-code-review.yml itself, not a defect in this change. anthropics/claude-code-action's OIDC app-token exchange requires the workflow file on the PR branch to be byte-identical to the one on the default branch (a guard against a PR modifying the workflow to exfiltrate the app token). Any PR that touches this workflow trips it. It clears automatically once this merges to main (then branch == default). The fix cannot be applied on the PR without reverting the change.

https://claude.ai/code/session_01ER1dFrUPTjaHeL3n7Yy7qG

The job `if:` and mirrored `concurrency.cancel-in-progress` expression
skipped every bot-actor push (generic `endsWith(actor, '[bot]')` /
`sender.type == 'Bot'` rule). That silently excluded Claude's own
commits: Claude Code on the web and the @claude agent commit as the
`claude` user account, and Claude GitHub App pushes surface as
`claude[bot]` — exactly the AI-authored diffs we most want reviewed.

Add explicit clauses so actor `claude` / `claude[bot]` pushes trigger a
review. Recursion-safe: the reviewer is review-only (the
`--disallowedTools Bash(git commit:*) …` list means it can never commit
or push), so it can never fire a self-triggering `synchronize`; and the
@claude agent pushes via GITHUB_TOKEN, which never fires `synchronize`
(claude.yml dispatches the review explicitly). Both expressions kept in
sync per the existing invariant.
@d-morrison d-morrison marked this pull request as ready for review June 9, 2026 07:46
@d-morrison

Copy link
Copy Markdown
Owner Author

@claude review

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #27191708084. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@d-morrison d-morrison enabled auto-merge June 9, 2026 08:47
@d-morrison d-morrison disabled auto-merge June 9, 2026 08:47
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