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,