From e87ea310c3fda35e23db56d4ba34d0ef026548a0 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 14 Oct 2026 18:28:35 +0800 Subject: [PATCH] zen-free tests: the other 32+ MiB guard tests get the CRLF test's 60 s timeout "cumulative pending chat tools are limited across choices and calls" and "chat: completed tool buffers release their cumulative budget" push 33-34 MiB through guardToolResponse and timed out at bun's 5 s default on a machine at load ~200-280 (5104 ms, 5299 ms, 5525 ms). The CRLF test had the same cause and already carries { timeout: 60_000 }; its two siblings that also move 32+ MiB ("single SSE event limit is 32 MiB...", "text streams larger than 32 MiB...") get it too. The work itself is the point of the tests (the 32 MiB limit), so it isn't shrunk. Run: bun test in packages/zen-free 3x at load ~200: 166 pass each time. Before the change the same file failed at this load. Tests only, no version bump, nothing published. --- packages/zen-free/tool-response.test.mjs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/zen-free/tool-response.test.mjs b/packages/zen-free/tool-response.test.mjs index a5697d3..108eea0 100644 --- a/packages/zen-free/tool-response.test.mjs +++ b/packages/zen-free/tool-response.test.mjs @@ -987,7 +987,8 @@ test("ordinary events retain SSE metadata without buffering", async () => { } }); -test("single SSE event limit is 32 MiB and cancels an unterminated upstream", async () => { +// 32+ MiB through the guard, like the CRLF test below: not held to bun's 5 s default +test("single SSE event limit is 32 MiB and cancels an unterminated upstream", { timeout: 60_000 }, async () => { let cancelled = false; let pulls = 0; const bytes = encoder.encode("x".repeat(1024 * 1024)); @@ -1014,7 +1015,8 @@ test("single SSE event limit is 32 MiB and cancels an unterminated upstream", as assert.ok(pulls <= 33); }); -test("cumulative pending chat tools are limited across choices and calls", async () => { +// 32+ MiB through the guard, like the CRLF test below: not held to bun's 5 s default +test("cumulative pending chat tools are limited across choices and calls", { timeout: 60_000 }, async () => { let cancelled = false; let pulls = 0; const argumentsChunk = "x".repeat(1024 * 1024); @@ -1239,7 +1241,8 @@ test("downstream cancellation interrupts a pending upstream read", async () => { } }); -test("chat: completed tool buffers release their cumulative budget", async () => { +// 32+ MiB through the guard, like the CRLF test below: not held to bun's 5 s default +test("chat: completed tool buffers release their cumulative budget", { timeout: 60_000 }, async () => { let count = 0; const bytes = encoder.encode( event(chat({ tool_calls: [call("bash", 0, "x".repeat(1024 * 1024))] }, "tool_calls")), @@ -1290,7 +1293,8 @@ test( }, ); -test("text streams larger than 32 MiB are not subject to the pending-tool limit", async () => { +// 32+ MiB through the guard, like the CRLF test below: not held to bun's 5 s default +test("text streams larger than 32 MiB are not subject to the pending-tool limit", { timeout: 60_000 }, async () => { let count = 0; const bytes = encoder.encode(event(chat({ content: "x".repeat(1024 * 1024) }))); const source = new Response(