From 4b3b60245727f5507adb4ae7b25deebd124f284f Mon Sep 17 00:00:00 2001 From: jam Date: Mon, 23 Mar 2026 09:35:05 +0100 Subject: [PATCH] fix(claude-code): inject HOME and null stdin in stream() subprocess Mirror the same environment fixes applied to complete(): inject HOME so the CLI locates ~/.claude/credentials when running as a service, and set stdin to null so the process does not block on interactive input. Refs: RightNow-AI/openfang#295 --- crates/openfang-runtime/src/drivers/claude_code.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/openfang-runtime/src/drivers/claude_code.rs b/crates/openfang-runtime/src/drivers/claude_code.rs index 9bc154a0..a7efae1d 100644 --- a/crates/openfang-runtime/src/drivers/claude_code.rs +++ b/crates/openfang-runtime/src/drivers/claude_code.rs @@ -474,6 +474,11 @@ impl LlmDriver for ClaudeCodeDriver { Self::apply_env_filter(&mut cmd); + // Same HOME and stdin hygiene as the non-streaming path. + if let Some(home) = home_dir() { + cmd.env("HOME", &home); + } + cmd.stdin(std::process::Stdio::null()); cmd.stdout(std::process::Stdio::piped()); cmd.stderr(std::process::Stdio::piped());