From 6ffbb138c71ab5a8cac8e4901b4b37594c9fef6d Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 9 Feb 2026 23:37:50 +0000 Subject: [PATCH] Cover invalid agent.spawn 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 df79fac6da..ceb5fa8b08 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -647,6 +647,34 @@ describe("runtimeApiServer", () => { client.socket.close(); }); + it("returns structured errors for invalid agent.spawn 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, + "agent-invalid-1", + "agent.spawn", + { + command: "", + }, + ); + expect(response.ok).toBe(false); + if (response.ok) { + throw new Error("Expected invalid agent 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,