From 53c4bc106c324489cb201a296f75aa85ce466fb9 Mon Sep 17 00:00:00 2001 From: rohan nagpal Date: Sat, 24 Jan 2026 15:47:40 +0000 Subject: [PATCH] Tests: avoid timer-based pi-ai stream mock --- CHANGELOG.md | 1 + src/agents/pi-embedded-runner.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 905338fee..5c52dcf58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Docs: https://docs.clawd.bot - Google Chat: normalize space targets without double `spaces/` prefix. - Messaging: keep newline chunking safe for fenced markdown blocks across channels. - Tests: cap Vitest workers on CI macOS to reduce timeouts. +- Tests: avoid fake-timer dependency in embedded runner stream mock to reduce CI flakes. ## 2026.1.23-1 diff --git a/src/agents/pi-embedded-runner.test.ts b/src/agents/pi-embedded-runner.test.ts index ee4b60c30..b5afbaeb0 100644 --- a/src/agents/pi-embedded-runner.test.ts +++ b/src/agents/pi-embedded-runner.test.ts @@ -70,7 +70,7 @@ vi.mock("@mariozechner/pi-ai", async () => { }, streamSimple: (model: { api: string; provider: string; id: string }) => { const stream = new actual.AssistantMessageEventStream(); - setTimeout(() => { + queueMicrotask(() => { stream.push({ type: "done", reason: "stop", @@ -80,7 +80,7 @@ vi.mock("@mariozechner/pi-ai", async () => { : buildAssistantMessage(model), }); stream.end(); - }, 0); + }); return stream; }, };