fix(llmadapters): launch Claude reviewers outside the PR checkout - #624
Merged
Merged
Conversation
Claude Code 2.1.281 rejects a working directory with its own .claude/ unless that exact directory is trusted, so every background reviewer failed on repositories that commit .claude/. Launching there also loaded the PR's project settings and hooks. Background reviewers now start from the adapter work directory, as foreground mode already does, and reach the checkout through --add-dir. The prompt file names the checkout path.
monit-reviewer
approved these changes
Sep 23, 2026
monit-reviewer
left a comment
There was a problem hiding this comment.
Automated PR Review
Reviewed commit: 74471f5eadde
Profile: open-cli-collective-claude-review - Posting as: monit-reviewer
Summary
| Reviewer | Findings |
|---|---|
| go:implementation-tests | 0 |
Reviewer Coverage
go:implementation-tests— complete (broad); skipped: none; constraints: none
Inspected files (2)
internal/llmadapters/subprocess.gointernal/llmadapters/subprocess_test.go
0 PR discussion threads considered. 0 summarized; 0 resolved.
Completed in 2m 53s | ~$0.85 (est.) | claude-sonnet-5 | cr dev
| Field | Value |
|---|---|
| Model | claude-sonnet-5 |
| Reviewers | go:implementation-tests |
| Engine | claude_cli · claude-sonnet-5 |
| Reviewed by | cr · monit-reviewer |
| Duration | 2m 53s wall · 2m 40s compute |
| Cost | ~$0.85 (est.) |
| Pricing basis | anthropic-public-2026-09-02 |
| Tokens | 56 in / 9.1k out |
Per-workstream usage
orchestrator-selection— claude-sonnet-5- In: 6
- Out: 1.6k
- Cache read: 29.3k
- Cache create: 51.1k
- Cost: ~$0.23 (est.)
- Duration: 23s
go:implementation-tests— claude-sonnet-5- In: 44
- Out: 7.0k
- Cache read: 841.8k
- Cache create: 79.2k
- Cost: ~$0.56 (est.)
- Duration: 2m 04s
orchestrator-rollup— claude-sonnet-5- In: 6
- Out: 443
- Cache read: 85.0k
- Cache create: 12.3k
- Cost: ~$0.07 (est.)
- Duration: 13s
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.
Summary
Background Claude reviewers now launch from the adapter work directory (
claudeBGWorkingDir) instead of the PR checkout, and reach the checkout through--add-dir. Foreground mode (CR_CLAUDE_FOREGROUND) already worked this way. The prompt file now opens with the checkout path and tells the reviewer its shell does not start there.Two reasons:
.claude/unless that exact directory is trusted. cr creates a fresh checkout for every run, so every reviewer failed withWorkspace not trustedon repositories that commit.claude/..claude/project settings, including hooks the PR author controls.Type of Change
Verification
TestSubprocessClaudeReviewerWorkspaceLaunchnow asserts that the launch directory is the Claude bg workdir, not the checkout, and that the prompt file names the checkout path. It fails on main and passes here.go test ./...andgo vet ./...pass.make lintcould not run locally because the installed golangci-lint can't typecheck the Go 1.27.1 standard library, which is unrelated to this change. CI covers lint.cr review --dry-run --fresh-sessionagainst a PR in a repository that commits.claude/ran all three reviewers tocomplete (broad); skipped: none, with no trust errors. The same PR failed every reviewer with the released binary on 2.1.281.Checklist
make tidypasses (no dependency changes; not run)make lintpasses (see above)make testpassesmake buildpassesRelated Issues
Closes #623