Summary
On Windows, routing chat through either Claude CLI provider (claude-code:<model> or claude_agent_sdk) fails on every turn because the harness system prompt is passed as a single command-line argument. The resulting command line exceeds Windows' 32,767-character CreateProcess limit, so the spawn fails before the CLI ever runs.
Problem
Environment: Windows 11 Home build 26200, OpenHuman beta v0.61.8 (official installer, desktop), Claude Code CLI v2.1.156 at C:\Users\<user>\.local\bin\claude.exe (the CLI works fine when invoked directly from a shell, both interactive and claude -p).
Steps to reproduce:
- On Windows, install the Claude Code CLI and sign in.
- Set
chat_provider = "claude-code:claude-sonnet-5" in config.toml (or connect the Claude Code provider in the LLM settings UI).
- Send any chat message.
- Every turn fails; the UI shows the generic "Something went wrong" toast.
Expected: the turn is routed through the local Claude Code CLI.
Actual: the daemon log shows the spawn failing with the underlying OS error:
WRN [journal] run failed error=model error: model error: openhuman provider chat failed: failed to spawn `claude`: The filename or extension is too long. (os error 206)
With chat_provider = "claude_agent_sdk" the same failure occurs, but the log drops the OS error (the anyhow source isn't printed, which made this much harder to diagnose):
WRN [journal] run failed error=model error: model error: openhuman provider chat failed: failed to spawn claude binary 'C:\Users\<user>\.local\bin\claude.exe'
os error 206 (ERROR_FILENAME_EXCED_RANGE) is what CreateProcess returns when the command line exceeds 32,767 UTF-16 characters.
Solution (suspected cause + proposed fix)
src/openhuman/inference/provider/claude_code/driver.rs builds argv with --append-system-prompt <system prompt> — the full tinyagents harness system prompt (log shows tools=78 on a plain chat turn) goes into one argv entry. Windows argv is a flat command-line string capped at 32,767 chars; macOS/Linux allow ~1–2 MB, which is why this only breaks on Windows.
src/openhuman/inference/provider/claude_agent_sdk/subprocess.rs passes the entire composed message via -p <full_message> argv — same wall.
- Diagnostic confirmation: substituting the configured binary with
C:\Windows\System32\cmd.exe fails identically, proving the args (not the binary) are the problem.
Proposed fix: deliver the system prompt out-of-band on Windows — the claude-code driver already streams messages over stdin as stream-json, so the system prompt could ride the same channel, or be written to a temp file referenced via the CLI's settings mechanisms — keeping argv short. Independent quick win: print the full error chain ({:#}) when spawn fails in claude_agent_sdk/subprocess.rs so the OS error isn't swallowed.
Acceptance criteria
Related
Summary
On Windows, routing chat through either Claude CLI provider (
claude-code:<model>orclaude_agent_sdk) fails on every turn because the harness system prompt is passed as a single command-line argument. The resulting command line exceeds Windows' 32,767-characterCreateProcesslimit, so the spawn fails before the CLI ever runs.Problem
Environment: Windows 11 Home build 26200, OpenHuman beta v0.61.8 (official installer, desktop), Claude Code CLI v2.1.156 at
C:\Users\<user>\.local\bin\claude.exe(the CLI works fine when invoked directly from a shell, both interactive andclaude -p).Steps to reproduce:
chat_provider = "claude-code:claude-sonnet-5"inconfig.toml(or connect the Claude Code provider in the LLM settings UI).Expected: the turn is routed through the local Claude Code CLI.
Actual: the daemon log shows the spawn failing with the underlying OS error:
With
chat_provider = "claude_agent_sdk"the same failure occurs, but the log drops the OS error (the anyhow source isn't printed, which made this much harder to diagnose):os error 206 (
ERROR_FILENAME_EXCED_RANGE) is whatCreateProcessreturns when the command line exceeds 32,767 UTF-16 characters.Solution (suspected cause + proposed fix)
src/openhuman/inference/provider/claude_code/driver.rsbuilds argv with--append-system-prompt <system prompt>— the full tinyagents harness system prompt (log showstools=78on a plain chat turn) goes into one argv entry. Windows argv is a flat command-line string capped at 32,767 chars; macOS/Linux allow ~1–2 MB, which is why this only breaks on Windows.src/openhuman/inference/provider/claude_agent_sdk/subprocess.rspasses the entire composed message via-p <full_message>argv — same wall.C:\Windows\System32\cmd.exefails identically, proving the args (not the binary) are the problem.Proposed fix: deliver the system prompt out-of-band on Windows — the claude-code driver already streams messages over stdin as
stream-json, so the system prompt could ride the same channel, or be written to a temp file referenced via the CLI's settings mechanisms — keeping argv short. Independent quick win: print the full error chain ({:#}) when spawn fails inclaude_agent_sdk/subprocess.rsso the OS error isn't swallowed.Acceptance criteria
claude-code:<model>completes on Windows 11 with a harness system prompt larger than 32 KB.failed to spawnlog lines include the underlyingio::Error/ OS error code.Related