From f05da690f072d66c1df30862555fc7e15c75eca1 Mon Sep 17 00:00:00 2001 From: BAEKSEUNGHYEON <144263374+Baek-Seunghyun@users.noreply.github.com> Date: Tue, 27 Oct 2026 03:35:20 +0900 Subject: [PATCH] fix(terminal): strip inherited CLAUDECODE, EXECPATH, and ENTRYPOINT markers from PTY env (#10188) An Orca launched from inside a Claude Code session inherits CLAUDECODE, CLAUDE_CODE_EXECPATH, and CLAUDE_CODE_ENTRYPOINT alongside the child-session stamps #9961 already strips. Every pane then looks nested to Claude Code and to agent-aware tools, and the inherited entrypoint overrides Claude's own detection. Add them to the existing inherited-stamp deletion list so every local, daemon, and relay spawn drops them while explicit pane values win. Closes #9155 Co-authored-by: Neil --- src/main/ipc/pty/host-env/spawn-env-keys.ts | 7 +++++-- src/main/ipc/pty/pty-spawn-env-terminal-basics.test.ts | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/ipc/pty/host-env/spawn-env-keys.ts b/src/main/ipc/pty/host-env/spawn-env-keys.ts index 64697b300e0..3422726b7ca 100644 --- a/src/main/ipc/pty/host-env/spawn-env-keys.ts +++ b/src/main/ipc/pty/host-env/spawn-env-keys.ts @@ -12,11 +12,14 @@ export const AGENT_HOOK_RUNTIME_ENV_KEYS = [ 'ORCA_CLAUDE_AGENT_STATUS_SETTINGS' ] as const -// Inherited Claude child stamps would disable independent-pane transcript persistence. +// Inherited Claude child stamps make an independent pane act as the launching session's child. export const CLAUDE_CHILD_SESSION_STAMP_ENV_KEYS = [ + 'CLAUDECODE', 'CLAUDE_CODE_CHILD_SESSION', 'CLAUDE_CODE_SESSION_ID', - 'CLAUDE_CODE_BRIDGE_SESSION_ID' + 'CLAUDE_CODE_BRIDGE_SESSION_ID', + 'CLAUDE_CODE_EXECPATH', + 'CLAUDE_CODE_ENTRYPOINT' ] as const // Inherited structured-session IDs would make every pane claim the parent orchestration caller. diff --git a/src/main/ipc/pty/pty-spawn-env-terminal-basics.test.ts b/src/main/ipc/pty/pty-spawn-env-terminal-basics.test.ts index f476fa505db..b8246352e7c 100644 --- a/src/main/ipc/pty/pty-spawn-env-terminal-basics.test.ts +++ b/src/main/ipc/pty/pty-spawn-env-terminal-basics.test.ts @@ -471,11 +471,17 @@ describe('registerPtyHandlers', () => { const env = await spawnAndGetEnv(undefined, { CLAUDE_CODE_CHILD_SESSION: '1', CLAUDE_CODE_SESSION_ID: '85935aed-98a7-4094-89a8-85c75e1a5a95', - CLAUDE_CODE_BRIDGE_SESSION_ID: 'session_01UCkWN5nDXNyD1V7cfamCxa' + CLAUDE_CODE_BRIDGE_SESSION_ID: 'session_01UCkWN5nDXNyD1V7cfamCxa', + CLAUDECODE: '1', + CLAUDE_CODE_EXECPATH: '/old/claude', + CLAUDE_CODE_ENTRYPOINT: 'cli' }) expect(env.CLAUDE_CODE_CHILD_SESSION).toBeUndefined() expect(env.CLAUDE_CODE_SESSION_ID).toBeUndefined() expect(env.CLAUDE_CODE_BRIDGE_SESSION_ID).toBeUndefined() + expect(env.CLAUDECODE).toBeUndefined() + expect(env.CLAUDE_CODE_EXECPATH).toBeUndefined() + expect(env.CLAUDE_CODE_ENTRYPOINT).toBeUndefined() }) it('strips an inherited agent session id so a pane never claims that session', async () => { // Inherited structured-session IDs must not make every pane claim the parent orchestration caller.