Skip to content

Add PR review agents#5

Merged
dellch merged 4 commits into
mainfrom
add-review-agents
May 14, 2026
Merged

Add PR review agents#5
dellch merged 4 commits into
mainfrom
add-review-agents

Conversation

@dellch
Copy link
Copy Markdown
Owner

@dellch dellch commented May 14, 2026

Summary

  • Add address-reviews agent: monitors a single PR for CodeRabbit review comments, fixes actionable ones (one commit per comment), replies with commit SHA, polls every 5 minutes until merged/closed
  • Add pr-review-orchestrator agent: finds all open PRs with comments and dispatches one address-reviews agent per PR

Usage

Invoke the orchestrator from conversation or agent view:

use pr-review-orchestrator

Or dispatch directly:

claude --agent pr-review-orchestrator --bg

Test plan

  • Verify agents appear in /agents library
  • Test orchestrator finds open PRs with comments
  • Test address-reviews fixes an actionable comment and replies with commit SHA

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Automated pull request review handling: classifies review comments, applies fixes with one-commit-per-fix, validates changes, pushes commits, and replies with confirmations.
    • Multi-PR orchestration: discovers PRs with review comments and dispatches review-handling agents per PR.
  • Documentation

    • Documentation guideline: all fenced code blocks in Markdown must declare a language identifier.

Review Change Stack

- address-reviews: monitors a single PR for CodeRabbit comments, fixes
  actionable ones, replies with commit SHAs, polls every 5 minutes
  until the PR is merged or closed.
- pr-review-orchestrator: finds open PRs with comments and dispatches
  one address-reviews agent per PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 54a5a685-806f-471b-90c8-07c528a0afa9

📥 Commits

Reviewing files that changed from the base of the PR and between eec5f5d and 930b581.

📒 Files selected for processing (3)
  • .claude/agents/address-reviews.md
  • .claude/agents/pr-review-orchestrator.md
  • CLAUDE.md
✅ Files skipped from review due to trivial changes (1)
  • CLAUDE.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • .claude/agents/pr-review-orchestrator.md
  • .claude/agents/address-reviews.md

📝 Walkthrough

Walkthrough

Adds two Claude agents: an orchestrator that finds open PRs with review comments and an address-reviews agent that classifies unresolved comments, applies one-commit-per-fix changes on the PR branch, validates (revert on failure), replies with commit SHAs, and polls until the PR closes or merges. Also adds a Markdown fenced-code language guidance.

Changes

PR Review Automation Agents

Layer / File(s) Summary
address-reviews agent specification
.claude/agents/address-reviews.md
Defines metadata, initial comment-fetch-and-fix workflow (one commit per actionable comment), validation with revert-on-failure, reply-to-comment behavior including commit SHA, a 5-minute monitoring loop, and operational rules (minimal scope, no dismiss/resolve, stop conditions).
pr-review-orchestrator agent
.claude/agents/pr-review-orchestrator.md
Discovers open PRs via GitHub API/CLI, checks each for review comments, and dispatches one address-reviews agent per PR with context; reports dispatched vs skipped PRs and restricts agents to delegation-only behavior.
Documentation Guidance
CLAUDE.md
Adds a "Documentation Guidance" subsection requiring fenced Markdown code blocks to include an explicit language label.

Sequence Diagram

sequenceDiagram
  participant User
  participant Orchestrator as pr-review-orchestrator
  participant GitHub
  participant AddressAgent as address-reviews
  participant Validation as CI/Validator
  User->>Orchestrator: Request PR review automation
  Orchestrator->>GitHub: List open PRs
  loop Each PR
    Orchestrator->>GitHub: Fetch review comments
    alt Has comments
      Orchestrator->>AddressAgent: Dispatch with PR metadata
      AddressAgent->>GitHub: Fetch PR data and comments
      loop Each actionable comment
        AddressAgent->>AddressAgent: Apply fix (one commit)
        AddressAgent->>Validation: Run build/lint/test
        alt Validation passes
          AddressAgent->>GitHub: Push commit & reply with commit SHA
        else Validation fails
          AddressAgent->>AddressAgent: Revert commit & reply reporting failure
        end
      end
      AddressAgent->>GitHub: Monitor PR state (5 min loop)
    end
  end
  Orchestrator->>User: Report dispatched PRs
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit hops through GitHub's halls,
Two agents answering review calls,
One patches lines with careful care,
The other sends them everywhere,
Commits and checks, then sleeps—repeat. 🐰

🚥 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 'Add PR review agents' accurately summarizes the main change—two new agent specifications (address-reviews and pr-review-orchestrator) were added to the codebase.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-review-agents

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

Copy link
Copy Markdown

@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: 3

🤖 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 @.claude/agents/address-reviews.md:
- Around line 18-47: Three fenced command blocks in the markdown lack a language
specifier causing markdownlint MD040; update the three opening triple-backtick
fences that precede the command examples (the blocks containing "gh pr view
{number} --json state,headRefName,title", "gh api
repos/{owner}/{repo}/pulls/{number}/comments/{comment_id}/replies -f
body=\"Fixed in <commit_sha>\"", and the final "gh pr view {number} --json
state") to use ```bash so each block is ```bash ... ```; make the change in the
.claude/agents/address-reviews.md file, commit the single logical change, run
markdownlint to confirm MD040 is resolved, and push the commit.
- Around line 23-55: The monitoring loop in the address-reviews spec must
persist processed comment IDs to avoid duplicate fixes: modify the polling logic
(the "Monitoring loop" and steps that fetch comments with gh/pr API) to store
handled comment_id values in local persistent state (file or lightweight DB), on
each poll fetch only new comments using the GitHub REST `since` parameter or by
comparing incoming comment.id against the stored set, skip any comment whose id
is already persisted, and append newly-processed ids after successfully creating
a commit and replying via the existing gh api reply flow; optionally add a
switch to use GraphQL `reviewThreads.isResolved` when resolution detection is
required and recommend using GitHub webhooks (`pull_request_review_comment` or
webhooks processing) instead of polling to eliminate reprocessing.

In @.claude/agents/pr-review-orchestrator.md:
- Around line 13-26: The three unlabeled fenced code blocks showing shell
commands and a spawn prompt should be marked as bash to satisfy markdownlint
MD040: change the opening fences for the blocks containing "gh pr list --state
open --json number,title,headRefName", "gh api
repos/{owner}/{repo}/pulls/{number}/comments --jq 'length'", and the block with
the agent prompt "Work on PR #{number} ({title}) in this repository. The branch
is {headRefName}." so each begins with ```bash instead of ```; keep the block
contents unchanged.
🪄 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 Plus

Run ID: b0d80f51-4eb6-4289-a343-c2c23c428793

📥 Commits

Reviewing files that changed from the base of the PR and between 62f19aa and eec5f5d.

📒 Files selected for processing (2)
  • .claude/agents/address-reviews.md
  • .claude/agents/pr-review-orchestrator.md

Comment thread .claude/agents/address-reviews.md Outdated
Comment thread .claude/agents/address-reviews.md Outdated
Comment thread .claude/agents/pr-review-orchestrator.md Outdated
dellch and others added 3 commits May 14, 2026 10:22
- Add bash/text language to all fenced code blocks (MD040)
- Add comment ID tracking to prevent duplicate fixes across polling cycles

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dellch
Copy link
Copy Markdown
Owner Author

dellch commented May 14, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@dellch dellch merged commit f1e0f51 into main May 14, 2026
1 check passed
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