From 6778e44333798dbdfbd49a26c2b665892dc44409 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 27 Apr 2026 11:10:48 +0100 Subject: [PATCH] test(exec): cover background timeout opt-out --- .../bash-tools.exec.background-abort.test.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/agents/bash-tools.exec.background-abort.test.ts b/src/agents/bash-tools.exec.background-abort.test.ts index ea28446d104..772371ae824 100644 --- a/src/agents/bash-tools.exec.background-abort.test.ts +++ b/src/agents/bash-tools.exec.background-abort.test.ts @@ -246,6 +246,26 @@ test("background exec without explicit timeout applies default timeout", async ( }); }); +test("background exec with timeout zero bypasses default timeout", async () => { + const tool = createTestExecTool({ + allowBackground: true, + backgroundMs: 0, + timeoutSec: BACKGROUND_TIMEOUT_SEC, + }); + const result = await tool.execute("toolcall", { + command: BACKGROUND_HOLD_CMD, + background: true, + timeout: 0, + }); + expect(result.details.status).toBe("running"); + const sessionId = (result.details as { sessionId: string }).sessionId; + expect(supervisorMockState.spawnInputs.at(-1)?.timeoutMs).toBeUndefined(); + expect(getFinishedSession(sessionId)).toBeUndefined(); + expect(getSession(sessionId)?.exited).toBe(false); + + cleanupRunningSession(sessionId); +}); + test("yielded background exec still times out", async () => { const tool = createTestExecTool({ allowBackground: true, backgroundMs: 10 }); await expectBackgroundSessionTimesOut({