test: remove low-value launch and runtime inventories (#43354)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-16 17:22:54 -08:00
committed by GitHub
co-authored by OrcaWin
parent be32ea71eb
commit 4b8a9b10c0
5 changed files with 5 additions and 529 deletions
@@ -5,7 +5,6 @@ import { afterEach, describe, expect, it } from 'vitest'
import { runProcessSync } from '@orca/process-host'
import { getRemoteHostPlatform } from '../../ssh/remote-host/ssh-remote-platform'
import { selectOrcadSlotRuntimeCommand } from './orcad-remote-runtime'
import { stopOrcadCommand } from './orcad-remote-process-control'
const directories: string[] = []
const host = getRemoteHostPlatform('linux-x64')
@@ -63,22 +62,9 @@ describe.skipIf(process.platform === 'win32')('POSIX slot runtime selection', ()
})
it.each([
['empty', ''],
['short', 'abc123'],
['uppercase', NODE_SHA.toUpperCase()],
['path traversal', `../${NODE_SHA.slice(3)}`]
])('refuses a Node slot with a %s marker', (_label, marker) => {
expect(launch(nodeSlot({ marker }), process.execPath)).toMatchObject({ code: 78, stdout: '' })
})
it('reads a stop verdict from a Node slot through its pinned runtime', () => {
const slot = nodeSlot()
writeFileSync(join(slot, '.orcad-pid'), String(process.pid))
const result = runProcessSync({
program: '/bin/sh',
args: ['-c', stopOrcadCommand(host, slot, { waitSeconds: 1, nodePath: '/missing-host-node' })]
})
// Successful execution without a corroborating readiness PID remains unverifiable.
expect(result).toMatchObject({ code: 0, stdout: 'UNKNOWN\n' })
})
})
@@ -8,15 +8,7 @@ import { listRemoteInstallBaseDirsCommand } from './remote-install-gc-listing-co
import { probeRemoteInstallCompleteCommand } from './remote-install-completeness-command'
import { getRemoteHostPlatform } from '../../ssh/remote-host/ssh-remote-platform'
import {
ORCAD_INSTALL_MODEL,
RELAY_INSTALL_MODEL,
remoteInstallDirOwner,
remoteInstallGcPermits
} from './remote-install-model'
const RELAY_DIRS = ['relay-0.1.0+abcdef123456', 'relay-v0.1.0', 'relay-1.2.3']
const ORCAD_DIRS = ['orcad-0.1.0+abcdef123456', 'orcad-v0.1.0', 'orcad-1.2.3']
import { ORCAD_INSTALL_MODEL, RELAY_INSTALL_MODEL } from './remote-install-model'
describe('remote install namespace', () => {
it.skipIf(process.platform === 'win32')('rejects an install missing its search binary', () => {
@@ -40,16 +32,6 @@ describe('remote install namespace', () => {
})
describe('GC ownership — each model collects only its own namespace', () => {
it.each(ORCAD_DIRS)('the relay never permits GC of %s', (dirName) => {
expect(remoteInstallDirOwner(dirName)).toBe('orcad')
expect(remoteInstallGcPermits(RELAY_INSTALL_MODEL, dirName)).toBe(false)
})
it.each(RELAY_DIRS)('orcad never permits GC of %s', (dirName) => {
expect(remoteInstallDirOwner(dirName)).toBe('relay')
expect(remoteInstallGcPermits(ORCAD_INSTALL_MODEL, dirName)).toBe(false)
})
it.skipIf(process.platform === 'win32')(
'keeps runtimes/ out of every model listing, including older clients’ prefix scans',
() => {
@@ -64,70 +64,6 @@ describe('worker transcript wire bounds', () => {
)
})
it('bounds a spawn-group state a newer build wrote as an oversized open string', () => {
const result = boundWorkerTranscriptMessages([
{
id: 'message-roster-state',
role: 'system',
timestamp: null,
source: 'transcript',
blocks: [
{
type: 'subagent-group',
groupId: 'g'.repeat(900),
agents: [
{
id: 'i'.repeat(900),
label: 'l'.repeat(900),
state: 's'.repeat(900) as 'working'
}
]
}
]
}
])
const block = result.messages[0]?.blocks[0]
const agent = block?.type === 'subagent-group' ? block.agents[0] : undefined
expect(block?.type === 'subagent-group' ? block.groupId.length : 0).toBe(512)
expect(agent?.id.length).toBe(512)
expect(agent?.label.length).toBe(512)
// A clipped state is not a valid known state; report unverifiable.
expect(agent?.state).toBe('unverifiable')
expect(result.limited).toBe(true)
})
it('bounds a background-task kind and state a newer build wrote as open strings', () => {
const result = boundWorkerTranscriptMessages([
JSON.parse(
JSON.stringify({
id: 'message-task-state',
role: 'system',
timestamp: null,
source: 'transcript',
blocks: [
{
type: 'background-task',
taskId: 'task-1',
kind: 'k'.repeat(900),
label: 'l'.repeat(900),
state: 's'.repeat(900)
}
]
})
)
])
const block = result.messages[0]?.blocks[0]
if (block?.type !== 'background-task') {
throw new Error('expected a background-task block')
}
expect(block.kind).toBe('unknown')
expect(block.label).toHaveLength(512)
expect(block.state).toBe('unverifiable')
expect(result.limited).toBe(true)
})
it('keeps two roster ids sharing a 512-char prefix distinct', () => {
// Digest roster keys so equal prefixes cannot merge distinct children.
const head = 'a'.repeat(512)
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import type { Repo } from '../../../../shared/repository/repo-types'
import '../../../../shared/agent-status/identity/agent-kind'
import { getDefaultSettings } from '../../../../shared/orca-profiles/constants'
@@ -28,9 +28,7 @@ vi.mock('../../../opencode/model-launch/opencode-launch-model-context', () => ({
import {
buildWorktreeStartupForAgent,
buildWorktreeStartupForDraft,
resolveWorktreeCreateAgentStartup,
resolveWorktreeStartupDraftAgent
buildWorktreeStartupForDraft
} from './runtime-worktree-agent-startup'
function makeRepo(fields: Partial<Repo>): Repo {
@@ -61,59 +59,6 @@ const settings = {
defaultTuiAgent: null
}
/** The launched CLI name is the whole decision: `orca` is the relay shim, `orca-ide` is local. */
async function launchCliNameFor(repo: Repo): Promise<string> {
return (
await buildWorktreeStartupForAgent({
repo,
settings,
agent: 'claude-agent-teams',
getLaunchRuntime: () => LINUX,
toSessionOptions: () => undefined
})
).startup.command.split(' ')[0]!
}
describe('buildWorktreeStartupForAgent host resolution', () => {
// Two hosts catch launch shapes resolved from another host's row (ssh:m4air to openclaw leak).
it('drops the Linux-only rename for both spellings of SSH ownership on two hosts', async () => {
expect(await launchCliNameFor(makeRepo({ connectionId: 'm4air' }))).toBe('orca')
expect(await launchCliNameFor(makeRepo({ executionHostId: 'ssh:openclaw' }))).toBe('orca')
})
it('keeps the Linux rename for a local row carrying a stale connection', async () => {
expect(
await launchCliNameFor(makeRepo({ connectionId: 'm4air', executionHostId: 'local' }))
).toBe('orca-ide')
})
it('drops the rename for a runtime host reaching a nested SSH target', async () => {
expect(
await launchCliNameFor(makeRepo({ connectionId: 'nested', executionHostId: 'runtime:vm-1' }))
).toBe('orca')
})
it('uses the headless runtime CLI with no nested SSH target (#33920)', async () => {
expect(await launchCliNameFor(makeRepo({ executionHostId: 'runtime:vm-1' }))).toBe('orca')
})
})
// Host-built startup must use the same shell fact for quoting and spawn.
it('quotes a worktree startup for its fact, not the Settings shell, and hands the fact on', async () => {
const pty = { shellOverride: 'powershell.exe', terminalWindowsWslDistro: null }
const launchRuntime: AgentLaunchRuntime = { platform: 'win32', pty }
const result = await buildWorktreeStartupForAgent({
repo: makeRepo({ path: 'C:\\repo' }),
settings: { ...settings, terminalWindowsShell: 'wsl.exe' },
agent: 'claude',
prompt: "fix Bob's bug",
getLaunchRuntime: () => ({ platform: 'win32', shell: 'powershell', launchRuntime }),
toSessionOptions: () => undefined
})
expect(result.startup.command).toContain("'fix Bob''s bug'")
expect(result.launchRuntime).toBe(launchRuntime)
})
describe('buildWorktreeStartupForAgent prompt carry', () => {
const build = (onPromptCarry?: (carried: boolean) => void, terminalDefaultShell = '/bin/bash') =>
buildWorktreeStartupForAgent({
@@ -140,19 +85,6 @@ describe('buildWorktreeStartupForAgent prompt carry', () => {
expect(result.followup).toBeUndefined()
expect(onPromptCarry).toHaveBeenCalledWith(false)
})
it('carries a short-lined multi-line prompt on a local zsh line, as main typed it', async () => {
const onPromptCarry = vi.fn()
const result = await build(onPromptCarry, '/bin/zsh')
expect(result.startup.command).toContain('summarize the diff\nthen list the risks')
expect(onPromptCarry).toHaveBeenCalledWith(true)
})
it('keeps folding the prompt for a caller that delivers nothing afterwards', async () => {
// `orca worktree create --prompt` has no post-start paste of its own for an argv agent.
expect((await build()).startup.command).toContain('summarize the diff')
})
})
describe('buildWorktreeStartupForDraft agent detection', () => {
@@ -171,69 +103,6 @@ describe('buildWorktreeStartupForDraft agent detection', () => {
})
})
describe('buildWorktreeStartupForAgent extra agent args', () => {
it('refuses invalid extras before any terminal exists', async () => {
await expect(
buildWorktreeStartupForAgent({
repo: makeRepo({}),
settings,
agent: 'claude',
prompt: 'go',
extraAgentArgs: '--settings evil.json',
getLaunchRuntime: () => LINUX,
toSessionOptions: () => undefined
})
).rejects.toThrow('"--settings"')
})
it("merges a launch's account env over the startup plan's env", async () => {
const build = vi.fn(() => ({
agent: 'codex' as const,
startup: { command: 'codex', env: { CODEX_HOME: '/stale', KEEP: '1' } },
launchRuntime: LINUX_FACT
}))
const resolved = await resolveWorktreeCreateAgentStartup(
{
startupAgent: 'codex',
startupAccountEnv: { CODEX_HOME: '/home/u/.codex-b' }
},
build
)
expect(resolved?.startup.env).toEqual({ CODEX_HOME: '/home/u/.codex-b', KEEP: '1' })
expect(resolved?.launchRuntime).toBe(LINUX_FACT)
})
})
describe('resolveWorktreeStartupDraftAgent', () => {
beforeEach(() => {
mocks.detectInstalledAgentsWithShellPathHydration.mockReset()
mocks.detectInstalledAgentsWithShellPathHydration.mockResolvedValue([])
})
afterEach(() => {
mocks.detectInstalledAgentsWithShellPathHydration.mockReset()
})
const resolve = (
fields: Partial<Parameters<typeof resolveWorktreeStartupDraftAgent>[0]['settings']>,
requestedAgent?: 'claude' | 'codex',
repo = makeRepo({})
) =>
resolveWorktreeStartupDraftAgent({
repo,
settings: { ...settings, ...fields },
...(requestedAgent ? { requestedAgent } : {})
})
// An unserved SSH host cannot be answered by local detection.
it('starts no agent on an unserved SSH host rather than detecting locally', async () => {
mocks.detectInstalledAgentsWithShellPathHydration.mockResolvedValue(['codex'])
await expect(resolve({}, undefined, makeRepo({ connectionId: 'ssh-1' }))).resolves.toBeNull()
expect(mocks.detectInstalledAgentsWithShellPathHydration).not.toHaveBeenCalled()
})
})
describe('paired workspace draft inputs', () => {
it('keeps the disabled-agent draft substitution without applying the original picks or Arguments', async () => {
mocks.detectInstalledAgentsWithShellPathHydration.mockResolvedValue(['codex'])
@@ -15,14 +15,7 @@ const mocks = vi.hoisted(() => ({
addWslHost:
vi.fn<(args: { distro: string; startIfStopped: boolean }) => Promise<WslHostAddResult>>(),
openMove: vi.fn(),
toastError: vi.fn(),
store: {
wslHostsAcceptNewWork: true,
wslHostServerFiles: 'present',
repos: [{ id: 'repo-1', path: '\\\\wsl.localhost\\Ubuntu\\home\\me\\repo' }],
folderWorkspaces: [],
runtimeEnvironments: []
}
toastError: vi.fn()
}))
vi.mock('sonner', () => ({
@@ -31,7 +24,6 @@ vi.mock('sonner', () => ({
vi.mock('@/store/index', () => ({
useAppStore: {
getState: () => ({
...mocks.store,
settings: mocks.settings,
updateSettingsOrThrow: mocks.updateSettingsOrThrow
})
@@ -43,36 +35,11 @@ vi.mock('@/components/sidebar/host-admission/wsl/add-wsl-host-distro', () => ({
vi.mock('@/components/wsl-move/wsl-move-entry', () => ({ openWslMoveDialogFor: mocks.openMove }))
import {
readWslHostChatOffer,
readWslHostChatOfferForLaunch,
isWslHostChatOfferSettingUp,
wslHostChatOfferAction,
type WslHostChatOffer,
type WslHostChatOfferState
type WslHostChatOffer
} from './structured-chat-wsl-host-offer'
import { acceptWslHostOffer } from '@/components/sidebar/wsl-host-offer-actions'
import { structuredChatUnavailableToast } from './structured-agent-session-launch-failure'
import { structuredSessionNotices } from '@/components/native-chat/messages/notices/native-chat-structured-session-notices'
const REPO_PATH = '\\\\wsl.localhost\\Ubuntu\\home\\me\\repo'
const WORKTREE_ID = `repo-1::${REPO_PATH}`
function state(overrides: Partial<WslHostChatOfferState> = {}): WslHostChatOfferState {
return {
settings: null,
wslHostsAcceptNewWork: true,
wslHostServerFiles: 'present',
repos: [{ id: 'repo-1', path: REPO_PATH }],
folderWorkspaces: [],
runtimeEnvironments: [],
...overrides
}
}
const wslHost = {
name: 'Ubuntu (WSL)',
orcadDeployment: { kind: 'wsl', distro: 'Ubuntu', localPort: 7000, remotePort: 7001 }
} as const
beforeEach(() => {
vi.clearAllMocks()
@@ -91,53 +58,6 @@ afterEach(async () => {
)
})
describe('readWslHostChatOffer', () => {
it('offers to run the distro as a host while the setting is still off', () => {
expect(readWslHostChatOffer(state(), WORKTREE_ID)).toEqual({
distro: 'Ubuntu',
projectKind: 'repo',
projectId: 'repo-1',
hostReady: false
})
})
it('offers only the move once the distro is a host and the setting is on', () => {
const offer = readWslHostChatOffer(
state({ settings: { experimentalWslHosts: true }, runtimeEnvironments: [wslHost] }),
WORKTREE_ID
)
expect(offer?.hostReady).toBe(true)
})
it('offers a folder workspace in the distro', () => {
const offer = readWslHostChatOffer(
state({ repos: [], folderWorkspaces: [{ id: 'f1', folderPath: REPO_PATH }] }),
'folder:f1'
)
expect(offer).toMatchObject({ projectKind: 'folder', projectId: 'f1' })
})
it('offers nothing while this desktop cannot add WSL hosts', () => {
expect(readWslHostChatOffer(state({ wslHostsAcceptNewWork: false }), WORKTREE_ID)).toBeNull()
expect(readWslHostChatOffer(state({ wslHostServerFiles: 'missing' }), WORKTREE_ID)).toBeNull()
vi.stubGlobal('window', { api: { runtimeEnvironments: {} } })
expect(readWslHostChatOffer(state(), WORKTREE_ID)).toBeNull()
})
it('offers nothing for a Windows drive reached through the distro or an SSH project', () => {
const mount = '\\\\wsl.localhost\\Ubuntu\\mnt\\c\\repo'
expect(
readWslHostChatOffer(state({ repos: [{ id: 'repo-1', path: mount }] }), `repo-1::${mount}`)
).toBeNull()
expect(
readWslHostChatOffer(
state({ repos: [{ id: 'repo-1', path: REPO_PATH, connectionId: 'ssh-1' }] }),
WORKTREE_ID
)
).toBeNull()
})
})
describe('wslHostChatOfferAction', () => {
const offer: WslHostChatOffer = {
distro: 'Ubuntu',
@@ -146,55 +66,6 @@ describe('wslHostChatOfferAction', () => {
hostReady: false
}
it('turns the setting on, adds the distro, then opens the move for this project', async () => {
mocks.addWslHost.mockResolvedValue({ ok: true, environmentId: 'env-ubuntu' })
const action = wslHostChatOfferAction(offer)
expect(action.label).toBe('Run Ubuntu as a host')
action.onClick()
await vi.waitFor(() => expect(mocks.openMove).toHaveBeenCalled())
expect(mocks.updateSettingsOrThrow).toHaveBeenCalledWith({ experimentalWslHosts: true })
expect(mocks.addWslHost).toHaveBeenCalledWith({ distro: 'Ubuntu', startIfStopped: true })
expect(mocks.openMove).toHaveBeenCalledWith('Ubuntu', { kind: 'repo', id: 'repo-1' })
})
it('restores the setting and says why when the add fails', async () => {
mocks.addWslHost.mockResolvedValue({
ok: false,
kind: 'unsupported-wsl1',
message: 'Ubuntu runs WSL 1.'
})
wslHostChatOfferAction(offer).onClick()
await vi.waitFor(() => expect(mocks.toastError).toHaveBeenCalled())
expect(mocks.settings.experimentalWslHosts).toBe(false)
expect(mocks.openMove).not.toHaveBeenCalled()
})
it('runs one setup for repeated and concurrent clicks across surfaces', async () => {
let finishAdd: (result: WslHostAddResult) => void = () => undefined
mocks.addWslHost.mockImplementation(
() =>
new Promise((resolve) => {
finishAdd = resolve
mocks.held.add(resolve)
})
)
const first = wslHostChatOfferAction(offer)
first.onClick()
first.onClick()
// Another surface (the toast) for the same distro, spelled differently, joins too.
wslHostChatOfferAction({ ...offer, distro: 'ubuntu' }).onClick()
await vi.waitFor(() => expect(mocks.addWslHost).toHaveBeenCalledTimes(1))
expect(isWslHostChatOfferSettingUp('UBUNTU')).toBe(true)
const busy = wslHostChatOfferAction(offer, undefined, true)
expect(busy).toMatchObject({ label: 'Setting up…', disabled: true })
finishAdd({ ok: false, kind: 'failed', message: 'Could not start the server.' })
await vi.waitFor(() => expect(isWslHostChatOfferSettingUp('Ubuntu')).toBe(false))
expect(mocks.toastError).toHaveBeenCalledTimes(1)
// The one failed setup restores what it read: the setting stays off.
expect(mocks.settings.experimentalWslHosts).toBe(false)
expect(mocks.openMove).not.toHaveBeenCalled()
})
function holdAdds(): Record<string, (result: WslHostAddResult) => void> {
const finishes: Record<string, (result: WslHostAddResult) => void> = {}
mocks.addWslHost.mockImplementation(
@@ -223,28 +94,6 @@ describe('wslHostChatOfferAction', () => {
source: 'local_folder_picker'
} as const
it('runs setups for different distros side by side', async () => {
const finishes = holdAdds()
wslHostChatOfferAction(offer).onClick()
wslHostChatOfferAction({ ...offer, distro: 'Debian' }).onClick()
await vi.waitFor(() => expect(mocks.addWslHost).toHaveBeenCalledTimes(2))
expect(Object.keys(finishes).sort()).toEqual(['Debian', 'Ubuntu'])
})
it('does not hold one distro behind another that hangs', async () => {
const finishes = holdAdds()
// The add-project offer's Debian add hangs; the chat's Ubuntu setup still finishes.
void acceptWslHostOffer(DEBIAN_OFFER, addProjectOfferDeps())
wslHostChatOfferAction(offer).onClick()
await vi.waitFor(() => expect(finishes.Ubuntu).toBeDefined())
finishes.Ubuntu({ ok: true, environmentId: 'env-ubuntu' })
await vi.waitFor(() =>
expect(mocks.openMove).toHaveBeenCalledWith('Ubuntu', { kind: 'repo', id: 'repo-1' })
)
expect(isWslHostChatOfferSettingUp('Debian')).toBe(true)
expect(mocks.settings.experimentalWslHosts).toBe(true)
})
it('restores the setting only once every run in flight failed', async () => {
const finishes = holdAdds()
const accepted = acceptWslHostOffer(DEBIAN_OFFER, addProjectOfferDeps())
@@ -308,150 +157,4 @@ describe('wslHostChatOfferAction', () => {
await next
expect(reads).toEqual([false])
})
it('lets the add-project offer join a chat setup of the same distro', async () => {
let finishAdd: (result: WslHostAddResult) => void = () => undefined
mocks.addWslHost.mockImplementation(
() =>
new Promise((resolve) => {
finishAdd = resolve
mocks.held.add(resolve)
})
)
wslHostChatOfferAction(offer).onClick()
await vi.waitFor(() => expect(mocks.addWslHost).toHaveBeenCalledTimes(1))
const offerDeps = {
readWslHostsSetting: () => mocks.settings.experimentalWslHosts,
updateSettings: mocks.updateSettingsOrThrow,
addWslHost: mocks.addWslHost,
addLocalPath: vi.fn(async () => undefined),
moveAddedProject: vi.fn()
}
const accepted = acceptWslHostOffer(
{ path: '\\\\wsl.localhost\\ubuntu\\repo', distro: 'ubuntu', source: 'local_folder_picker' },
offerDeps
)
finishAdd({ ok: true, environmentId: 'env-ubuntu' })
expect(await accepted).toBeNull()
expect(mocks.addWslHost).toHaveBeenCalledTimes(1)
expect(offerDeps.addLocalPath).toHaveBeenCalledTimes(1)
expect(offerDeps.moveAddedProject).toHaveBeenCalledTimes(1)
})
it('opens the move straight away when the host is ready', async () => {
const action = wslHostChatOfferAction({ ...offer, hostReady: true })
expect(action.label).toBe('Move to Ubuntu host…')
action.onClick()
await vi.waitFor(() => expect(mocks.openMove).toHaveBeenCalled())
expect(mocks.addWslHost).not.toHaveBeenCalled()
})
})
describe('readWslHostChatOfferForLaunch', () => {
const wslFailure = {
kind: 'refused',
code: 'structured_agent_session_unsupported',
hostReason: 'wsl'
} as const
it('offers only for a failed start the host refused as WSL', () => {
expect(
readWslHostChatOfferForLaunch(
state(),
{ lifecycle: 'failed', failure: wslFailure },
WORKTREE_ID
)
).toMatchObject({ distro: 'Ubuntu' })
expect(
readWslHostChatOfferForLaunch(
state(),
{ lifecycle: 'failed', failure: { ...wslFailure, hostReason: 'remote' } },
WORKTREE_ID
)
).toBeNull()
expect(
readWslHostChatOfferForLaunch(
state(),
{ lifecycle: 'visibility-unknown', failure: wslFailure },
WORKTREE_ID
)
).toBeNull()
expect(
readWslHostChatOfferForLaunch(state(), { lifecycle: 'failed', failure: null }, WORKTREE_ID)
).toBeNull()
})
})
describe('structuredChatUnavailableToast', () => {
it('keeps the plain words for other refusals', () => {
expect(structuredChatUnavailableToast('remote', WORKTREE_ID)).toEqual({
description: 'Chat is not available over SSH. Open the agent in a terminal instead.'
})
})
it('keeps the plain words when the workspace has no offer', () => {
vi.stubGlobal('window', { api: { runtimeEnvironments: {} } })
expect(structuredChatUnavailableToast('wsl', WORKTREE_ID)).toEqual({
description: 'Chat is not available in WSL. Open the agent in a terminal instead.'
})
vi.stubGlobal('window', { api: { runtimeEnvironments: { wslHosts: {} } } })
expect(structuredChatUnavailableToast('wsl', 'repo-unknown::/elsewhere')).not.toHaveProperty(
'action'
)
})
it('wires the toast button to the host setup for this project', async () => {
mocks.addWslHost.mockResolvedValue({ ok: true, environmentId: 'env-ubuntu' })
const toastOptions = structuredChatUnavailableToast('wsl', WORKTREE_ID)
expect(toastOptions.description).toContain('Run the project on a WSL host')
expect(toastOptions.action?.label).toBe('Run Ubuntu as a host')
toastOptions.action?.onClick()
await vi.waitFor(() =>
expect(mocks.openMove).toHaveBeenCalledWith('Ubuntu', { kind: 'repo', id: 'repo-1' })
)
})
})
describe('the chat composer notice', () => {
it('replaces Retry with the WSL host path for a WSL folder', () => {
const [notice] = structuredSessionNotices({
launch: {
lifecycle: 'failed',
failure: {
kind: 'refused',
code: 'structured_agent_session_unsupported',
hostReason: 'wsl'
},
retry: vi.fn()
},
agentLabel: 'Claude',
sessionError: null,
composerError: null,
wslHostOffer: {
distro: 'Ubuntu',
projectKind: 'repo',
projectId: 'repo-1',
hostReady: false
}
})
expect(notice?.text).toContain('Run the project on a WSL host to chat there')
expect(notice?.action?.label).toBe('Run Ubuntu as a host')
})
it('shows the button busy while the host is being set up', () => {
const [notice] = structuredSessionNotices({
launch: { lifecycle: 'failed', failure: null, retry: vi.fn() },
agentLabel: 'Claude',
sessionError: null,
composerError: null,
wslHostOffer: {
distro: 'Ubuntu',
projectKind: 'repo',
projectId: 'repo-1',
hostReady: false
},
wslHostOfferSettingUp: true
})
expect(notice?.action).toMatchObject({ label: 'Setting up…', disabled: true })
})
})