Skip to content

Fix Claude Code Review workflow comment tooling#431

Merged
justin808 merged 1 commit intomasterfrom
codex/fix-claude-code-review-tools-20260219
Feb 19, 2026
Merged

Fix Claude Code Review workflow comment tooling#431
justin808 merged 1 commit intomasterfrom
codex/fix-claude-code-review-tools-20260219

Conversation

@justin808
Copy link
Member

@justin808 justin808 commented Feb 19, 2026

This ports the Claude Code review workflow fix from shakacode/hichee-data#367:

  • update prompt instructions so Claude posts feedback via GitHub comments
  • allow required tools via claude_args --allowedTools
  • remove sticky-comment mode

This makes Claude review output appear as top-level and inline PR comments.

Summary by CodeRabbit

  • Chores
    • Enhanced internal code review workflow configuration to improve review coverage and integration processes.

@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

Walkthrough

The workflow configuration is expanded to trigger on additional PR events (ready_for_review, reopened) and replaces the external reusable workflow invocation with a self-contained inlined job that directly invokes the Claude Code Review action with detailed review parameters.

Changes

Cohort / File(s) Summary
GitHub Workflow Configuration
.github/workflows/claude-code-review.yml
Extended PR event triggers from [opened, synchronize] to [opened, synchronize, ready_for_review, reopened]. Replaced reusable workflow call with inlined job containing explicit checkout and Claude Code Review action steps. Added detailed review prompt capturing repository info, PR number, review focus areas (code quality, bugs, security, performance), and inline commenting configuration via claude_args.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A workflow takes shape, no more calls from afar,
With triggers expanded, we'll review like a star,
Claude's code inspection now flows inline and true,
More events, more details—fresh eyes on the view! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing the Claude Code Review workflow's comment tooling integration by replacing the reusable workflow with an inlined job that properly configures comment posting via GitHub comments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/fix-claude-code-review-tools-20260219

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link

greptile-apps bot commented Feb 19, 2026

Greptile Summary

This PR converts the Claude Code Review workflow from a reusable workflow reference to an inline workflow definition, enabling Claude to post feedback directly as GitHub comments via gh pr comment and inline comment tools. The workflow now includes explicit tool permissions via --allowedTools and adds triggers for ready_for_review and reopened events.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The changes are well-structured and align with the stated goal of enabling direct GitHub comment integration. The workflow syntax is correct, permissions are properly defined, and the tool allowlist is appropriately scoped. Score is 4 (not 5) because the new inline workflow removes centralized management from the reusable workflow, which may require maintenance across multiple repositories.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/claude-code-review.yml Workflow converted from reusable to inline definition with explicit tool permissions for Claude Code Review

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PR Event Triggered] --> B{Event Type}
    B -->|opened/synchronize/<br/>ready_for_review/<br/>reopened| C[Checkout Repository]
    C --> D[Run Claude Code Review]
    D --> E[Claude Analyzes PR]
    E --> F{Feedback Type}
    F -->|Top-level feedback| G[gh pr comment]
    F -->|Inline code issues| H[mcp__github_inline_comment__<br/>create_inline_comment]
    G --> I[GitHub PR Comments Posted]
    H --> I
Loading

Last reviewed commit: 3f7b748

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
.github/workflows/claude-code-review.yml (3)

7-14: Add a concurrency group to prevent redundant parallel review runs.

Without a concurrency: block, every synchronize event on a PR (e.g. rapid force-pushes) spawns a new Claude run alongside any in-flight one, wasting both runner minutes and API credits.

♻️ Proposed fix: add concurrency group
 jobs:
   claude-review:
+    concurrency:
+      group: claude-review-${{ github.event.pull_request.number }}
+      cancel-in-progress: true
     runs-on: ubuntu-latest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude-code-review.yml around lines 7 - 14, Add a
concurrency block to the claude-review job to prevent parallel runs for the same
PR: inside the job definition for claude-review add a concurrency: key with a
group that uniquely ties to the PR/workflow (for example use expressions like
github.workflow + github.event.pull_request.number or github.ref) and set
cancel-in-progress: true so newer runs cancel in-flight ones; update the job
definition around the claude-review job to include this concurrency
configuration.

43-44: Set --max-turns to cap unbounded Claude execution and control costs.

Configure appropriate --max-turns in claude_args to prevent excessive iterations. Without this guard, a complex PR can exhaust API quota and stall the runner.

♻️ Suggested addition
           claude_args: |
+            --max-turns 10
             --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude-code-review.yml around lines 43 - 44, Add a
