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,