Repository navigation
fix(inference): keep Claude CLI prompts out of Windows argv - #5103
Conversation
📝 WalkthroughWalkthroughBoth Claude providers now avoid command-line size limits by delivering system prompts through subprocess stdin or per-turn files. Invocation construction, budget flags, spawn error context, and regression tests were updated. ChangesClaude prompt transport
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant chat_with_system
participant build_invocation
participant claude_cli
chat_with_system->>build_invocation: construct args and stdin payload
build_invocation-->>chat_with_system: return invocation
chat_with_system->>claude_cli: spawn with piped stdin
chat_with_system->>claude_cli: write request and shut down stdin
claude_cli-->>chat_with_system: return CLI output
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openhuman/inference/provider/claude_code/driver.rs`:
- Around line 189-207: Update append_system_prompt_args and its call site to add
grep-friendly diagnostics for the prompt-file flow: log when a non-empty prompt
enters the file-write branch, log successful file creation, and log the write
error with the target path before propagating it. Do not log the prompt contents
or other sensitive data, and preserve the existing empty-prompt behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2abf3b90-1322-43fd-879e-2218da2e4d9a
📒 Files selected for processing (2)
src/openhuman/inference/provider/claude_agent_sdk/subprocess.rssrc/openhuman/inference/provider/claude_code/driver.rs
Summary
--append-system-prompt-filein the existing per-turn scratch directory.Problem
Both Claude CLI providers place the harness prompt in argv. Windows flattens argv into a command line capped at 32,767 UTF-16 code units, so sufficiently large harness prompts fail in
CreateProcessbefore Claude starts. The Agent SDK path also returned only the outer anyhow context, hiding the useful OS error from the journal log.Solution
The Claude Code driver writes a non-empty appended system prompt into its private per-turn temp directory and passes the path through Claude's supported
--append-system-prompt-fileflag. The temp directory remains alive for the turn and is cleaned up automatically.The Agent SDK provider keeps its existing composed
[SYSTEM]request format but sends those bytes through piped stdin. It explicitly closes and drops stdin so Claude receives EOF before output is read. Spawn failures are logged with the sourceio::Error, and the returned message includes that source while retaining the anyhow chain.Submission Checklist
Rust Core Coverage (cargo-llvm-cov)andPR CI Gatechecks on commit863ecda5dd78d15fea40499b1745f7eb0e755951.## Related- N/A: no coverage-matrix feature ID applies.Closes #NNNin the## RelatedsectionImpact
Windows desktop users can spawn both Claude CLI providers with harness prompts larger than the platform command-line limit. macOS and Linux use the same bounded-argv transports. Prompt contents remain transient and are not logged; Claude Code's file lives only in the existing per-turn private temp directory.
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
codex/5044-windows-claude-argv863ecda5dd78d15fea40499b1745f7eb0e755951Validation Run
pnpm --filter openhuman-app format:check(pre-push hook)pnpm typecheck(pre-push hook)cargo fmt --all -- --check;cargo check --lib;cargo clippy -p openhuman -- -D warningsFocused Cargo commands were run with temporary patch overrides pointing to the exact gitlink revisions
tinycortex@9a0603aandtinyflows@e5327de, because this local working tree retained newer submodule checkouts from earlier work.Validation Blocked
cargo-llvm-covis unavailable, but the authoritativeRust Core Coverage (cargo-llvm-cov)and aggregatePR CI Gatechecks passed on the current commit.Behavior Changes
Parity Contract
Duplicate / Superseded PR Handling
Summary by CodeRabbit