Skip to content

fix(llmadapters): launch Claude reviewers outside the PR checkout - #624

Merged
zzwong merged 1 commit into
mainfrom
fix/623-claude-launch-dir
Sep 23, 2026
Merged

zzwong merged 1 commit into
mainfrom
fix/623-claude-launch-dir

Conversation

@zzwong

@zzwong zzwong commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

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 Code 2.1.281 refuses to launch in a directory that has its own .claude/ unless that exact directory is trusted. cr creates a fresh checkout for every run, so every reviewer failed with Workspace not trusted on repositories that commit .claude/.
  • Launching in the checkout made Claude load the PR head's .claude/ project settings, including hooks the PR author controls.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Repo scaffolding / maintenance

Verification

  • TestSubprocessClaudeReviewerWorkspaceLaunch now 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 ./... and go vet ./... pass. make lint could 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.
  • End to end on Claude Code 2.1.281: a patched cr review --dry-run --fresh-session against a PR in a repository that commits .claude/ ran all three reviewers to complete (broad); skipped: none, with no trust errors. The same PR failed every reviewer with the released binary on 2.1.281.

Checklist

  • I have read the contributing guide
  • My change follows the project structure and conventions
  • make tidy passes (no dependency changes; not run)
  • make lint passes (see above)
  • make test passes
  • make build passes

Related Issues

Closes #623

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 monit-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.go
  • internal/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

@zzwong
zzwong marked this pull request as ready for review September 23, 2026 20:11
@zzwong
zzwong merged commit ce9d0d1 into main Sep 23, 2026
10 checks passed
@zzwong
zzwong deleted the fix/623-claude-launch-dir branch September 23, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude reviewers fail "Workspace not trusted" on repos with .claude/ (Claude Code 2.1.281); cr should not launch Claude in the PR checkout

2 participants