From c06af1b25eb94fd4d4dd8d329cdc6e027164fc2a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 9 Feb 2026 23:34:47 +0000 Subject: [PATCH] Cover invalid terminal.run payload errors Co-authored-by: Theo Browne --- apps/t3/src/runtimeApiServer.test.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index a40059b975..9e3e4ed292 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -593,6 +593,34 @@ describe("runtimeApiServer", () => { client.socket.close(); }); + it("returns structured errors for invalid terminal.run payloads", 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-invalid-1", + "terminal.run", + { + command: "", + }, + ); + expect(response.ok).toBe(false); + if (response.ok) { + throw new Error("Expected invalid terminal payload to fail."); + } + expect(response.error?.code).toBe("request_failed"); + + client.socket.close(); + }); + it("reports runtime health metadata", async () => { const server = await startRuntimeApiServer({ port: 0,