From d747326096572b3523cf1601eea412da879c6526 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 9 Feb 2026 23:42:11 +0000 Subject: [PATCH] Cover invalid provider respond decision payload errors Co-authored-by: Theo Browne --- apps/t3/src/runtimeApiServer.test.ts | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index 6df6c14681..af46c37f68 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -677,6 +677,36 @@ describe("runtimeApiServer", () => { client.socket.close(); }); + it("returns structured errors for invalid providers.respondToRequest 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, + "provider-respond-invalid-1", + "providers.respondToRequest", + { + sessionId: "sess-1", + requestId: "req-1", + decision: "invalid-decision", + }, + ); + expect(response.ok).toBe(false); + if (response.ok) { + throw new Error("Expected invalid provider decision 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,