From a4b0bc0229b0d31ac0aac3956cc85f1c94db110b Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 26 Sep 2025 00:30:05 +0000 Subject: [PATCH] docs: add detailed comments explaining environment inheritance for Claude CLI auth --- src/integrations/claude-code/run.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/integrations/claude-code/run.ts b/src/integrations/claude-code/run.ts index 1696769a65..291d75003c 100644 --- a/src/integrations/claude-code/run.ts +++ b/src/integrations/claude-code/run.ts @@ -191,9 +191,11 @@ function runProcess({ process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS || CLAUDE_CODE_DEFAULT_MAX_OUTPUT_TOKENS.toString(), }, - // Inherit the shell environment to ensure authentication tokens are available + // IMPORTANT: These options are critical for Claude CLI authentication + // extendEnv: true - Inherits parent process environment variables including ANTHROPIC_API_KEY + // shell: true - Ensures proper environment variable expansion for authentication tokens + // Without these, Claude CLI fails with "Invalid API key" even when properly authenticated extendEnv: true, - // Use shell to ensure proper environment variable expansion shell: true, cwd, maxBuffer: 1024 * 1024 * 1000,