Skip to content

Comments

fix(happy-cli): strip CLAUDECODE env var from daemon-spawned sessions#691

Open
davidrimshnick wants to merge 1 commit intoslopus:mainfrom
davidrimshnick:fix/strip-claudecode-env-from-daemon
Open

fix(happy-cli): strip CLAUDECODE env var from daemon-spawned sessions#691
davidrimshnick wants to merge 1 commit intoslopus:mainfrom
davidrimshnick:fix/strip-claudecode-env-from-daemon

Conversation

@davidrimshnick
Copy link

Summary

  • When happy daemon start is run from within a Claude Code session (VS Code terminal, Claude Code CLI, etc.), the daemon inherits CLAUDECODE=1 in its environment
  • This was passed through to all child session processes via process.env
  • Claude Code detects CLAUDECODE=1 and refuses to start with "cannot be launched inside another Claude Code session", causing every remote session to immediately fail with "Process exited unexpectedly"
  • Fix: strip CLAUDECODE from process.env before spawning session processes

Fixes #682

Test plan

  • Added unit tests verifying CLAUDECODE is stripped while other env vars are preserved
  • Added test verifying extraEnv still merges correctly after stripping
  • Manual: start daemon from within a Claude Code session, verify remote sessions work

🤖 Generated with Claude Code

@davidrimshnick davidrimshnick force-pushed the fix/strip-claudecode-env-from-daemon branch from 85c71f1 to e39cad3 Compare February 21, 2026 19:12
When the daemon is started from within a Claude Code session (e.g. VS
Code terminal), it inherits CLAUDECODE=1. This was passed to child
session processes, causing Claude Code to refuse to launch with
"cannot be launched inside another Claude Code session".

Strip CLAUDECODE from process.env before spawning session processes.

Fixes slopus#682

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@davidrimshnick davidrimshnick force-pushed the fix/strip-claudecode-env-from-daemon branch from e39cad3 to df7e4c0 Compare February 21, 2026 19:16
@davidrimshnick
Copy link
Author

Merge note: This PR modifies the non-tmux spawn path in daemon/run.ts (replaces the TODO comment with CLAUDECODE env stripping), which overlaps with #1 on the fork (feat/resume-session-from-mobile) that removes the same TODO and adds --resume args. If both are merged, the second will have a trivial conflict — just keep both the --resume args and the CLAUDECODE stripping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daemon inherits CLAUDECODE env var, causing all remote sessions to crash

1 participant