fix(server): Claude V2 sessions expand ~ in the binary path - #13471
Conversation
The Claude driver expands a leading ~ in binaryPath for its own probes, but createClaudeAdapterV2 spread the raw config into the adapter's settings, so the Agent SDK received a literal ~/... as pathToClaudeCodeExecutable. The SDK does not expand it and fails with "Claude Code native binary not found". Expand it where the adapter builds its settings. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped Claude V2 bug fix that expands Notes:
You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
The nodeBuiltinImport rule does not apply to this test file, so the directive tripped TS377000 in the typecheck step. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
62c56ba
into
t3code/codex-turn-mapping
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
If the Claude binary path setting starts with
~(for example~/bin/claude), every V2 Claude turn fails with "Claude Code native binary not found at ~/bin/claude".ClaudeDriverexpands the path for its own probes (binaryPath: expandHomePath(config.binaryPath)).createClaudeAdapterV2spread the rawconfiginto the adapter's settings instead, andmakeClaudeQueryOptionspasses that value straight to the Agent SDK aspathToClaudeCodeExecutable.This PR stands on its own. The same fix for Codex is in #13470.
Change
createClaudeAdapterV2now setsbinaryPath: expandHomePath(config.binaryPath)when it builds the adapter's settings. That is the same helper the driver uses.Verification
~itself (@anthropic-ai/claude-agent-sdk0.3.276, the bundled version). I ran the realquery()withHOMEset to a temp directory holding an executable stub at$HOME/bin/claude:pathToClaudeCodeExecutable: "~/bin/claude"fails withClaude Code native binary not found at ~/bin/claude, and the stub never runs.ClaudeAdapterV2.test.ts("expands ~ in the configured binary path for the SDK"). It builds the adapter throughcreateClaudeAdapterV2withbinaryPath: "~/bin/claude", starts a turn, and asserts that the query runner received<homedir>/bin/claudeaspathToClaudeCodeExecutable.expected [ '~/bin/claude' ] to deeply equal [ '/home/julius/bin/claude' ].vp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: 123 passed.vp exec tsc --noEmit -p .inapps/server: no errors.vp linton the two touched files: no new warnings. The existing unusedlayerwarning inClaudeAdapterV2.tsis unrelated.Model: Claude Opus 5.5 (Claude Code)
🤖 Generated with Claude Code