From ec24213db7a3e02289e5fde2e74882f35d986563 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 9 Feb 2026 23:59:40 +0000 Subject: [PATCH] Cover terminal.run cwd execution semantics in runtime tests Co-authored-by: Theo Browne --- apps/t3/src/runtimeApiServer.test.ts | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index 15517a1624..3c4bbaf65c 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -867,6 +867,39 @@ describe("runtimeApiServer", () => { client.socket.close(); }); + it("runs terminal commands in the requested cwd", 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-cwd-1", + "terminal.run", + { + command: "pwd", + cwd: process.cwd(), + }, + ); + expect(response.ok).toBe(true); + if (!response.ok) { + throw new Error("Expected terminal cwd response to succeed."); + } + + const payload = response.result as { + stdout: string; + }; + expect(payload.stdout.trim()).toBe(process.cwd()); + + client.socket.close(); + }); + it("supports todo mutation lifecycle over websocket RPC", async () => { const server = await startRuntimeApiServer({ port: 0,