From 60a516c3539ac50194916abdccf022b6c873d541 Mon Sep 17 00:00:00 2001 From: Staff Engineer Date: Mon, 14 Sep 2026 09:08:51 +0000 Subject: [PATCH] test(ci): widen the git-probe stall budget and its stall floor (BLO-22985) heartbeat-workspace-session.test.ts asserted the strict git-checkout probe returns in < 1500ms when the probe's own deadline is 200ms. Measured actual is 280ms, so the budget carried ~5x margin against a merge-queue runner that has produced 33% wall-clock overruns on this repo's timing tests. Widening the budget alone would have broken the invariant: the fake git only slept 5s, so a probe that ignored its timeout would have landed at ~5.1s against a 5s budget. Raise the stall to 20s in the same change, keeping a genuinely-hung probe 4x over the budget. Measured: healthy 280ms / budget 5000ms / ignored-timeout 20028ms. Refs BLO-22985 Co-Authored-By: Claude --- .../src/__tests__/heartbeat-workspace-session.test.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/src/__tests__/heartbeat-workspace-session.test.ts b/server/src/__tests__/heartbeat-workspace-session.test.ts index c010d90c62d3..890c0be816b3 100644 --- a/server/src/__tests__/heartbeat-workspace-session.test.ts +++ b/server/src/__tests__/heartbeat-workspace-session.test.ts @@ -1073,7 +1073,9 @@ describe("assertGitSensitiveAdapterWorkspaceValid rejects unsafe claude_k8s boot const previousPath = process.env.PATH; const previousTimeout = process.env.PAPERCLIP_STRICT_GIT_CHECKOUT_PROBE_TIMEOUT_MS; try { - await fs.writeFile(path.join(fakeBin, "git"), "#!/bin/sh\nsleep 5\n", { mode: 0o755 }); + // The stall must stay far enough above the budget below that a probe + // which ignores its timeout cannot squeak in under it on a fast runner. + await fs.writeFile(path.join(fakeBin, "git"), "#!/bin/sh\nsleep 20\n", { mode: 0o755 }); process.env.PATH = `${fakeBin}${path.delimiter}${previousPath ?? ""}`; process.env.PAPERCLIP_STRICT_GIT_CHECKOUT_PROBE_TIMEOUT_MS = "200"; await fs.mkdir(fallbackCwd, { recursive: true }); @@ -1084,7 +1086,12 @@ describe("assertGitSensitiveAdapterWorkspaceValid rejects unsafe claude_k8s boot "k8s_agent_home_git_bootstrap_unsupported", "Refusing to dispatch claude_k8s run isolation from the fallback cwd", ); - expect(Date.now() - startedAt).toBeLessThan(1_500); + // Boundedness, not latency: the probe's own deadline is 200ms, so a + // healthy run lands at ~200-400ms including spawn overhead. 5s gives + // that >10x headroom for merge-queue CPU contention (BLO-22985) while + // staying 4x under the 20s stall above, so a probe that ignores its + // timeout still fails here rather than passing on a widened budget. + expect(Date.now() - startedAt).toBeLessThan(5_000); } finally { if (previousPath === undefined) delete process.env.PATH; else process.env.PATH = previousPath;