Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(agent-platform): de-flake queued-followups SSE user_message test (#68533)

Robbie316c9d58363e
diff --git a/products/agent_platform/services/agent-tests/src/cases/queued-followups.test.ts b/products/agent_platform/services/agent-tests/src/cases/queued-followups.test.ts
index adb0a9e28216..42a2b84de91d 100644
--- a/products/agent_platform/services/agent-tests/src/cases/queued-followups.test.ts
+++ b/products/agent_platform/services/agent-tests/src/cases/queued-followups.test.ts
@@ -150,10 +150,15 @@ describe('queued follow-ups: real e2e', () => {
await c.drain()
await sendDone!
await c.drain()
- unsubscribe()
- const userMessageEvts = events.filter((e) => e.kind === 'user_message')
- expect(userMessageEvts.map((e) => e.data.text)).toEqual(['follow'])
+ await vi.waitFor(
+ () => {
+ const texts = events.filter((e) => e.kind === 'user_message').map((e) => e.data.text)
+ expect(texts).toEqual(['follow'])
+ },
+ { timeout: 5_000, interval: 25 }
+ )
+ unsubscribe()
})
it('a /send BEFORE the worker dequeues is durable (lands in conversation, not lost)', async () => {