Files
orca/src/shared/ephemeral-setup-terminal-worktree-id.test.ts
T
Vladislav Meshkorudnyjandvladmesh e82dce4382 Fix/remote skill install floating terminal (#6816)
* fix(terminal): scope skill-install terminals to the floating runtime selector (#6789)

Inline setup/onboarding terminals (skill installers, feature tips) create a
PTY under a synthetic per-panel worktree id. On a remote runtime the remote
PTY transport sent that id as `id:<panel>` to `terminal.create`, which the
runtime cannot resolve, so installing a skill via Settings failed with
selector_not_found. Locally it worked because the IPC spawn uses cwd directly
and never resolves the selector.

These terminals are ephemeral floating terminals with no backing worktree, so
brand their id and resolve it to the floating-terminal selector
(global-floating-terminal), which every runtime already maps to the home dir.
Local tab isolation keeps the distinct per-panel id; only the runtime terminal
selector changes. The server is unchanged.

* docs(terminal): add JSDoc for functions touched by the skill-install terminal fix

Document the new ephemeral setup-terminal id helpers, the runtime terminal
selector, and the onboarding/remote-transport entry points so the changed
functions carry contract-level docstrings.

---------

Co-authored-by: vladmesh <vladmesh@gmail.com>
2026-06-29 20:38:11 -07:00

34 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
EPHEMERAL_SETUP_TERMINAL_WORKTREE_ID_PREFIX,
brandEphemeralSetupTerminalWorktreeId,
isEphemeralSetupTerminalWorktreeId
} from './ephemeral-setup-terminal-worktree-id'
describe('ephemeral setup terminal worktree id', () => {
it('brands a panel id with the ephemeral prefix', () => {
expect(brandEphemeralSetupTerminalWorktreeId('feature-wall-orchestration-skill-terminal')).toBe(
`${EPHEMERAL_SETUP_TERMINAL_WORKTREE_ID_PREFIX}feature-wall-orchestration-skill-terminal`
)
})
it('is idempotent for already-branded ids', () => {
const branded = brandEphemeralSetupTerminalWorktreeId('settings-orchestration-skill-terminal')
expect(brandEphemeralSetupTerminalWorktreeId(branded)).toBe(branded)
})
it('recognizes branded ids and rejects real worktree ids', () => {
expect(
isEphemeralSetupTerminalWorktreeId(
brandEphemeralSetupTerminalWorktreeId('feature-tip-cli-skills-terminal')
)
).toBe(true)
expect(isEphemeralSetupTerminalWorktreeId('repo-1::/work/orca/wt')).toBe(false)
expect(isEphemeralSetupTerminalWorktreeId('global-floating-terminal')).toBe(false)
})
it('does not introduce the `::` worktree id separator', () => {
expect(brandEphemeralSetupTerminalWorktreeId('onboarding-inline-terminal')).not.toContain('::')
})
})