fix: unset CLAUDECODE env var to allow nested Claude subprocess calls
Claude Code refuses to launch inside another Claude Code session. Strip the CLAUDECODE marker from the inherited environment so that cross-eval can spawn Claude as a subprocess from within Claude Code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,9 @@ def build_runtime_environment(
|
||||
) -> tuple[dict[str, str], list[Path], dict[str, str]]:
|
||||
"""Build subprocess env plus metadata about loaded files and names."""
|
||||
env = os.environ.copy() if execution.inherit_env else {}
|
||||
# Remove CLAUDECODE to avoid "nested session" errors when spawning
|
||||
# Claude Code as a subprocess from within a Claude Code session.
|
||||
env.pop("CLAUDECODE", None)
|
||||
loaded_files = resolve_env_files(execution, project_root)
|
||||
loaded_values: dict[str, str] = {}
|
||||
for path in loaded_files:
|
||||
|
||||
Reference in New Issue
Block a user