From a45ed8fc0929218ded696e25e96eb4963e59996f Mon Sep 17 00:00:00 2001 From: M Waleed Kadous Date: Thu, 30 Jul 2026 03:16:49 -0700 Subject: [PATCH] Fix send-integration e2e flake: raise afterAll teardown budget to match beforeAll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The suite's afterAll declared an explicit 10s budget, overriding the config's 300s hookTimeout, while beforeAll gets 120s — an unintentional asymmetry. The teardown does two deactivate fetches + stopServer's SIGTERM wait + 3 rmSync, which exceeds 10s on a loaded CI runner, failing the whole suite after all 5 tests pass. Hit PRs #1283, #1290, and #1301 across two days. Raise the budget to 120s and bound the two deactivate fetches with AbortSignal.timeout(10s) so a hung Tower can't eat the enlarged budget either. --- .../agent-farm/__tests__/send-integration.e2e.test.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/codev/src/agent-farm/__tests__/send-integration.e2e.test.ts b/packages/codev/src/agent-farm/__tests__/send-integration.e2e.test.ts index f2a55e417..d537eb5dc 100644 --- a/packages/codev/src/agent-farm/__tests__/send-integration.e2e.test.ts +++ b/packages/codev/src/agent-farm/__tests__/send-integration.e2e.test.ts @@ -254,12 +254,12 @@ describe('send integration (POST /api/send → /ws/messages)', () => { // Guard against setup failure — variables may be undefined if (workspaceA) { const encA = encodeWorkspacePath(workspaceA); - await fetch(`http://localhost:${TEST_TOWER_PORT}/api/workspaces/${encA}/deactivate`, { method: 'POST' }).catch(() => {}); + await fetch(`http://localhost:${TEST_TOWER_PORT}/api/workspaces/${encA}/deactivate`, { method: 'POST', signal: AbortSignal.timeout(10_000) }).catch(() => {}); cleanupWorkspace(workspaceA); } if (workspaceB) { const encB = encodeWorkspacePath(workspaceB); - await fetch(`http://localhost:${TEST_TOWER_PORT}/api/workspaces/${encB}/deactivate`, { method: 'POST' }).catch(() => {}); + await fetch(`http://localhost:${TEST_TOWER_PORT}/api/workspaces/${encB}/deactivate`, { method: 'POST', signal: AbortSignal.timeout(10_000) }).catch(() => {}); cleanupWorkspace(workspaceB); } @@ -270,7 +270,10 @@ describe('send integration (POST /api/send → /ws/messages)', () => { try { rmSync(`${dbBase}.db`, { force: true }); } catch { /* ignore */ } try { rmSync(`${dbBase}.db-wal`, { force: true }); } catch { /* ignore */ } try { rmSync(`${dbBase}.db-shm`, { force: true }); } catch { /* ignore */ } - }, 10_000); + // 120s to match beforeAll — the old explicit 10s override was tighter than + // the two deactivate calls + stopServer's SIGTERM wait can guarantee on a + // loaded CI runner, and a slow teardown failed the whole green suite. + }, 120_000); // ---- Single-workspace send tests ----