Skip to content

Kan/fvm claude reviewer#8614

Open
Kay-Zee wants to merge 2 commits into
masterfrom
kan/fvm-claude-reviewer
Open

Kan/fvm claude reviewer#8614
Kay-Zee wants to merge 2 commits into
masterfrom
kan/fvm-claude-reviewer

Conversation

@Kay-Zee

@Kay-Zee Kay-Zee commented Jul 20, 2026

Copy link
Copy Markdown
Member

Adds a workflow that runs Claude Code on every PR touching fvm/** and posts its findings as a PR comment. Companion to the branch-protection ruleset PR — that one makes room for an AI reviewer to eventually count as one of the two
required approvals on FVM-only changes; this one is the reviewer.

It starts in trial mode, deliberately. Claude posts a single findings comment per run (grouped by severity, file:line citations, capped nits) and cannot approve or request changes — not just by prompt, but structurally: the tool
allowlist doesn't include gh pr review, so an approval is impossible regardless of what the model decides. Once we've watched it on enough real FVM PRs to trust the signal, promoting it is a two-line change (add Bash(gh pr review:*) to
the allowlist, swap the submission stanza of the prompt) — documented in a comment at the top of the workflow.

The review prompt is specialized for this codebase rather than generic. It points Claude at AGENTS.md, fvm/README.md, and the fvm/errors taxonomy (CodedError vs CodedFailure — fvm does not use the sentinel model the rest of the
repo does), and names the bug classes that have actually bitten us: execution-result determinism and HCU discipline, warm/cold cache-state independence in derived-data metering, RunWithMeteringDisabled boundary semantics and
nested-transaction merge/unwind pairing, error-code stability, transaction pipeline phase invariants, service-account exemptions, and SPoCK sensitivity. It diffs against the PR's base ref rather than master, since FVM PRs are frequently
stacked. Style and formatting are explicitly out of scope — CI and CodeRabbit already cover those.

Authentication uses Workload Identity Federation: the workflow exchanges its GitHub OIDC token for a short-lived Anthropic token at runtime, so there is no ANTHROPIC_API_KEY secret to store or rotate. The IDs in the workflow file are
identifiers, not credentials. The federation rule (scoped to repo:onflow/flow-go:) and the Claude GitHub App installation are already in place, so this should work on the first FVM PR after merge.

Cost controls: runs are capped at 30 minutes and 30 turns, a new push cancels the in-flight review for that PR, and draft PRs are skipped until marked ready.

Summary by CodeRabbit

  • New Features
    • Added automated pull request reviews for changes in the FVM area.
    • Reviews run on eligible pull request updates and post a concise, severity-grouped comment with findings.
    • Review checks focus on consensus and metering-related issues.

@Kay-Zee
Kay-Zee requested a review from a team as a code owner July 20, 2026 23:00
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 2 package(s) with unknown licenses.
See the Details below.

License Issues

.github/workflows/claude-review-fvm.yml

PackageVersionLicenseIssue Type
actions/checkout4.*.*NullUnknown License
anthropics/claude-code-action1.*.*NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout 4.*.* 🟢 6.9
Details
CheckScoreReason
Maintained🟢 1024 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Code-Review🟢 10all changesets reviewed
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
SAST🟢 10SAST tool is run on all commits
Branch-Protection🟢 5branch protection is not maximal on development and all release branches
actions/anthropics/claude-code-action 1.*.* UnknownUnknown

Scanned Files

  • .github/workflows/claude-review-fvm.yml

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

FVM Claude review automation

Layer / File(s) Summary
Workflow execution and authentication
.github/workflows/claude-review-fvm.yml
Adds pull-request triggers for fvm/**, non-draft filtering, per-PR concurrency, required permissions, repository checkout, and Claude Code invocation through Workload Identity Federation.
FVM review policy and output format
.github/workflows/claude-review-fvm.yml
Defines FVM-specific review checks and constrains Claude’s output to one severity-grouped PR comment without approvals or change requests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant GitHubActions
  participant ClaudeCode
  participant PullRequestComment
  PullRequest->>GitHubActions: FVM pull-request event
  GitHubActions->>ClaudeCode: run configured review with repository context
  ClaudeCode->>PullRequestComment: submit one formatted review comment
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly indicates a Claude-based reviewer for the fvm area, matching the workflow added in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kan/fvm-claude-reviewer

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.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/claude-review-fvm.yml:
- Around line 45-47: Update the actions/checkout step to disable credential
persistence by setting persist-credentials to false alongside fetch-depth,
ensuring the GitHub token is not stored in local Git configuration.
- Around line 51-54: Move the Workload Identity Federation settings from the
action inputs into the workflow step’s env block using the required uppercase
variable names, and add GH_TOKEN there sourced from the GitHub token. Remove the
corresponding lowercase action inputs while preserving the existing Claude
action configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8db275f2-07da-46b9-ad0e-db5e1e9cd1e8

📥 Commits

Reviewing files that changed from the base of the PR and between ad55d25 and 836f49b.

📒 Files selected for processing (1)
  • .github/workflows/claude-review-fvm.yml

Comment on lines +45 to +47
- uses: actions/checkout@v4
with:
fetch-depth: 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Prevent credential persistence in checkout.

To reduce the risk of credential leakage (especially when running automated AI tools that execute shell commands), explicitly disable credential persistence in the checkout action. This ensures the GitHub token is not left in the local git configuration.

🛡️ Proposed fix
       - uses: actions/checkout@v4
         with:
           fetch-depth: 0
+          persist-credentials: false
📝 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
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 45-47: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/claude-review-fvm.yml around lines 45 - 47, Update the
actions/checkout step to disable credential persistence by setting
persist-credentials to false alongside fetch-depth, ensuring the GitHub token is
not stored in local Git configuration.

Source: Linters/SAST tools

Comment on lines +51 to +54
# Workload Identity Federation — no static credentials.
anthropic_federation_rule_id: fdrl_01UXEriP26j1qgPvpAvVyYoE
anthropic_service_account_id: svac_01RutNzF7FBxds8FhTHZ2BTY
anthropic_organization_id: 23ff619e-5bf0-4e8d-936b-87274460531a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Move Workload Identity Federation variables to the env block and provide a GitHub token.

The anthropics/claude-code-action@v1 action does not accept WIF variables as inputs, meaning they will be ignored and authentication will fail. They must be exported as uppercase environment variables for the CLI to pick them up.

Additionally, since Claude is instructed to execute gh pr commands via allowed tools, the gh CLI requires a GH_TOKEN to authenticate.

🐛 Proposed fix
-          # Workload Identity Federation — no static credentials.
-          anthropic_federation_rule_id: fdrl_01UXEriP26j1qgPvpAvVyYoE
-          anthropic_service_account_id: svac_01RutNzF7FBxds8FhTHZ2BTY
-          anthropic_organization_id: 23ff619e-5bf0-4e8d-936b-87274460531a
+          github_token: ${{ github.token }}
+        env:
+          # Workload Identity Federation — no static credentials.
+          ANTHROPIC_FEDERATION_RULE_ID: fdrl_01UXEriP26j1qgPvpAvVyYoE
+          ANTHROPIC_SERVICE_ACCOUNT_ID: svac_01RutNzF7FBxds8FhTHZ2BTY
+          ANTHROPIC_ORGANIZATION_ID: 23ff619e-5bf0-4e8d-936b-87274460531a
+          GH_TOKEN: ${{ github.token }}
📝 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
# Workload Identity Federation — no static credentials.
anthropic_federation_rule_id: fdrl_01UXEriP26j1qgPvpAvVyYoE
anthropic_service_account_id: svac_01RutNzF7FBxds8FhTHZ2BTY
anthropic_organization_id: 23ff619e-5bf0-4e8d-936b-87274460531a
github_token: ${{ github.token }}
env:
# Workload Identity Federation — no static credentials.
ANTHROPIC_FEDERATION_RULE_ID: fdrl_01UXEriP26j1qgPvpAvVyYoE
ANTHROPIC_SERVICE_ACCOUNT_ID: svac_01RutNzF7FBxds8FhTHZ2BTY
ANTHROPIC_ORGANIZATION_ID: 23ff619e-5bf0-4e8d-936b-87274460531a
GH_TOKEN: ${{ github.token }}
🧰 Tools
🪛 actionlint (1.7.12)

[error] 52-52: input "anthropic_federation_rule_id" is not defined in action "anthropics/claude-code-action@v1". available inputs are "additional_permissions", "allowed_bots", "allowed_non_write_users", "anthropic_api_key", "assignee_trigger", "base_branch", "bot_id", "bot_name", "branch_name_template", "branch_prefix", "classify_inline_comments", "claude_args", "claude_code_oauth_token", "display_report", "exclude_comments_by_actor", "github_token", "include_comments_by_actor", "include_fix_links", "label_trigger", "path_to_bun_executable", "path_to_claude_code_executable", "plugin_marketplaces", "plugins", "prompt", "settings", "show_full_output", "ssh_signing_key", "track_progress", "trigger_phrase", "use_bedrock", "use_commit_signing", "use_foundry", "use_sticky_comment", "use_vertex"

(action)


[error] 53-53: input "anthropic_service_account_id" is not defined in action "anthropics/claude-code-action@v1". available inputs are "additional_permissions", "allowed_bots", "allowed_non_write_users", "anthropic_api_key", "assignee_trigger", "base_branch", "bot_id", "bot_name", "branch_name_template", "branch_prefix", "classify_inline_comments", "claude_args", "claude_code_oauth_token", "display_report", "exclude_comments_by_actor", "github_token", "include_comments_by_actor", "include_fix_links", "label_trigger", "path_to_bun_executable", "path_to_claude_code_executable", "plugin_marketplaces", "plugins", "prompt", "settings", "show_full_output", "ssh_signing_key", "track_progress", "trigger_phrase", "use_bedrock", "use_commit_signing", "use_foundry", "use_sticky_comment", "use_vertex"

(action)


[error] 54-54: input "anthropic_organization_id" is not defined in action "anthropics/claude-code-action@v1". available inputs are "additional_permissions", "allowed_bots", "allowed_non_write_users", "anthropic_api_key", "assignee_trigger", "base_branch", "bot_id", "bot_name", "branch_name_template", "branch_prefix", "classify_inline_comments", "claude_args", "claude_code_oauth_token", "display_report", "exclude_comments_by_actor", "github_token", "include_comments_by_actor", "include_fix_links", "label_trigger", "path_to_bun_executable", "path_to_claude_code_executable", "plugin_marketplaces", "plugins", "prompt", "settings", "show_full_output", "ssh_signing_key", "track_progress", "trigger_phrase", "use_bedrock", "use_commit_signing", "use_foundry", "use_sticky_comment", "use_vertex"

(action)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/claude-review-fvm.yml around lines 51 - 54, Move the
Workload Identity Federation settings from the action inputs into the workflow
step’s env block using the required uppercase variable names, and add GH_TOKEN
there sourced from the GitHub token. Remove the corresponding lowercase action
inputs while preserving the existing Claude action configuration.

Source: Linters/SAST tools

@janezpodhostnik

Copy link
Copy Markdown
Contributor

Should the review prompt not just be a skill. the github workflow would just invoke that skill, but we could also use it locally.

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.

4 participants