fix(terminal): name this app's CLI launcher by absolute path in every local terminal

ORCA_CLI_COMMAND meant three things by lane: an absolute launcher for a structured session, a bare
name for WSL, and nothing for any other terminal, so a structured session's terminal view lost it.
Local terminals now get the same absolute launcher the structured lane gets; WSL keeps its guest
command name, and a terminal whose launcher does not resolve still gets none.
This commit is contained in:
Brennan Benson
2026-09-25 18:41:23 -07:00
parent 4b29be7788
commit dd2853a5a9
2 changed files with 16 additions and 9 deletions
@@ -462,7 +462,8 @@ describe('registerPtyHandlers', () => {
// Why: bare `orca` must resolve to the Orca CLI before /usr/bin/orca (the GNOME screen reader) in Orca terminals (#7904).
expect(entries.indexOf(shimDir)).toBeGreaterThanOrEqual(0)
expect(entries.indexOf(shimDir)).toBeLessThan(entries.indexOf('/usr/bin'))
expect(env.ORCA_CLI_COMMAND).toBeUndefined()
// The same absolute spelling a structured session gets, so a terminal view keeps it too.
expect(env.ORCA_CLI_COMMAND).toBe(join(shimDir, 'orca'))
} finally {
Object.defineProperty(process, 'platform', {
configurable: true,
@@ -479,6 +480,7 @@ describe('registerPtyHandlers', () => {
try {
const env = await daemonSpawnAndGetEnv({ PATH: '/usr/bin' })
expect(env.PATH.split(delimiter)[0]).toBe(join('/tmp/orca-resources', 'bin'))
expect(env.ORCA_CLI_COMMAND?.startsWith(join('/tmp/orca-resources', 'bin'))).toBe(true)
} finally {
if (resourcesPathDescriptor) {
Object.defineProperty(process, 'resourcesPath', resourcesPathDescriptor)
+13 -8
View File
@@ -274,19 +274,24 @@ export function buildPtyHostEnv(
// Why: WSL shells need the managed userData root for shell-ready wrappers; dev-mode terminals need the same export so `orca` targets the live dev instance.
if (opts.isWsl) {
baseEnv.ORCA_USER_DATA_PATH = opts.userDataPath
// Why: managed WSL registration uses `orca-ide`; exposing that literal scopes agent guidance to WSL without a bare-orca shim.
baseEnv.ORCA_CLI_COMMAND = opts.isPackaged ? 'orca-ide' : 'orca-dev'
} else {
if (!opts.isPackaged) {
baseEnv.ORCA_USER_DATA_PATH ??= opts.userDataPath
}
delete baseEnv.ORCA_CLI_COMMAND
} else if (!opts.isPackaged) {
baseEnv.ORCA_USER_DATA_PATH ??= opts.userDataPath
}
prependOrcaCliDirToChildPath(baseEnv, {
const launcher = prependOrcaCliDirToChildPath(baseEnv, {
isPackaged: opts.isPackaged,
userDataPath: opts.userDataPath,
resourcesPath: opts.resourcesPath
})
if (opts.isWsl) {
// Why: managed WSL registration uses `orca-ide`; a guest cannot run the host launcher's path.
baseEnv.ORCA_CLI_COMMAND = opts.isPackaged ? 'orca-ide' : 'orca-dev'
} else if (launcher) {
// Why the absolute launcher, the same spelling a structured session gets: a login shell can
// reorder PATH behind a global install, and a current CLI re-runs itself as this one.
baseEnv.ORCA_CLI_COMMAND = launcher
} else {
delete baseEnv.ORCA_CLI_COMMAND
}
if (
opts.routeBrowserOpensToClient === true &&