Skip to content

fix(server): Claude V2 sessions expand ~ in the binary path - #13471

Merged
juliusmarminge merged 2 commits into
t3code/codex-turn-mappingfrom
v2/claude-binary-home
Sep 24, 2026
Merged

juliusmarminge merged 2 commits into
t3code/codex-turn-mappingfrom
v2/claude-binary-home

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

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". ClaudeDriver expands the path for its own probes (binaryPath: expandHomePath(config.binaryPath)). createClaudeAdapterV2 spread the raw config into the adapter's settings instead, and makeClaudeQueryOptions passes that value straight to the Agent SDK as pathToClaudeCodeExecutable.

This PR stands on its own. The same fix for Codex is in #13470.

Change

createClaudeAdapterV2 now sets binaryPath: expandHomePath(config.binaryPath) when it builds the adapter's settings. That is the same helper the driver uses.

Verification

  • Checked that the SDK does not expand ~ itself (@anthropic-ai/claude-agent-sdk 0.3.276, the bundled version). I ran the real query() with HOME set to a temp directory holding an executable stub at $HOME/bin/claude:
    • pathToClaudeCodeExecutable: "~/bin/claude" fails with Claude Code native binary not found at ~/bin/claude, and the stub never runs.
    • The absolute path to the same stub launches it.
  • New test in ClaudeAdapterV2.test.ts ("expands ~ in the configured binary path for the SDK"). It builds the adapter through createClaudeAdapterV2 with binaryPath: "~/bin/claude", starts a turn, and asserts that the query runner received <homedir>/bin/claude as pathToClaudeCodeExecutable.
  • Revert check: without the fix, the test fails with 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 . in apps/server: no errors.
  • vp lint on the two touched files: no new warnings. The existing unused layer warning in ClaudeAdapterV2.ts is unrelated.
  • Not run: repo-wide checks, and a full live Claude session. The SDK check above already covers the part that fails.

Model: Claude Opus 5.5 (Claude Code)

🤖 Generated with Claude Code


Devin Review

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>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Sep 24, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at a9d2cde

Macroscope's review found this PR approvable — This is a narrowly scoped Claude V2 bug fix that expands ~ only for the configured executable path before SDK startup, with a focused regression test and no default, schema, deployment, or static-analysis changes.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 4.9 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.7 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 20.4 KiB — 29.3 KiB ✅
Codex Live turn messages — 2 — 8 ✅
Claude Total thread wire — 4.9 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.7 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 20.8 KiB — 29.3 KiB ✅
Claude Live turn messages — 2 — 8 ✅

Baseline: unavailable · PR result: a9d2cde · Source CI: failure

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 106.1 KiB
  • Claude decoded thread snapshot: 106.4 KiB

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>
@juliusmarminge
juliusmarminge merged commit 62c56ba into t3code/codex-turn-mapping Sep 24, 2026
23 of 24 checks passed
@juliusmarminge
juliusmarminge deleted the v2/claude-binary-home branch September 24, 2026 20:27
juliusmarminge added a commit that referenced this pull request Sep 24, 2026
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 24, 2026
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 25, 2026
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant