refactor(review-pr): delegate diff collection to workflow agents - #49
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe Changesreview-pr diff collection and agent orchestration refactor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Biome (2.5.0)pr-review-toolkit/skills/review-pr/review-pr.jsFile contains syntax errors that prevent linting: Line 562: Illegal return statement outside of a function 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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR refactors the /review-pr workflow so each review agent collects its own diff context (via diffPreamble()), while the orchestrator selects which agents to run based on git diff --name-status, reducing large diff payloads passed through the workflow layer.
Changes:
- Moved diff collection responsibilities into workflow agents via a new
diffPreamble()prompt block. - Replaced in-workflow regex agent selection with orchestrator-provided
agents. - Updated skill documentation and bumped plugin version to
1.2.0.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pr-review-toolkit/skills/review-pr/SKILL.md | Updates allowed tools and rewrites Phase 1 to fetch base ref + select agents via git diff --name-status. |
| pr-review-toolkit/skills/review-pr/review-pr.js | Removes centralized diff/context building; adds diffPreamble() and switches to orchestrator-provided agents. |
| pr-review-toolkit/.claude-plugin/plugin.json | Bumps plugin version to 1.2.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
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 `@pr-review-toolkit/skills/review-pr/review-pr.js`:
- Around line 533-537: The code does not validate that config.agents exists
before accessing its .length property, which will crash if config.agents is
undefined, and it does not verify that agent names in config.agents have
corresponding prompts in the PROMPTS object before dispatching them. Add a guard
to ensure config.agents is provided with a fallback to an empty array if
missing, then filter the selected array to only include agent names where
PROMPTS[name] is defined before passing them to the parallel function. This
prevents crashes and ensures only valid agents with defined prompts are
executed.
- Around line 60-63: The remote collection instructions currently use
get_file_contents which loses the actual diff-hunk context and fails on deleted
or renamed files. Replace the instruction that uses get_file_contents with
instructions to retrieve and use patch hunks or diffs from the pull_request_read
method instead. This will preserve the true diff context, properly handle file
changes (including deletions and renames), and ensure line comments map
correctly to the actual PR diff lines.
In `@pr-review-toolkit/skills/review-pr/SKILL.md`:
- Line 13: The Bash skill definition in this file is too restrictive and only
permits `git diff --name-status`, but review-pr.js now requires running full
`git diff` commands with branch references and file filters (e.g., `git diff
origin/<baseRef>...HEAD -- <files>`). Update the Bash skill definition to allow
the complete git diff syntax needed for patch collection by removing the
restrictive `--name-status` flag constraint and permitting the full git diff
command with branch comparisons and file path arguments.
🪄 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: Repository: cblecker/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 80c4c1b0-6e52-450b-9099-f8046db1b351
📒 Files selected for processing (3)
pr-review-toolkit/.claude-plugin/plugin.jsonpr-review-toolkit/skills/review-pr/SKILL.mdpr-review-toolkit/skills/review-pr/review-pr.js
ac807bb to
aeae0cc
Compare
aeae0cc to
e79a9ee
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@pr-review-toolkit/skills/review-pr/review-pr.js`:
- Line 542: The prompt assembly is concatenating PROMPTS[name] before
diffPreamble(), but the role prompt expects setup instructions to appear above
it. Reverse the order of concatenation in the prompt assignment so that
diffPreamble() comes first, followed by PROMPTS[name], to match the expectation
referenced in the role prompt definition.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9829e394-648b-4792-885f-12f091499876
📒 Files selected for processing (3)
pr-review-toolkit/.claude-plugin/plugin.jsonpr-review-toolkit/skills/review-pr/SKILL.mdpr-review-toolkit/skills/review-pr/review-pr.js
✅ Files skipped from review due to trivial changes (1)
- pr-review-toolkit/.claude-plugin/plugin.json
🚧 Files skipped from review as they are similar to previous changes (1)
- pr-review-toolkit/skills/review-pr/SKILL.md
Move diff fetching from the orchestrator into each workflow agent via a diffPreamble() that generates setup instructions. Agents now collect their own patches using git (local) or GitHub MCP (remote), eliminating the token cost of shuttling large diffs through the orchestration layer. Agent selection moves from regex matching in the workflow to the orchestrator, which can evaluate whether each specialist agent is warranted based on the nature of the changes. Assisted-by: Claude:claude-opus-4-6
e79a9ee to
13a788c
Compare
Summary
diffPreamble()— local agents usegit diff, remote agents use GitHub MCPget_files/get_file_contents. Eliminates shuttling large diffs through the orchestration layer.selectAgents()in the workflow with intelligent selection by the orchestrator usinggit diff --name-statusand judgment about which specialist agents are warranted.baseRefandagentsinstead ofchangedFiles/excludedFileSummary— agents handle file filtering (vendor, generated) themselves.Test plan
/review-pron a local PR (whereisLocalis true) and verify agents collect diffs via git/review-pron a remote PR (whereisLocalis false) and verify agents collect diffs via GitHub MCPcode-revieweralways runs, optional agents selected based on file changesclaude plugin validate ./pr-review-toolkit— passesnode -c pr-review-toolkit/skills/review-pr/review-pr.js— no syntax errorsSummary by CodeRabbit