mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 02:11:28 +00:00
fix(delegation): strip CLAUDECODE env var to bypass nested session guard
Claude Code v2.1.39+ sets CLAUDECODE env var and refuses to launch if detected, breaking CCS auto-delegation which spawns child Claude processes. Strip the var from both interactive (execClaude) and headless (HeadlessExecutor) spawn paths. Closes #588
This commit is contained in:
@@ -207,10 +207,15 @@ export class HeadlessExecutor {
|
||||
console.error(ui.info(`Delegating to ${modelName}...`));
|
||||
}
|
||||
|
||||
// Strip Claude Code nested session guard env var to allow CCS delegation
|
||||
// (Claude Code v2.1.39+ sets CLAUDECODE to detect nested sessions)
|
||||
const { CLAUDECODE: _nested, ...cleanEnv } = process.env;
|
||||
|
||||
const proc = spawn(claudeCli, args, {
|
||||
cwd,
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
timeout,
|
||||
env: cleanEnv,
|
||||
});
|
||||
|
||||
let stdout = '';
|
||||
|
||||
@@ -84,6 +84,10 @@ export function execClaude(
|
||||
? { ...baseEnv, ...envVars, ...webSearchEnv }
|
||||
: { ...baseEnv, ...webSearchEnv };
|
||||
|
||||
// Strip Claude Code nested session guard env var to allow CCS delegation
|
||||
// (Claude Code v2.1.39+ sets CLAUDECODE to detect nested sessions)
|
||||
delete env.CLAUDECODE;
|
||||
|
||||
// propagate key env vars to tmux session so agent team teammates
|
||||
// (spawned via tmux split-window) inherit the correct config dir
|
||||
if (process.env.TMUX && envVars) {
|
||||
|
||||
Reference in New Issue
Block a user