From a88b5a6deecab245f7b9bad9ec71a2d2bd7eb290 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Fri, 13 Nov 2026 02:02:28 -0800 Subject: [PATCH] test(agent-session): let delivery park before the attention case's idle sweep The single idle-sweep tick keeps a chat whose delivery loop is still running, and the loop parks only after SQL reads that follow the second send's completion event. When the tick ran first it touched the session instead of retiring it, and the 1 s hasSession poll failed. Wait for the loop to park (wake resolves when it does), as goal-steering does. With an 8 ms SQL reply delay injected locally plus CPU load: old 2/5 failed (expected true to be false), new 5/5 passed. --- .../testing/structured-agent-session-attention-reads.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-attention-reads.test.ts b/src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-attention-reads.test.ts index 08ec9fad585..ccd176ee6ed 100644 --- a/src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-attention-reads.test.ts +++ b/src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-attention-reads.test.ts @@ -206,6 +206,8 @@ it('acknowledges a post-rewind completion after normal idle retirement without r ...origin, scope: { ...origin.scope, workspaceId: 'another-workspace' } }) + // The idle sweep keeps a chat whose delivery loop has not parked after the second send. + await rig.host.collaboratorsForTests().conversationDelivery.loop.wake(SESSION) rig.clock.now += IDLE_MS + 1 await sweepOnce(rig.host) await vi.waitFor(() => expect(rig.host.hasSession(SESSION)).toBe(false))