From 08f87f0cad8241cd4d2d968bf19d0c7ce7c3118f Mon Sep 17 00:00:00 2001 From: cliffhall Date: Wed, 18 Nov 2026 14:58:02 -0500 Subject: [PATCH] fix(memory): give the real-endpoint HTTP tests a timeout clear of a slow runner Two Streamable HTTP tests timed out at Vitest's 5 s default on one Windows CI leg in 56. Measured over 1,040 runs of the suite on 13 Windows runners, they take a median of 140 ms and 72 ms and never reached 1 s; the lock was always taken on the first try and the save's rename took at most 11 ms. In the failed leg the whole suite ran five times slower than its median, with in-memory tests slowed as much as the HTTP ones, so the cause is the runner, and the tests with the most round trips crossed the limit. Both describes now carry an explicit 30 s timeout with the measurements. Closes #5570 Co-Authored-By: Claude Fable 5.2 Signed-off-by: cliffhall --- src/memory/__tests__/http.test.ts | 12 +++++++++++- src/memory/__tests__/write-limits.test.ts | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/memory/__tests__/http.test.ts b/src/memory/__tests__/http.test.ts index 70af182f6c..7bb957a0e9 100644 --- a/src/memory/__tests__/http.test.ts +++ b/src/memory/__tests__/http.test.ts @@ -49,7 +49,17 @@ async function connect( return client; } -describe("Streamable HTTP", () => { +// These cases drive a real endpoint over real sockets, and the first one also +// pays the client's first connect. Measured on Windows CI (#5570): a median of +// 140 ms for the first case and never 1 s in 1,040 runs of the suite, yet one +// leg in 56 timed out at Vitest's 5 s default, on a runner so slow that the +// whole suite took five times its median. Nothing in the endpoint or the file +// lock waited; every test was slow at once, and the ones with the most round +// trips crossed the limit. The limit is here to catch a hang, so it sits well +// clear of a slow runner. +const REAL_ENDPOINT_TIMEOUT_MS = 30_000; + +describe("Streamable HTTP", { timeout: REAL_ENDPOINT_TIMEOUT_MS }, () => { let running: RunningHttpServer | undefined; let graph: Awaited>; diff --git a/src/memory/__tests__/write-limits.test.ts b/src/memory/__tests__/write-limits.test.ts index 4e81d934a8..c7bd4efdfd 100644 --- a/src/memory/__tests__/write-limits.test.ts +++ b/src/memory/__tests__/write-limits.test.ts @@ -300,7 +300,12 @@ describe("write limits", () => { }); }); -describe("write limits over Streamable HTTP", () => { +// A real endpoint over real sockets, and this file's first client connect. On +// Windows CI it takes a median of 72 ms and never took 1 s in 1,040 runs of +// the suite, but it timed out once at Vitest's 5 s default, on a runner that +// slowed the whole suite fivefold (#5570; `http.test.ts` has the detail). The +// limit is here to catch a hang, so it sits well clear of a slow runner. +describe("write limits over Streamable HTTP", { timeout: 30_000 }, () => { it("holds the endpoint's write tools to the limits it was given", async () => { vi.spyOn(console, "error").mockImplementation(() => {}); const { filePath, cleanup } = await makeTempGraph();