Skip to content

Commit 5038f10

Browse files
committed
fix: unset CLAUDECODE env var to allow nested Claude Code sessions in spawned coders
This fixes the issue where spawned coder sessions would fail with 'Claude Code cannot be launched inside another Claude Code session' error. The fix unsets the CLAUDECODE environment variable before launching the Claude CLI in tmux sessions.
1 parent 3dbe7b9 commit 5038f10

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/go/cmd/coders/spawn.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ func buildToolCommand(tool, task, model, sessionID string, useOllama bool) strin
327327
}
328328

329329
// Set environment variables
330-
envVars := fmt.Sprintf("CODERS_SESSION_ID=%s", sessionID)
330+
// Unset CLAUDECODE to allow nested Claude Code sessions
331+
envVars := fmt.Sprintf("CLAUDECODE= CODERS_SESSION_ID=%s", sessionID)
331332

332333
// Add Ollama env var mappings if --ollama flag is set
333334
if useOllama {

0 commit comments

Comments
 (0)