max-turns cap to the claude_args to prevent unbounded Claude execution and
runaway costs: update the claude_args string (the line containing
--allowedTools) to include a reasonable --max-turns value (e.g. --max-turns 10
or an env-driven variable like --max-turns ${{ env.CLAUDE_MAX_TURNS }}), so the
runner will stop after the configured number of iterations; keep the existing
--allowedTools intact (mcp__github_inline_comment__create_inline_comment,Bash(gh
pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)) while appending the new
--max-turns flag.

4-5: Consider guarding against draft PRs to avoid unnecessary runs.

opened and synchronize events fire for draft PRs too, so every push to a draft will trigger a Claude review. Adding a ready_for_review check in a job condition (or a top-level if:) prevents wasted runs while the ready_for_review trigger already handles the draft → ready transition.

♻️ Optional fix: skip drafts on opened/synchronize
   claude-review:
+    if: github.event.pull_request.draft == false
     runs-on: ubuntu-latest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude-code-review.yml around lines 4 - 5, The workflow
currently triggers Claude reviews for pull_request events including opened and
synchronize which also fire for draft PRs; update the workflow to skip draft PRs
by adding a condition that checks the PR draft flag (e.g., use if:
github.event.pull_request == null || !github.event.pull_request.draft at the job
level or as a top-level if) or adjust the pull_request triggers to rely on
ready_for_review; ensure you reference the existing pull_request types array
(opened, synchronize, ready_for_review, reopened) and add the draft guard so
jobs like the Claude review only run when the PR is not a draft.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/claude-code-review.yml:
- Around line 22-26: The workflow step using anthropics/claude-code-action@v1
currently supplies claude_code_oauth_token (and may use anthropic_api_key) but
omits the GitHub auth input; add the github_token input to the same step
(github_token: ${{ secrets.GITHUB_TOKEN }}) so the action can use the GitHub
token for repo operations when OAuth token auth is used; update the Run Claude
Code Review step to include github_token alongside claude_code_oauth_token to
avoid auth failures.

---

Nitpick comments:
In @.github/workflows/claude-code-review.yml:
- Around line 7-14: Add a concurrency block to the claude-review job to prevent
parallel runs for the same PR: inside the job definition for claude-review add a
concurrency: key with a group that uniquely ties to the PR/workflow (for example
use expressions like github.workflow + github.event.pull_request.number or
github.ref) and set cancel-in-progress: true so newer runs cancel in-flight
ones; update the job definition around the claude-review job to include this
concurrency configuration.
- Around line 43-44: Add a max-turns cap to the claude_args to prevent unbounded
Claude execution and runaway costs: update the claude_args string (the line
containing --allowedTools) to include a reasonable --max-turns value (e.g.
--max-turns 10 or an env-driven variable like --max-turns ${{
env.CLAUDE_MAX_TURNS }}), so the runner will stop after the configured number of
iterations; keep the existing --allowedTools intact
(mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh
pr diff:*),Bash(gh pr view:*)) while appending the new --max-turns flag.
- Around line 4-5: The workflow currently triggers Claude reviews for
pull_request events including opened and synchronize which also fire for draft
PRs; update the workflow to skip draft PRs by adding a condition that checks the
PR draft flag (e.g., use if: github.event.pull_request == null ||
!github.event.pull_request.draft at the job level or as a top-level if) or
adjust the pull_request triggers to rely on ready_for_review; ensure you
reference the existing pull_request types array (opened, synchronize,
ready_for_review, reopened) and add the draft guard so jobs like the Claude
review only run when the PR is not a draft.

Comment on lines +22 to +26
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing github_token when using OAuth token authentication may cause auth failures.

claude_code_oauth_token and anthropic_api_key are for the Claude API, not GitHub. The auth priority for GitHub operations is: github_token input (user-provided) > GitHub App OIDC token (default).

When using OAuth token authentication, the workflow must also provide github_token: ${{ secrets.GITHUB_TOKEN }}; omitting it causes authentication failures for users following the standard OAuth setup flow.

🔒 Proposed fix: add `github_token`
         uses: anthropics/claude-code-action@v1
         with:
           claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
+          github_token: ${{ secrets.GITHUB_TOKEN }}
           prompt: |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude-code-review.yml around lines 22 - 26, The workflow
step using anthropics/claude-code-action@v1 currently supplies
claude_code_oauth_token (and may use anthropic_api_key) but omits the GitHub
auth input; add the github_token input to the same step (github_token: ${{
secrets.GITHUB_TOKEN }}) so the action can use the GitHub token for repo
operations when OAuth token auth is used; update the Run Claude Code Review step
to include github_token alongside claude_code_oauth_token to avoid auth
failures.

@justin808 justin808 merged commit 6bd0566 into master Feb 19, 2026
2 of 3 checks passed
@justin808 justin808 deleted the codex/fix-claude-code-review-tools-20260219 branch February 19, 2026 00: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.

1 participant