Files
archived-orca/src/cli/specs/cli-command-names-parity.test.ts
T
Neil c25fad76df fix(agent-teams): run the tmux shim through the headless host's CLI, never the GUI binary (#33389)
* fix(agent-teams): run the tmux shim through the headless host's CLI, never the GUI binary

On an orca serve host the runtime has no Electron resources directory, so the
shim fell back to PATH and picked the AppImage's Electron binary, which booted
Chromium and died on the SUID sandbox. Prefer the host's profile-scoped CLI
launcher, and route agent-teams-tmux through the packaged CLI redirect so a
direct Electron invocation never initializes the GUI.

Fixes #33354

* fix(agent-teams): prefer a fresh CLI over a shim bin inherited from an older leader pane
2026-10-24 21:35:18 -07:00

35 lines
1.3 KiB
TypeScript

import { describe, expect, it, vi } from 'vitest'
import { CLI_COMMAND_NAMES } from '../../main/startup/cli-command-names'
import { getCliLaunchArgs, getDirectServeLaunch } from '../../main/startup/cli-launch-redirect'
import { COMMAND_SPECS } from './index'
vi.mock('electron', () => ({ app: { commandLine: { getSwitchValue: () => '' } } }))
describe('CLI launch redirect command names', () => {
it('routes every CLI root through command redirect or direct serve', () => {
// Why agent-teams-tmux: the CLI dispatches it before spec parsing, and the tmux shim runs it.
const roots = new Set([...COMMAND_SPECS.map((spec) => spec.path[0]), 'agent-teams-tmux'])
const options = {
platform: 'linux',
isPackaged: true,
commandNames: CLI_COMMAND_NAMES
} as const
expect(roots.size).toBeGreaterThan(0)
for (const root of roots) {
const argv = ['/opt/Orca/orca-ide', '--disable-gpu', root, '--json']
const cliArgs = getCliLaunchArgs(argv, '/opt/Orca/resources/cli/index.js', options)
if (root === 'serve') {
expect(cliArgs, root).toBeNull()
expect(getDirectServeLaunch(argv, options), root).toEqual({
args: [root, '--json'],
userDataPath: null,
noSandbox: false
})
} else {
expect(cliArgs, root).toEqual([root, '--json'])
}
}
})
})