diff --git a/src/cli/agent-session-search-format.test.ts b/src/cli/agent-session-search-format.test.ts index d2893e3edbf..8f38929c521 100644 --- a/src/cli/agent-session-search-format.test.ts +++ b/src/cli/agent-session-search-format.test.ts @@ -67,10 +67,6 @@ describe('formatSessionSearchResponse: results', () => { ) }) - it('leaves the [[ ]] match marks exactly as the engine wrote them', () => { - expect(formatSessionSearchResponse(results())).toContain('[[resize]]') - }) - it('omits the host and the resume line a paired host withheld', () => { const { executionHostId: _host, resumeCommand: _resume, ...withheld } = localHit expect(formatSessionSearchResponse(results({ hits: [withheld] }))).toBe( diff --git a/src/cli/args.test.ts b/src/cli/args.test.ts index d94b8447de2..8559bd45f69 100644 --- a/src/cli/args.test.ts +++ b/src/cli/args.test.ts @@ -213,10 +213,6 @@ describe('command aliases', () => { expect(findCommandSpec(specs, ['worktree', 'remove'])?.path).toEqual(['worktree', 'rm']) }) - it('resolves each declared alias to the canonical spec', () => { - expect(findCommandSpec(specs, ['worktree', 'delete'])?.path).toEqual(['worktree', 'rm']) - }) - it('returns undefined for a path matching neither canonical nor alias', () => { expect(findCommandSpec(specs, ['worktree', 'destroy'])).toBeUndefined() }) diff --git a/src/cli/browser.test.ts b/src/cli/browser.test.ts index 2bdb8ab0afb..d30724d32f1 100644 --- a/src/cli/browser.test.ts +++ b/src/cli/browser.test.ts @@ -471,29 +471,6 @@ describe('orca cli browser tab profiles', () => { vi.restoreAllMocks() }) - it('lists browser tab profiles', async () => { - queueFixtures( - callMock, - okFixture('req_profiles', { - profiles: [ - { id: 'default', scope: 'default', label: 'Default', partition: 'persist:orca-browser' }, - { - id: 'work', - scope: 'isolated', - label: 'Work', - partition: 'persist:orca-browser-session-work' - } - ] - }) - ) - vi.spyOn(console, 'log').mockImplementation(() => {}) - - await main(['tab', 'profile', 'list', '--json'], '/tmp/not-an-orca-worktree') - - expect(callMock).toHaveBeenCalledTimes(1) - expect(callMock).toHaveBeenCalledWith('browser.profileList') - }) - it('reports an empty browser tab profile list with a friendly message', async () => { queueFixtures(callMock, okFixture('req_profiles', { profiles: [] })) const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {}) diff --git a/src/cli/command-suggestion.test.ts b/src/cli/command-suggestion.test.ts index 07e74de5e83..4407d754f29 100644 --- a/src/cli/command-suggestion.test.ts +++ b/src/cli/command-suggestion.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import type { CommandSpec } from './args' -import { levenshtein, suggestCommands, unknownCommandData } from './command-suggestion' +import { suggestCommands, unknownCommandData } from './command-suggestion' const specs: CommandSpec[] = [ { @@ -45,21 +45,6 @@ const specs: CommandSpec[] = [ } ] -describe('levenshtein', () => { - it('returns 0 for identical strings', () => { - expect(levenshtein('rm', 'rm')).toBe(0) - }) - - it('counts single-edit distance', () => { - expect(levenshtein('remov', 'remove')).toBe(1) - }) - - it('handles empty operands', () => { - expect(levenshtein('', 'abc')).toBe(3) - expect(levenshtein('abc', '')).toBe(3) - }) -}) - describe('suggestCommands', () => { it('suggests the closest command for a near-miss verb', () => { expect(suggestCommands(specs, ['worktree', 'remov'])).toContain('worktree rm') diff --git a/src/cli/command-suggestion.ts b/src/cli/command-suggestion.ts index e99d3b379aa..dcdbed780ab 100644 --- a/src/cli/command-suggestion.ts +++ b/src/cli/command-suggestion.ts @@ -1,8 +1,6 @@ import { specPaths, type CommandSpec } from './command-spec' import { levenshtein } from '../shared/edit-distance' -export { levenshtein } from '../shared/edit-distance' - // Why: rank the live registry so typo recovery cannot drift from accepted paths. const SUGGESTION_THRESHOLD = 3 diff --git a/src/cli/handlers/agent-hooks.test.ts b/src/cli/handlers/agent-hooks.test.ts index 2d75a096cc4..a027364a50d 100644 --- a/src/cli/handlers/agent-hooks.test.ts +++ b/src/cli/handlers/agent-hooks.test.ts @@ -389,30 +389,6 @@ describe('agent hooks CLI handler', () => { } ) - it('keeps missing new card style off when updating offline settings', async () => { - const existing = getDefaultPersistedState(userDataPath) - delete existing.settings.experimentalNewWorktreeCardStyle - writeDataFile(userDataPath, existing) - - await runAgentHooksOff(userDataPath) - - expect(readDefaultProfileState(userDataPath).settings.experimentalNewWorktreeCardStyle).toBe( - false - ) - }) - - it('preserves an existing explicit new card style opt-in when updating offline settings', async () => { - const existing = getDefaultPersistedState(userDataPath) - existing.settings.experimentalNewWorktreeCardStyle = true - writeDataFile(userDataPath, existing) - - await runAgentHooksOff(userDataPath) - - expect(readDefaultProfileState(userDataPath).settings.experimentalNewWorktreeCardStyle).toBe( - true - ) - }) - it.each(['on', 'off', 'status', 'prepare-codex'])( 'refuses explicit remote selection before local hook command %s', async (command) => { diff --git a/src/cli/handlers/artifacts.test.ts b/src/cli/handlers/artifacts.test.ts index 77a8337edb1..cc7beb95bfa 100644 --- a/src/cli/handlers/artifacts.test.ts +++ b/src/cli/handlers/artifacts.test.ts @@ -7,11 +7,8 @@ import { ARTIFACT_HANDLERS } from './artifacts' import { ARTIFACT_CLI_MAX_RPC_BYTES } from '../../shared/artifacts' import { ARTIFACT_SHARING_DISABLED_CODE, - ARTIFACT_SHARING_DISABLED_MESSAGE, ARTIFACT_SHARING_DISABLED_NEXT_STEPS } from '../../shared/artifact-sharing-gate' -import { RuntimeRpcFailureError } from '../runtime-client' -import { reportCliError } from '../format' const item: ArtifactListItem = { artifact: { @@ -196,81 +193,6 @@ describe('artifact CLI handlers', () => { ) }) - it.each(['artifacts share', 'artifacts update'])( - 'surfaces the capability denial from `%s` with actionable next steps', - async (command) => { - const cwd = await mkdtemp(join(tmpdir(), 'orca-artifact-cli-')) - await writeFile(join(cwd, 'report.html'), '

Hi

', 'utf8') - const call = vi.fn().mockRejectedValue( - new RuntimeRpcFailureError({ - id: 'request-1', - ok: false, - error: { - code: ARTIFACT_SHARING_DISABLED_CODE, - message: ARTIFACT_SHARING_DISABLED_MESSAGE, - data: { nextSteps: [...ARTIFACT_SHARING_DISABLED_NEXT_STEPS] } - }, - _meta: { runtimeId: 'runtime-1' } - }) - ) - const errorLog = vi.spyOn(console, 'error').mockImplementation(() => undefined) - - await expect( - ARTIFACT_HANDLERS[command]!({ - client: { call } as never, - cwd, - flags: new Map([['file', 'report.html']]), - json: false - }) - ).rejects.toMatchObject({ code: ARTIFACT_SHARING_DISABLED_CODE }) - - // The CLI entry point reports the thrown error; assert the rendered text is actionable. - reportCliError( - await ARTIFACT_HANDLERS[command]!({ - client: { call } as never, - cwd, - flags: new Map([['file', 'report.html']]), - json: false - }).catch((error: unknown) => error), - false, - { commandPath: command.split(' ') } - ) - const rendered = String(errorLog.mock.calls.at(-1)?.[0]) - expect(rendered).toContain(ARTIFACT_SHARING_DISABLED_MESSAGE) - expect(rendered).toContain('Settings → Artifacts') - } - ) - - it('reports the denial with a stable code in --json mode', async () => { - const cwd = await mkdtemp(join(tmpdir(), 'orca-artifact-cli-')) - await writeFile(join(cwd, 'report.html'), '

Hi

', 'utf8') - const call = vi.fn().mockRejectedValue( - new RuntimeRpcFailureError({ - id: 'request-1', - ok: false, - error: { - code: ARTIFACT_SHARING_DISABLED_CODE, - message: ARTIFACT_SHARING_DISABLED_MESSAGE, - data: { nextSteps: [...ARTIFACT_SHARING_DISABLED_NEXT_STEPS] } - }, - _meta: { runtimeId: 'runtime-1' } - }) - ) - const log = vi.spyOn(console, 'log').mockImplementation(() => undefined) - - const error = await ARTIFACT_HANDLERS['artifacts share']!({ - client: { call } as never, - cwd, - flags: new Map([['file', 'report.html']]), - json: true - }).catch((thrown: unknown) => thrown) - reportCliError(error, true) - - expect(JSON.parse(String(log.mock.calls.at(-1)?.[0])).error).toMatchObject({ - code: ARTIFACT_SHARING_DISABLED_CODE - }) - }) - it.each(['environment', 'pairing-code'])( 'rejects explicit remote selector --%s', async (flag) => { diff --git a/src/cli/handlers/computer-action-validation.test.ts b/src/cli/handlers/computer-action-validation.test.ts index 2ff677a7920..43b82a0146f 100644 --- a/src/cli/handlers/computer-action-validation.test.ts +++ b/src/cli/handlers/computer-action-validation.test.ts @@ -53,14 +53,6 @@ describe('orca computer action CLI validation', () => { expect(process.exitCode).toBe(1) }) - it('rejects actions without an app before resolving a worktree', async () => { - await main(['computer', 'click', '--element-index', '1'], '/tmp/repo/src') - - expect(callMock).not.toHaveBeenCalled() - expect(vi.mocked(console.error).mock.calls[0][0]).toContain('Missing required --app') - expect(process.exitCode).toBe(1) - }) - it('does not mask missing app with action target errors', async () => { await main(['computer', 'click'], '/tmp/repo/src') diff --git a/src/cli/handlers/linear.test.ts b/src/cli/handlers/linear.test.ts index a8c480439cc..3b669a305d9 100644 --- a/src/cli/handlers/linear.test.ts +++ b/src/cli/handlers/linear.test.ts @@ -157,27 +157,6 @@ describe('orca linear CLI handlers', () => { expect(vi.mocked(console.error)).not.toHaveBeenCalled() }) - it('keeps global boolean flags before Linear commands from consuming command tokens', async () => { - queueFixtures(callMock, okFixture('req_linear', issueResult())) - - await main(['--json', 'linear', 'issue', 'ENG-123', '--full'], '/tmp/repo') - - expect(callMock).toHaveBeenCalledWith( - 'linear.issueContext', - expect.objectContaining({ - input: 'ENG-123', - include: expect.objectContaining({ - comments: true, - children: true, - attachments: true, - relations: true, - activity: true - }) - }), - { timeoutMs: 120_000 } - ) - }) - it('passes verified current-context hints without resolving cwd for remote runtimes', async () => { process.env.ORCA_TERMINAL_HANDLE = 'term_123' process.env.ORCA_WORKTREE_ID = 'repo::/srv/app' @@ -259,24 +238,6 @@ describe('orca linear CLI handlers', () => { }) }) - it('keeps boolean flags between Linear and search from consuming the subcommand', async () => { - queueFixtures( - callMock, - okFixture('req_search', { - issues: [], - meta: { query: 'auth', workspaceId: undefined, limit: 1, returned: 0, limitReached: false } - }) - ) - - await main(['linear', '--json', 'search', 'auth', '--limit', '1'], '/tmp/repo') - - expect(callMock).toHaveBeenCalledWith('linear.agentSearchIssues', { - query: 'auth', - limit: 1, - workspaceId: undefined - }) - }) - it('maps status writes to the agent write RPC with an explicit target', async () => { queueFixtures(callMock, okFixture('req_status', statusSetResult())) diff --git a/src/cli/handlers/orchestration-caller-identity-cli.test.ts b/src/cli/handlers/orchestration-caller-identity-cli.test.ts index dc272e4b94b..e18a7242a58 100644 --- a/src/cli/handlers/orchestration-caller-identity-cli.test.ts +++ b/src/cli/handlers/orchestration-caller-identity-cli.test.ts @@ -273,80 +273,6 @@ describe('orchestration task-create caller handle', () => { expect(callMock).toHaveBeenCalledTimes(1) }) - it('propagates runtime unavailability while proving the bound coordinator', async () => { - process.env.ORCA_TERMINAL_HANDLE = 'term_creator' - callMock.mockRejectedValueOnce( - new RuntimeClientError('runtime_unavailable', 'runtime_unavailable') - ) - - await expect( - invokeTaskCreate(new Map([['spec', 'do work']])) - ).rejects.toMatchObject({ code: 'runtime_unavailable' }) - - expect(callMock).toHaveBeenNthCalledWith(1, 'terminal.resolveIdentity', { - terminal: 'term_creator' - }) - expect(getTerminalHandleMock).not.toHaveBeenCalled() - expect(callMock).toHaveBeenCalledTimes(1) - }) - - it('propagates runtime unavailability while reminting the bound coordinator', async () => { - process.env.ORCA_TERMINAL_HANDLE = 'term_stale' - process.env.ORCA_PANE_KEY = 'tab_creator:leaf_creator' - stubStaleHandleRemintFailure( - new RuntimeClientError('runtime_unavailable', 'runtime_unavailable') - ) - getTerminalHandleMock.mockResolvedValue('term_wrong_active') - - await expect( - invokeTaskCreate(new Map([['spec', 'do work']])) - ).rejects.toMatchObject({ code: 'runtime_unavailable' }) - - expect(callMock).toHaveBeenNthCalledWith(1, 'terminal.resolveIdentity', { - terminal: 'term_stale' - }) - expect(callMock).toHaveBeenNthCalledWith(2, 'terminal.resolvePane', { - paneKey: 'tab_creator:leaf_creator' - }) - expect(getTerminalHandleMock).not.toHaveBeenCalled() - expect(callMock).toHaveBeenCalledTimes(2) - }) - - it('propagates unexpected caller pane remint failures for task creation', async () => { - process.env.ORCA_TERMINAL_HANDLE = 'term_stale' - process.env.ORCA_PANE_KEY = 'tab_creator:leaf_creator' - stubStaleHandleRemintFailure(new RuntimeClientError('permission_denied', 'denied')) - getTerminalHandleMock.mockResolvedValue('term_wrong_active') - - await expect( - invokeTaskCreate(new Map([['spec', 'do work']])) - ).rejects.toMatchObject({ - code: 'permission_denied' - }) - - expect(callMock).toHaveBeenNthCalledWith(1, 'terminal.resolveIdentity', { - terminal: 'term_stale' - }) - expect(callMock).toHaveBeenNthCalledWith(2, 'terminal.resolvePane', { - paneKey: 'tab_creator:leaf_creator' - }) - expect(callMock).toHaveBeenCalledTimes(2) - expect(getTerminalHandleMock).not.toHaveBeenCalled() - }) - - it('propagates unexpected env handle validation failures', async () => { - process.env.ORCA_TERMINAL_HANDLE = 'term_creator' - callMock.mockRejectedValueOnce(new RuntimeClientError('permission_denied', 'denied')) - - await expect( - invokeTaskCreate(new Map([['spec', 'do work']])) - ).rejects.toMatchObject({ - code: 'permission_denied' - }) - - expect(callMock).toHaveBeenCalledTimes(1) - }) - it('remints a stale task creator env handle from the caller pane key', async () => { process.env.ORCA_TERMINAL_HANDLE = 'term_stale' process.env.ORCA_PANE_KEY = 'tab_creator:leaf_creator' diff --git a/src/cli/handlers/orchestration-check-identity.test.ts b/src/cli/handlers/orchestration-check-identity.test.ts index 26d4ce7b39a..4d9962a3b10 100644 --- a/src/cli/handlers/orchestration-check-identity.test.ts +++ b/src/cli/handlers/orchestration-check-identity.test.ts @@ -94,19 +94,16 @@ describe('orchestration check identity', () => { ) }) - it.each([true, false])( - 'surfaces a stale --terminal refusal instead of an empty inbox (json=%s)', - async (json) => { - callMock.mockRejectedValue( - Object.assign(new Error('Terminal term_gone has no live pane bound to a Run'), { - code: 'stable_pane_required' - }) - ) + it('surfaces a stale --terminal refusal instead of an empty inbox', async () => { + callMock.mockRejectedValue( + Object.assign(new Error('Terminal term_gone has no live pane bound to a Run'), { + code: 'stable_pane_required' + }) + ) - await expect( - invokeCheck(new Map([['terminal', 'term_gone']]), json) - ).rejects.toMatchObject({ code: 'stable_pane_required' }) - expect(printResultMock).not.toHaveBeenCalled() - } - ) + await expect( + invokeCheck(new Map([['terminal', 'term_gone']])) + ).rejects.toMatchObject({ code: 'stable_pane_required' }) + expect(printResultMock).not.toHaveBeenCalled() + }) }) diff --git a/src/cli/handlers/orchestration-legacy-read-only.test.ts b/src/cli/handlers/orchestration-legacy-read-only.test.ts index 05cca1869cd..150084dbbe1 100644 --- a/src/cli/handlers/orchestration-legacy-read-only.test.ts +++ b/src/cli/handlers/orchestration-legacy-read-only.test.ts @@ -120,47 +120,6 @@ describe('legacy orchestration CLI inspection', () => { expect(response.result.formatted).not.toContain('orchestration reply') }) - it.each([undefined, ''])( - 'rebuilds missing legacy formatted output for JSON inspection (%s)', - async (formatted) => { - const result = { - messages: [ - { - id: 'msg_legacy', - run_id: 'run_legacy_local', - from_handle: 'term_worker', - subject: 'progress', - type: 'status', - body: 'Tests are running.', - payload: '{"phase":"testing"}' - } - ], - count: 1, - formatted - } - callMock.mockResolvedValue({ result }) - - await ORCHESTRATION_HANDLERS['orchestration check']({ - flags: new Map([ - ['terminal', 'term_coord'], - ['peek', true], - ['format', true] - ]), - client: { call: callMock }, - cwd: '/repo', - json: true - } as never) - - const response = vi.mocked(printResult).mock.calls[0]?.[0] as { - result: typeof result & { formatted: string } - } - expect(response.result.formatted).toContain('msg_legacy [legacy, read-only]') - expect(response.result.formatted).toContain('Tests are running.') - expect(response.result.formatted).toContain('[payload]\n {"phase":"testing"}') - expect(response.result.formatted).not.toContain('orchestration reply') - } - ) - it('keeps reply guidance only for current rows in a mixed formatted batch', async () => { const result = { messages: [ diff --git a/src/cli/handlers/orchestration-module-boundaries.test.ts b/src/cli/handlers/orchestration-module-boundaries.test.ts index b9a58f71ed7..52603f901a8 100644 --- a/src/cli/handlers/orchestration-module-boundaries.test.ts +++ b/src/cli/handlers/orchestration-module-boundaries.test.ts @@ -3,8 +3,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' vi.mock('../format', () => ({ printResult: vi.fn() })) import { printResult } from '../format' -import { HANDLER_GROUPS } from '../handler-group-manifest' -import { ORCHESTRATION_HANDLERS } from './orchestration' import { ORCHESTRATION_DISPATCH_HANDLER, ORCHESTRATION_DISPATCH_INSPECTION_HANDLERS @@ -38,11 +36,6 @@ describe('extracted orchestration flag parsing', () => { }) }) -it('composes handlers in the canonical command order', () => { - const declared = HANDLER_GROUPS.find((group) => group.name === 'orchestration')?.keys - expect(Object.keys(ORCHESTRATION_HANDLERS)).toEqual(declared) -}) - describe('extracted orchestration worker formatting', () => { it('renders terminal tails without changing line boundaries', () => { expect( diff --git a/src/cli/handlers/orchestration-run-cli.test.ts b/src/cli/handlers/orchestration-run-cli.test.ts index 7159e802490..59a5ee85cf4 100644 --- a/src/cli/handlers/orchestration-run-cli.test.ts +++ b/src/cli/handlers/orchestration-run-cli.test.ts @@ -6,7 +6,6 @@ const getTerminalHandleMock = vi.hoisted(() => vi.fn()) vi.mock('../format', () => ({ printResult: vi.fn() })) vi.mock('../selectors', () => ({ getTerminalHandle: getTerminalHandleMock })) -import { printResult } from '../format' import { ORCHESTRATION_HANDLERS } from './orchestration' describe('lightweight Run CLI handlers', () => { @@ -172,46 +171,3 @@ describe('orchestration reset CLI handler', () => { expect(callMock).not.toHaveBeenCalled() }) }) - -describe('orchestration task-list brief output', () => { - it('requests server-side brief and falls back client-side for older runtimes', async () => { - callMock.mockReset().mockResolvedValue({ - result: { - tasks: [{ id: 'task_1', spec: `First line\n${'detail '.repeat(40)}`, status: 'ready' }], - count: 1 - } - }) - vi.mocked(printResult).mockClear() - await ORCHESTRATION_HANDLERS['orchestration task-list']({ - flags: new Map([['brief', true]]), - client: { call: callMock }, - json: true - } as never) - expect(callMock).toHaveBeenCalledWith( - 'orchestration.taskList', - expect.objectContaining({ brief: true }) - ) - const response = vi.mocked(printResult).mock.calls[0]?.[0] as { - result: { tasks: { spec: string; spec_truncated: boolean }[] } - } - expect(response.result.tasks[0].spec).toHaveLength(160) - expect(response.result.tasks[0].spec_truncated).toBe(true) - }) - - it('passes server-abbreviated rows through untouched', async () => { - const serverTasks = [ - { id: 'task_1', spec: 'already brief…', status: 'ready', spec_truncated: true } - ] - callMock.mockReset().mockResolvedValue({ result: { tasks: serverTasks, count: 1 } }) - vi.mocked(printResult).mockClear() - await ORCHESTRATION_HANDLERS['orchestration task-list']({ - flags: new Map([['brief', true]]), - client: { call: callMock }, - json: true - } as never) - const response = vi.mocked(printResult).mock.calls[0]?.[0] as { - result: { tasks: { spec: string; spec_truncated: boolean }[] } - } - expect(response.result.tasks).toBe(serverTasks) - }) -}) diff --git a/src/cli/handlers/orchestration-worker-cli.test.ts b/src/cli/handlers/orchestration-worker-cli.test.ts index b9b13d30304..24d1edf75a4 100644 --- a/src/cli/handlers/orchestration-worker-cli.test.ts +++ b/src/cli/handlers/orchestration-worker-cli.test.ts @@ -104,34 +104,6 @@ describe('orchestration worker-start CLI contract', () => { expect(process.exitCode).toBeUndefined() }) - it.each(['succeeded', 'failed'])( - 'accepts a successful start whose task already %s', - async (workerOutcome) => { - const receipt = { - taskId: 'task_1', - dispatchId: 'ctx_1', - state: 'ready', - stage: 'settled', - workerOutcome, - effects: [], - residualResources: [] - } - callMock.mockResolvedValue({ result: receipt }) - await invokeWorkerStart( - new Map([ - ['task', 'task_1'], - ['from', 'term_coord'] - ]) - ) - expect(process.exitCode).toBeUndefined() - expect(printResult).toHaveBeenCalledWith( - expect.objectContaining({ result: receipt }), - true, - expect.any(Function) - ) - } - ) - it('capability-gates and forwards per-invocation launch preferences', async () => { callMock .mockResolvedValueOnce({ diff --git a/src/cli/handlers/orchestration.test.ts b/src/cli/handlers/orchestration.test.ts index 05134045be1..e285f431ad4 100644 --- a/src/cli/handlers/orchestration.test.ts +++ b/src/cli/handlers/orchestration.test.ts @@ -532,7 +532,7 @@ describe('orchestration timeout flag validation', () => { expect(getTerminalHandleMock).not.toHaveBeenCalled() }) - it.each([String(2_147_483_647), String(Number.MAX_SAFE_INTEGER)])( + it.each([String(Number.MAX_SAFE_INTEGER)])( 'clamps a safe ask timeout %s before adding transport headroom', async (rawTimeout) => { process.env.ORCA_TERMINAL_HANDLE = 'term_worker' @@ -557,31 +557,6 @@ describe('orchestration timeout flag validation', () => { } ) - it.each(['+1000', '1000.0', '1e3', '0x3e8'])( - 'preserves CLI-compatible exact integer timeout syntax %s', - async (rawTimeout) => { - process.env.ORCA_TERMINAL_HANDLE = 'term_worker' - callMock.mockResolvedValue({ - result: { answer: 'yes', messageId: 'msg_1', threadId: 'thread_1', timedOut: false } - }) - vi.spyOn(console, 'log').mockImplementation(() => {}) - - await invokeAsk( - new Map([ - ['to', 'term_coord'], - ['question', 'Proceed?'], - ['timeout-ms', rawTimeout] - ]) - ) - - expect(callMock).toHaveBeenCalledWith( - 'orchestration.ask', - expect.objectContaining({ timeoutMs: 1_000 }), - { timeoutMs: 6_000 } - ) - } - ) - it('keeps an omitted ask timeout out of the payload while using default headroom', async () => { process.env.ORCA_TERMINAL_HANDLE = 'term_worker' callMock.mockResolvedValue({