diff --git a/src/agents/subagent-registry.persistence.test-support.ts b/src/agents/subagent-registry.persistence.test-support.ts index 97780cc5b36..19c3c613e48 100644 --- a/src/agents/subagent-registry.persistence.test-support.ts +++ b/src/agents/subagent-registry.persistence.test-support.ts @@ -63,6 +63,7 @@ export function createSubagentRegistryTestDeps( ): Record { return { cleanupBrowserSessionsForLifecycleEnd: vi.fn(async () => {}), + captureSubagentCompletionReply: vi.fn(async () => undefined), ensureContextEnginesInitialized: vi.fn(), ensureRuntimePluginsLoaded: vi.fn(), getRuntimeConfig: vi.fn(() => ({})), diff --git a/src/agents/subagent-registry.persistence.test.ts b/src/agents/subagent-registry.persistence.test.ts index d013acdb581..6496a31a366 100644 --- a/src/agents/subagent-registry.persistence.test.ts +++ b/src/agents/subagent-registry.persistence.test.ts @@ -188,6 +188,8 @@ describe("subagent registry persistence", () => { }; beforeEach(() => { + announceSpy.mockReset(); + announceSpy.mockResolvedValue(true); __testing.setDepsForTest({ ...createSubagentRegistryTestDeps(), persistSubagentRunsToDisk: fastPersistSubagentRunsToDisk, @@ -204,7 +206,6 @@ describe("subagent registry persistence", () => { }); afterEach(async () => { - announceSpy.mockClear(); __testing.setDepsForTest(); resetSubagentRegistryForTests({ persist: false }); await drainSessionStoreWriterQueuesForTest(); @@ -670,6 +671,15 @@ describe("subagent registry persistence", () => { }); it("keeps stale unended restored runs with abortedLastRun for restart recovery", async () => { + vi.mocked(callGateway).mockImplementationOnce(async (request) => { + expect(request).toMatchObject({ + method: "agent.wait", + params: { runId: "run-stale-aborted-restore" }, + }); + return { + status: "pending", + }; + }); const now = Date.now(); const runId = "run-stale-aborted-restore"; const childSessionKey = "agent:main:subagent:stale-aborted-restore";