mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(cli): prevent CLAUDE_CODE_ENTRYPOINT leak into local spawn (#452)
extractSDKMetadataAsync() calls query() which sets CLAUDE_CODE_ENTRYPOINT='sdk-ts' on the current process env. When claudeLocal() later spawns the claude CLI, the child inherits this env var, causing Claude Code to treat the session as SDK-launched. This makes the session invisible to `claude --resume`. Strip CLAUDE_CODE_ENTRYPOINT from the child env so the local spawn uses its own default entrypoint. Closes #450
This commit is contained in:
@@ -76,8 +76,15 @@ export async function claudeLocal(opts: {
|
||||
|
||||
// Prepare environment variables
|
||||
// Note: Local mode uses global Claude installation
|
||||
//
|
||||
// SDK metadata extraction (extractSDKMetadataAsync → query()) sets
|
||||
// CLAUDE_CODE_ENTRYPOINT='sdk-ts' on the current process. If leaked
|
||||
// into the local spawn, Claude Code thinks it was SDK-launched and
|
||||
// excludes the session from `claude --resume`. Destructure it out
|
||||
// so the child uses its own default entrypoint.
|
||||
const { CLAUDE_CODE_ENTRYPOINT: _, ...cleanEnv } = process.env
|
||||
const env = {
|
||||
...process.env,
|
||||
...cleanEnv,
|
||||
DISABLE_AUTOUPDATER: '1',
|
||||
...opts.claudeEnvVars
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user