Repository navigation
fix(pr-review): a pull request session reads its own repository - #2478
Confidence 8/10 · No issues found
🟢 Confidence 8/10 · likely safe to merge. Pinning and withholding are pinned by tests; the untested piece is the new unreadable fail-fast in turn-runner, whose reply-row write drops the reason.
1 note · tests partial −1 · risk high −1 · 1/1 new units observable
A review or reply session now pins every repository-naming tool to its own pull request's repository, withholds those tools when it cannot be read, and fails an unattended pass instead of running unpinned. The scope change holds; one copy defect on the reply path.
buildChatToolkitoverwritesrepositoryfor the six repository tools and withholds them when the scope isunreadableturn-runnerresolvesreplyTargetand fails an unattended pass whose pull request cannot be readlist_source_repositoriesleaves the reviewer's ruleset and joins the code-mode tool setsearch_source_coderejects apathcontaining whitespace, closing the qualifier-injection vector
Findings
🔵 Note · F1 · Reply row loses the unreadable-pull-request reason in failUnfinished
correctness · apps/ai/src/chat/turn-runner.ts:409
failUnfinished's second argument is read only for an investigation: a reply row is settled with NO_REPLY_ERROR and its comment falls back to "Mention me again to retry" (autonomous-settle.ts:86, PrReviewConversationService.ts:859). An autonomous reply whose pull request cannot be read therefore records and posts the wrong cause, and asks for a retry that fails the same way.
Give `UnfinishedRows.failReply` the message argument that `failInvestigation` has, and pass `PULL_REQUEST_UNREADABLE` as the reply row's `error` and as its posted notice.
Production impact
Production traffic of the changed files (last 7 days)
| File | Calls/day | Busiest operations |
|---|---|---|
packages/backend/src/services/pr-review/PrReviewConversationService.ts |
28 | PrReviewConversationService.post 28/day, 0.0% err |
What was checked
- A
run_codeprogram cannot reach a withheld tool:codeToolsis filtered frommaple.toolkit.tools(run.ts:198) - All four
sandbox_*tools and both source tools take arepositoryparameter, soREPOSITORY_TOOLScovers every reviewer tool that names one pathreaches GitHub as apath:andfilename:qualifier (GithubAppClient.ts:2138), so the whitespace refusal is the right guard;splitSearchPathderives both from the checked string
Observability coverage: 1 of 1 changes observable
| Change | Kind | Observable | Evidence |
|---|---|---|---|
| PrReviewConversationService.replyTarget (reply row + repository read per reply turn) | database read | yes | Effect.fn("PrReviewConversationService.replyTarget") span, PrReviewConversationService.ts:314 |
8896f53 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Annotations
Check notice on line 409 in apps/ai/src/chat/turn-runner.ts
maple-review-bot / Maple / review
correctness: Reply row loses the unreadable-pull-request reason in `failUnfinished`
`failUnfinished`'s second argument is read only for an investigation: a reply row is settled with `NO_REPLY_ERROR` and its comment falls back to "Mention me again to retry" (`autonomous-settle.ts:86`, `PrReviewConversationService.ts:859`). An autonomous reply whose pull request cannot be read therefore records and posts the wrong cause, and asks for a retry that fails the same way.