From 0d7d9b5b30e034aa1bb24b0e4a76699a14a94f54 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 4 Oct 2026 13:25:59 -0700 Subject: [PATCH] test(mobile): open the launch ledger the way admission now does Launch admission reads its ledger from the runtime's own record store, not the installed chat host. The mobile launch suites still planted the store in the chat-host registry, so every launch they drove was refused with agent_session_record_store_unavailable. They now hand the store to the runtime stub, as the root launch suites already do. --- .../tasks/agent-launch-mobile-replay.test.ts | 12 ++++++------ .../mobile-agent-launch-architecture.test.ts | 18 ++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/mobile/src/tasks/agent-launch-mobile-replay.test.ts b/mobile/src/tasks/agent-launch-mobile-replay.test.ts index 515cf353f3b..51d790b85dd 100644 --- a/mobile/src/tasks/agent-launch-mobile-replay.test.ts +++ b/mobile/src/tasks/agent-launch-mobile-replay.test.ts @@ -10,13 +10,14 @@ import { AGENT_SESSION_MAX_NEW_OPERATION_AGE_MS, AGENT_SESSION_OPERATION_FUTURE_SKEW_MS } from '../../../src/shared/agent-session-host-authority' -import { setStructuredAgentSessionHost } from '../../../src/main/native-chat/agent-session-wire/structured-agent-session-registry' -import type { StructuredAgentSessionHost } from '../../../src/main/native-chat/agent-session-wire/structured-agent-session-host' import type { AgentSessionRecordStore } from '../../../src/main/runtime/agent-session-record-store' import { openTestAgentSessionRecordStore } from '../../../src/main/runtime/agent-session-record-store-test-harness' import type { OrcaRuntimeService } from '../../../src/main/runtime/orca-runtime' import { RpcDispatcher } from '../../../src/main/runtime/rpc/dispatcher' -import { runtimeStub } from '../../../src/main/runtime/rpc/methods/agent-launch.test-fixture' +import { + runtimeStub, + setAgentLaunchRecordStore +} from '../../../src/main/runtime/rpc/methods/agent-launch.test-fixture' import { AGENT_LAUNCH_REPLAY_REQUIRED_RUNTIME_CAPABILITY, AGENT_LAUNCH_RUNTIME_CAPABILITY @@ -40,13 +41,12 @@ beforeEach(async () => { createStructuredSession.mockResolvedValue({ ok: true, value: { sessionId: 'session-1' } }) directory = await mkdtemp(join(tmpdir(), 'orca-mobile-launch-replay-')) store = await openTestAgentSessionRecordStore(directory) - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the launch reads only deps.store; structured session creation is the injected boundary above. - setStructuredAgentSessionHost({ deps: { store } } as unknown as StructuredAgentSessionHost) + setAgentLaunchRecordStore(store) }) afterEach(async () => { vi.restoreAllMocks() - setStructuredAgentSessionHost(null) + setAgentLaunchRecordStore(null) await rm(directory, { recursive: true, force: true }) }) diff --git a/mobile/src/tasks/mobile-agent-launch-architecture.test.ts b/mobile/src/tasks/mobile-agent-launch-architecture.test.ts index 60f09c83a18..ff595a652bb 100644 --- a/mobile/src/tasks/mobile-agent-launch-architecture.test.ts +++ b/mobile/src/tasks/mobile-agent-launch-architecture.test.ts @@ -9,9 +9,10 @@ import { DeviceRegistry } from '../../../src/main/runtime/device-registry' import type { AuthenticatedMobileSocket } from '../../../src/main/runtime/rpc/mobile-socket-wiring' import { RpcDispatcher } from '../../../src/main/runtime/rpc/dispatcher' import { AgentLaunchFields } from '../../../src/main/runtime/rpc/methods/agent-launch-schemas' -import { runtimeStub } from '../../../src/main/runtime/rpc/methods/agent-launch.test-fixture' -import { setStructuredAgentSessionHost } from '../../../src/main/native-chat/agent-session-wire/structured-agent-session-registry' -import type { StructuredAgentSessionHost } from '../../../src/main/native-chat/agent-session-wire/structured-agent-session-host' +import { + runtimeStub, + setAgentLaunchRecordStore +} from '../../../src/main/runtime/rpc/methods/agent-launch.test-fixture' import type { OrcaRuntimeService } from '../../../src/main/runtime/orca-runtime' import { markRpcDeliveryUnknown } from '../transport/rpc-delivery-ambiguity' import { createStableLogicalRpcClient } from '../transport/stable-logical-rpc-client' @@ -39,12 +40,11 @@ beforeEach(async () => { createStructuredSession.mockResolvedValue({ ok: true, value: { sessionId: 'session-1' } }) directory = await mkdtemp(join(tmpdir(), 'orca-launch-architecture-')) store = await openTestAgentSessionRecordStore(directory) - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the launch reads deps.store; session creation is injected above. - setStructuredAgentSessionHost({ deps: { store } } as unknown as StructuredAgentSessionHost) + setAgentLaunchRecordStore(store) }) afterEach(async () => { - setStructuredAgentSessionHost(null) + setAgentLaunchRecordStore(null) await rm(directory, { recursive: true, force: true }) }) @@ -243,8 +243,7 @@ describe('mobile launch retry authority', () => { const first = await dispatcher.dispatch(request) expect(first.ok).toBe(true) store = await openTestAgentSessionRecordStore(directory) - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: launch admission reads only deps.store from the installed host. - setStructuredAgentSessionHost({ deps: { store } } as unknown as StructuredAgentSessionHost) + setAgentLaunchRecordStore(store) await expect( dispatcher.dispatch({ ...request, method: 'agent.launchReplay' }) ).resolves.toEqual(first) @@ -293,8 +292,7 @@ describe('mobile launch retry authority', () => { } }) store = await openTestAgentSessionRecordStore(directory) - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: launch admission reads only deps.store from the installed host. - setStructuredAgentSessionHost({ deps: { store } } as unknown as StructuredAgentSessionHost) + setAgentLaunchRecordStore(store) await expect(dispatcher.dispatch(request)).resolves.toMatchObject({ ok: false, error: { code: 'worktree_create_collision' }