From 3787530124b44ebc43614dd89ba74b653fdab4cb Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 9 Feb 2026 23:58:31 +0000 Subject: [PATCH] Cover terminal timeout behavior in runtime integration tests Co-authored-by: Theo Browne --- apps/t3/src/runtimeApiServer.test.ts | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index 94abd074d9..15517a1624 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -828,6 +828,45 @@ describe("runtimeApiServer", () => { client.socket.close(); }); + it("marks long-running terminal commands as timed out", async () => { + const server = await startRuntimeApiServer({ + port: 0, + launchCwd: process.cwd(), + }); + servers.push(server); + + const client = await connectClient(server.wsUrl); + await client.nextMessage(); + + const response = await sendRequest( + client.socket, + client.nextMessage, + "terminal-timeout-1", + "terminal.run", + { + command: "sleep 2", + cwd: process.cwd(), + timeoutMs: 100, + }, + ); + expect(response.ok).toBe(true); + if (!response.ok) { + throw new Error("Expected terminal.run timeout response to succeed."); + } + const payload = response.result as { + timedOut: boolean; + stdout: string; + stderr: string; + code: number | null; + }; + expect(payload.timedOut).toBe(true); + expect(payload.stdout).toBe(""); + expect(payload.stderr).toBe(""); + expect(payload.code === null || payload.code > 0).toBe(true); + + client.socket.close(); + }); + it("supports todo mutation lifecycle over websocket RPC", async () => { const server = await startRuntimeApiServer({ port: 0,