Repository navigation
fix: let Claude Code review passes read the run's patch files in CI - #84
Merged
Merged
Conversation
The Claude Code engine scopes every read tool to the PR-head tree, but in CI the patch workspace is written under the base checkout's `.runs/`, outside that tree. Every patch read the prompts ask for was denied: a reviewer's context-only files and the cross-file pass's files past its inline budget. The run's `patches/` directory is now a second read scope; the rest of `.runs/` stays unreadable.
🤖 AI code reviewDecision: Ready for human review Overall PR risk: Low. This change modifies buildClaudeArgs to grant Claude Code read access to the patch directory in CI environments. The change is scoped precisely: only
No findings. This review is advisory — it never blocks a merge and never auto-approves. |
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.
In CI, review passes on the Claude Code engine (the default for adopters) could not read the patch files their prompts point to. Every read was denied.
Why
buildClaudeArgsscopes each granted read tool to the working directory, which is the PR-head tree thatecr cimaterializes in a temp directory. The patch workspace is written to<runsDir>/<runId>/patches, and in CIrunsDiris the base checkout's.expo-code-review/.runs, outside that tree. With--permission-mode dontAsk, reads there are denied.What this broke:
buildReviewerTask);buildCrossCuttingTask).Local runs were unaffected, because
.runs/sits inside the repo.Change
buildClaudeArgstakesextraReadRoots. Each granted read tool gets one allow rule per root. A pass with no tools still gets no rules.patchDir.runReviewpassespatchDirFor(runDir), a new helper thatwritePatchWorkspaceuses too.patches/is granted. The rest of.runs/, includingreviews.jsonl, stays unreadable.writePatchWorkspacecomment, which wrongly said the files were written inside the repo.Verification
Live, against the pinned
@anthropic-ai/claude-code@2.1.280, with the argumentsbuildClaudeArgsgenerates and a CI-shaped layout (a PR-head tree in one temp directory,.runs/under a separate workspace):.runs/<id>/patches/*.patch.runs/reviews.jsonlUnit tests cover the new allow rules, the absence of a wider
.runs/rule, the no-tools case, and the handle's patch directory reaching the CLI's arguments.bun test,typecheck,fmt:checkand./ref-checkpass.Not covered: the OpenCode engine sets no read permissions of its own, so whether it can read outside the tree is still unchecked.
🤖 Generated with Claude Code