From 6b41960c9857b90758d2dc313bd9bd9be4976e1b Mon Sep 17 00:00:00 2001 From: Rhys Sullivan <39114868+RhysSullivan@users.noreply.github.com> Date: Sat, 29 Aug 2026 21:44:57 -0700 Subject: [PATCH] Open cap-eviction sessions at the build-slot cap --- e2e/cloud/mcp-session-cap-eviction.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/e2e/cloud/mcp-session-cap-eviction.test.ts b/e2e/cloud/mcp-session-cap-eviction.test.ts index 6cbddde6a..e679cf59f 100644 --- a/e2e/cloud/mcp-session-cap-eviction.test.ts +++ b/e2e/cloud/mcp-session-cap-eviction.test.ts @@ -151,6 +151,16 @@ scenario( // of them run any work, so every one is immediately eviction-eligible — // crossing the cap must pick at least one and tear it down through its // own stub. + // + // Concurrency stays at MAX_CONCURRENT_BUILDS (session-build-semaphore.ts, + // currently 4), not higher. A wider burst parks the surplus cold inits in + // the build-slot queue INSIDE the DO's `blockConcurrencyWhile` window; + // on a CI runner where four concurrent builds already saturate the CPU, + // queue wait plus build time crosses workerd's budget and the platform + // cancels the init and resets the DO ("blockConcurrencyWhile() ... + // waited for too long"), failing `initialize` with no session id. The + // burst width is incidental here — what this scenario pins is cap + // eviction, which only needs the TOTAL session count to cross the cap. const sessionIds = yield* Effect.forEach( Array.from({ length: SESSIONS_TO_OPEN }, (_, index) => index), (index) => @@ -159,7 +169,7 @@ scenario( openedSessionIds.push(sessionId); }), ), - { concurrency: 8 }, + { concurrency: 4 }, ); expect(sessionIds.length, "every session opened").toBe(SESSIONS_TO_OPEN);