test(exec): cover background timeout opt-out

This commit is contained in:
Peter Steinberger
2026-04-27 11:10:48 +01:00
parent 07946a404d
commit 6778e44333

View File

@@ -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({