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,