diff --git a/packages/coding-agent/test/interactive-mode-title-prewarm.test.ts b/packages/coding-agent/test/interactive-mode-title-prewarm.test.ts index 76f1a2661..9c8f4d33d 100644 --- a/packages/coding-agent/test/interactive-mode-title-prewarm.test.ts +++ b/packages/coding-agent/test/interactive-mode-title-prewarm.test.ts @@ -87,14 +87,6 @@ describe("InteractiveMode tiny-title prewarm", () => { const prewarm = vi.spyOn(tinyTitleClient, "prewarm").mockImplementation(() => {}); await mode.init(); - // The prewarm call is deferred behind a setImmediate queued during - // init() (see interactive-mode.ts); init()'s own awaits are promise - // microtasks that can resolve without yielding to the immediate - // queue, so the prewarm may not have fired yet when init() settles. - // Flush one immediate tick before asserting. - const immediateFlushed = Promise.withResolvers(); - setImmediate(immediateFlushed.resolve); - await immediateFlushed.promise; expect(prewarm).toHaveBeenCalledWith("lfm2-350m"); }); diff --git a/packages/coding-agent/test/mcp-manager-notification-listeners.test.ts b/packages/coding-agent/test/mcp-manager-notification-listeners.test.ts index c3b44b549..8f2678c14 100644 --- a/packages/coding-agent/test/mcp-manager-notification-listeners.test.ts +++ b/packages/coding-agent/test/mcp-manager-notification-listeners.test.ts @@ -71,14 +71,8 @@ describe("MCPManager notification listeners", () => { expect(typeof unsubscribe).toBe("function"); try { - // Don't assert on `result.connectedServers` here: it's only populated - // if the real subprocess handshake lands inside MCPManager's internal - // 250 ms startup race (`STARTUP_TIMEOUT_MS`), which is prone to - // scheduling jitter under CI load even though the connection still - // succeeds. This test's contract is notification delivery, not that - // race's timing — awaiting the frames below already proves the - // server connected. - await manager.connectServers({ alpha: serverConfig() }, {}); + const result = await manager.connectServers({ alpha: serverConfig() }, {}); + expect(result.connectedServers).toContain("alpha"); // Await both the known list_changed and the server-custom frame // independently. Arrival order across the two isn't guaranteed