From 6f79ce18d204ded9f9a32a81997b776b6b48198b Mon Sep 17 00:00:00 2001 From: ezl-keygraph Date: Thu, 12 Feb 2026 22:12:52 +0530 Subject: [PATCH] fix: restore CLAUDE_CODE_MAX_OUTPUT_TOKENS env var support Re-add the env var that was removed during SDK upgrade. Needed for controlling output token limits in SDK subprocesses. --- .env.example | 3 +++ README.md | 2 ++ docker-compose.yml | 1 + src/ai/claude-executor.ts | 4 +++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index b0d1875..b9aab98 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,9 @@ # Shannon Environment Configuration # Copy this file to .env and fill in your credentials +# Recommended output token configuration for larger tool outputs +CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000 + # ============================================================================= # OPTION 1: Direct Anthropic (default, no router) # ============================================================================= diff --git a/README.md b/README.md index f8dbea0..89e2bfa 100644 --- a/README.md +++ b/README.md @@ -119,10 +119,12 @@ cd shannon # Option A: Export environment variables export ANTHROPIC_API_KEY="your-api-key" # or CLAUDE_CODE_OAUTH_TOKEN +export CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000 # recommended # Option B: Create a .env file cat > .env << 'EOF' ANTHROPIC_API_KEY=your-api-key +CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000 EOF # 3. Run a pentest diff --git a/docker-compose.yml b/docker-compose.yml index b68c0b3..e54ba1f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,6 +24,7 @@ services: - ANTHROPIC_AUTH_TOKEN=${ANTHROPIC_AUTH_TOKEN:-} # Auth token for router - ROUTER_DEFAULT=${ROUTER_DEFAULT:-} # Model name when using router (e.g., "gemini,gemini-2.5-pro") - CLAUDE_CODE_OAUTH_TOKEN=${CLAUDE_CODE_OAUTH_TOKEN:-} + - CLAUDE_CODE_MAX_OUTPUT_TOKENS=${CLAUDE_CODE_MAX_OUTPUT_TOKENS:-64000} depends_on: temporal: condition: service_healthy diff --git a/src/ai/claude-executor.ts b/src/ai/claude-executor.ts index 81093d0..ceab2d6 100644 --- a/src/ai/claude-executor.ts +++ b/src/ai/claude-executor.ts @@ -220,7 +220,9 @@ export async function runClaudePrompt( const mcpServers = buildMcpServers(sourceDir, agentName); // Build env vars to pass to SDK subprocesses - const sdkEnv: Record = {}; + const sdkEnv: Record = { + CLAUDE_CODE_MAX_OUTPUT_TOKENS: process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS || '64000', + }; if (process.env.ANTHROPIC_API_KEY) { sdkEnv.ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY; }