From afb61a023c343dc1f81ebcfe5f3613fb179a726c Mon Sep 17 00:00:00 2001 From: Laura Thiel Date: Tue, 17 Nov 2026 14:52:49 +0100 Subject: [PATCH 1/2] fix(web): compare the usage total with null before rendering it --- apps/web/features/bot-chat/chat-usage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/features/bot-chat/chat-usage.tsx b/apps/web/features/bot-chat/chat-usage.tsx index 32baa42b..c9a3f745 100644 --- a/apps/web/features/bot-chat/chat-usage.tsx +++ b/apps/web/features/bot-chat/chat-usage.tsx @@ -50,7 +50,7 @@ export function ChatUsage({ botId }: { botId: string }) { ))} - {total && ( + {total !== null && (

Total {total}. Jobs have their own usage.

From 1407a6ac711e7ad93d02b8661b8ff584165a2db2 Mon Sep 17 00:00:00 2001 From: Laura Thiel Date: Tue, 17 Nov 2026 15:04:10 +0100 Subject: [PATCH 2/2] test(files): give oversized PDF extraction time under load The text-limit test and workerErrorExit allowed 5 s. Under a loaded parallel suite the 180-page extraction ran past that and returned "PDF extraction timed out", or tripped the helper's own timer, so the test failed although the text limit worked. Both now allow 30 s, and the test 60 s. --- apps/server/src/files/pdf-text.test.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/server/src/files/pdf-text.test.ts b/apps/server/src/files/pdf-text.test.ts index 17588e5e..cdc67526 100644 --- a/apps/server/src/files/pdf-text.test.ts +++ b/apps/server/src/files/pdf-text.test.ts @@ -37,6 +37,9 @@ function oversizedTextPdf(pages: number): Uint8Array { return new TextEncoder().encode(pdf); } +/** Far above an oversized PDF's extraction time, so a loaded machine still reaches the worker's own limits before a timer. */ +const SLOW_WORKER_MS = 30_000; + async function workerErrorExit(bytes: Uint8Array): Promise { let closed = () => {}; const disconnected = new Promise((resolve) => { @@ -59,7 +62,7 @@ async function workerErrorExit(bytes: Uint8Array): Promise { const timer = setTimeout(() => { timedOut = true; worker.kill(); - }, 5000); + }, SLOW_WORKER_MS); try { await worker.stdin.write(bytes); await worker.stdin.end(); @@ -122,7 +125,7 @@ describe("extractPdfText", () => { ], sampleRss: async () => 1024 * 1024, }; - const limits = { ms: 5000, memoryMib: 512 }; + const limits = { ms: SLOW_WORKER_MS, memoryMib: 512 }; const onePage = await runPdfExtraction( oversizedTextPdf(1), limits, @@ -142,7 +145,7 @@ describe("extractPdfText", () => { "PDF extraction failed", "PDF memory measurement unavailable", ]).toContain(real.reason); - }, 15000); + }, 60_000); test("completion waits for an in-flight RSS sample", async () => { let release = () => {}; let started = () => {};