fix(bridge): strip inherited CLAUDECODE env vars before spawning claude#2
Open
CommsConnectgmbh wants to merge 1 commit into
Open
fix(bridge): strip inherited CLAUDECODE env vars before spawning claude#2CommsConnectgmbh wants to merge 1 commit into
CommsConnectgmbh wants to merge 1 commit into
Conversation
If the bridge is started from inside a Claude Code session, the spawned `claude` CLI inherits CLAUDECODE / CLAUDE_CODE_* env vars and refuses to launch with "Cannot be launched inside another Claude Code session". Apply the strip to both spawn sites (stream-json child + interactive PTY) via a shared cleanClaudeEnv() helper. Refs #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the showstopper from #1: when the bridge is started from inside a Claude Code session, the spawned
claudeprocess inheritsCLAUDECODE/CLAUDE_CODE_*env vars and refuses to launch with:This makes the bridge effectively unstartable / undebuggable from a Claude Code session.
Changes
cleanClaudeEnv(extra)helper inbridge/src/server.mjsthat returnsprocess.envwith the inherited Claude-Code vars stripped (CLAUDECODE,CLAUDE_CODE_ENTRYPOINT,CLAUDE_CODE_SESSION_ID,CLAUDE_AGENT_SDK_VERSION,CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING,CLAUDE_CODE_ENABLE_TASKS).spawn(CLAUDE_BIN, ...))pty.spawn(CLAUDE_BIN, ...))Test plan
--resume).Closes #1 (partially — node-pty bump tracked separately).