From e47df9ed764032c905b2afc49d7d95e6acd8a9df Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 18 Feb 2026 18:08:28 +0000 Subject: [PATCH] perf(test): tighten background-abort e2e wait --- .../bash-tools.exec.background-abort.e2e.test.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/agents/bash-tools.exec.background-abort.e2e.test.ts b/src/agents/bash-tools.exec.background-abort.e2e.test.ts index 8ee19937aa..cc34a3e4a4 100644 --- a/src/agents/bash-tools.exec.background-abort.e2e.test.ts +++ b/src/agents/bash-tools.exec.background-abort.e2e.test.ts @@ -1,5 +1,4 @@ import { afterEach, expect, test } from "vitest"; -import { sleep } from "../utils.ts"; import { getFinishedSession, getSession, @@ -52,7 +51,17 @@ async function expectBackgroundSessionSurvivesAbort(params: { const sessionId = (result.details as { sessionId: string }).sessionId; abortController.abort(); - await sleep(150); + const startedAt = Date.now(); + await expect + .poll( + () => { + const running = getSession(sessionId); + const finished = getFinishedSession(sessionId); + return Date.now() - startedAt >= 100 && !finished && running?.exited === false; + }, + { timeout: process.platform === "win32" ? 1_500 : 800, interval: 20 }, + ) + .toBe(true); const running = getSession(sessionId); const finished = getFinishedSession(sessionId);