From 84303f6a78f1b32f0bcf3eb35e2b79b2e08ba7b3 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 22 Feb 2026 22:13:56 +0000 Subject: [PATCH] test: make exec timeout coverage deterministic --- src/agents/bash-tools.test.ts | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/agents/bash-tools.test.ts b/src/agents/bash-tools.test.ts index f20d4e4da..504b133f8 100644 --- a/src/agents/bash-tools.test.ts +++ b/src/agents/bash-tools.test.ts @@ -164,27 +164,17 @@ describe("exec tool backgrounding", () => { }); it("uses default timeout when timeout is omitted", async () => { - const customBash = createTestExecTool({ timeoutSec: 0.05, backgroundMs: 10 }); - const customProcess = createProcessTool(); - - const result = await customBash.execute("call1", { - command: longDelayCmd, - background: true, + const customBash = createTestExecTool({ + timeoutSec: 0.05, + backgroundMs: 10, + allowBackground: false, }); - const sessionId = (result.details as { sessionId: string }).sessionId; - await expect - .poll( - async () => { - const poll = await customProcess.execute("call2", { - action: "poll", - sessionId, - }); - return (poll.details as { status: string }).status; - }, - { timeout: 1000, interval: POLL_INTERVAL_MS }, - ) - .toBe("failed"); + await expect( + customBash.execute("call1", { + command: longDelayCmd, + }), + ).rejects.toThrow(/timed out/i); }); it("rejects elevated requests when not allowed", async () => {