fix: remove CLAUDECODE env var detection, centralize stripping#2883
fix: remove CLAUDECODE env var detection, centralize stripping#2883
Conversation
|
🤖 Auto-fixed version bump The version in If you need a minor or major version bump instead, please update |
Repo Guardian - Action Required❌ Ephemeral Content DetectedThe following file violates the repository's ephemeral content policy:
|
Workflow Retrofit: Outside-in Testing & Review ResultsStep 12: Test Suite
Verdict: No test regressions introduced by this PR. Step 17: Code ReviewFindings:
Minor note (not blocking): Step 17b: Security Review
Step 13: Outside-in Testing (16/16 PASS)All tests run with
Critical tests 14-16 verify the actual fix end-to-end: with SummaryPR is clean. No regressions, no missed CLAUDECODE references in source code, security review passed, and all 16 outside-in tests pass including real nested Claude session execution. |
Triage Report - FAST TRACK CANDIDATERisk Level: LOW Analysis✅ Net reduction: -28 LOC (simplification) RationaleThis PR removes duplication and centralizes CLAUDECODE environment variable handling. The centralized Next Steps
Recommendation: FAST_TRACK after CI validation.
|
The Claude Code binary sets CLAUDECODE to block nested sessions, but we always want nested sessions to work. This change: - Removes CLAUDECODE-based adapter selection logic from get_adapter() - Creates centralized build_child_env() in adapters/env.py that strips CLAUDECODE from all child processes in one place - Removes `unset CLAUDECODE` from shell scripts (Python adapters handle it) - Updates tests to verify env stripping without depending on detection - Updates documentation to remove CLAUDECODE as a user-facing concern Follow-up to #2845 quality improvements. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fb1ff86 to
2aec9ea
Compare
|
🤖 Auto-fixed version bump The version in If you need a minor or major version bump instead, please update |
Repo Guardian - Action Required❌ Ephemeral Content DetectedThe following file violates the repository's ephemeral content policy:
|
Summary
CLAUDECODEenvironment variable for adapter selection decisions. The Claude Code binary sets this to block nested sessions, but we always want nested sessions to work.build_child_env()utility insrc/amplihack/recipes/adapters/env.pythat handles strippingCLAUDECODEfrom child process environments in one place, replacing scattered implementations across 15 files.unset CLAUDECODEfrom shell scripts (run_recipe_subprocess.sh, orchestrator-generatedrun.sh) since the Python adapters now handle this centrally.get_adapter()to no longer checkCLAUDECODEfor adapter selection -- it now defaults to Claude SDK if available, then CLI subprocess.CLAUDECODEdetection logic.STREAMING_OUTPUT.md,RECENT_FIXES_MARCH_2026.md,SKILL.md,reference.md) to removeCLAUDECODEas a user-facing concern.Follow-up to #2845 quality improvements.
Test plan
pytest tests/unit/recipes/test_cli_subprocess_temp_dir.py-- 8/8 passpytest tests/unit/recipes/test_streaming_adapters.py-- 15/15 pass (2 pre-existing failures excluded)pytest tests/recipes/test_recipe_runner_parse_json.py-- 26/26 passtests/unit/recipes/are identical to main branch (not introduced by this change)🤖 Generated with Claude Code