fix(review-agent): fetch private GitHub PR diffs via API - #1352
Conversation
Walkthrough
ChangesAuthenticated PR diff fetching via Octokit Pulls API
Estimated code review effort: 2 (Simple) | ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
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 `@packages/web/src/features/agents/review-agent/nodes/githubPrParser.ts`:
- Around line 15-20: The local variable `pull_number` violates
TypeScript/JavaScript naming conventions which require camelCase for
identifiers. Rename the local variable from `pull_number` to `pullNumber` on the
line where it is assigned from `pullRequest.number`. Then in the octokit.request
call, update the parameter mapping to use `pull_number: pullNumber` to keep the
API field name in snake_case while the local variable follows camelCase
conventions.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 963e0c7a-35ed-491d-b985-0d8e52b18c72
📒 Files selected for processing (2)
packages/web/src/features/agents/review-agent/nodes/githubPrParser.test.tspackages/web/src/features/agents/review-agent/nodes/githubPrParser.ts
|
Thanks for the approval @brendan-kellam. I can take care of the remaining failing checks. I see lint and tests are passing, and the remaining failures are the PR Gate build and Changelog Reminder. I’ll inspect the logs and add a changelog entry if required. |
|
Thanks again @brendan-kellam. I’ve updated the branch with latest I verified locally:
Result: completed successfully. The branch is ready for re-review when you have a chance. |
|
@claude add a changelog entry |
|
Claude finished @brendan-kellam's task in 27s —— View job Adding changelog entry
Added the following entry under
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Summary
Fixes #1277.
The Review Agent currently fetches pull request diffs using the
diff_urlreturned by GitHub. For private repositories, this URL can return404 Not Foundeven when the GitHub App token has permission to access the pull request through the GitHub API.This change updates
githubPrParserto fetch diffs through the GitHub Pull Requests API using theapplication/vnd.github.diffaccept header. This allows authenticated access to PR diffs in private repositories.Changes
pullRequest.diff_urlGET /repos/{owner}/{repo}/pulls/{pull_number}application/vnd.github.diffTesting
cd packages/web yarn vitest githubPrParserResult:
Summary by CodeRabbit
Note
Low Risk
Small, localized change to diff fetch in the review agent; same parsing path and no auth or data-model changes beyond using the existing Octokit token for the pulls API.
Overview
Fixes the Review Agent failing to load PR diffs on private GitHub repos by changing how
githubPrParserretrieves diff text.Instead of calling
octokit.requeston GitHub’s publicdiff_url, it now usesGET /repos/{owner}/{repo}/pulls/{pull_number}with theapplication/vnd.github.diffaccept header so the authenticated Octokit client can read the diff. Parsing and payload mapping are unchanged; tests assert the new API call shape.Reviewed by Cursor Bugbot for commit 4ae2913. Bugbot is set up for automated code reviews on this repo. Configure here.