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 <neil@stably.ai>
This commit is contained in:
BAEKSEUNGHYEON
2026-10-26 11:35:20 -07:00
committed by GitHub
co-authored by Neil
parent 916c6a09b5
commit f05da690f0
2 changed files with 12 additions and 3 deletions
+5 -2
View File
@@ -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.
@@ -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.