perf: parallelise the three PR-data fetches in reviewPullRequest#36
Merged
Conversation
## Why
The hot path of `reviewPullRequest` (`src/ai-review.js:382-398`) issued three
strictly-sequential GitHub REST calls before any work began: PR metadata, the
diff via `mediaType: { format: 'diff' }`, and the files list. Each call costs
~200-500 ms of egress time on the netcup VPS; serially that's ~600-1500 ms
of wall-time waste on every review.
The three calls are independent — none depends on the other two's response —
so they parallelise trivially.
## What
`Promise.all([request, request, request])` wrapper in `reviewPullRequest`.
The downstream consumers (rivet oracle path, `buildReviewPrompt`,
`recordReview`) keep their `prData` / `diffResponse` / `filesResponse`
contract unchanged. octokit.request invocations are still dispatched in
source order (JS is single-threaded), so the existing
`mockResolvedValueOnce`-style test rigs work unchanged.
## Source
Wave-1 Performance engineer flagged this as Bug #19 in
`docs/agent-fleet/bugs.md`. Estimated savings: 0.5-1 s per review.
## Test plan
- [x] All 806 tests pass
- [x] eslint clean
- [ ] After deploy: PR-review wall-time drops by the GitHub-egress component;
visible in `pr-review-timing` logs (when added per Performance agent's
"one profile I'd run" recommendation).
## Risk & rollout
- Risk: low. Same data, same downstream consumers, just dispatched concurrently.
- Rollout: self-update on merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Bug #19 from
docs/agent-fleet/bugs.md(wave-1 Performance engineer).The hot path of
reviewPullRequestissued three strictly-sequential GitHub REST calls (PR meta, diff via mediaType, files list) before any work — ~600-1500 ms of wall-time waste. They're independent, soPromise.allhalves it.🤖 Generated with Claude Code