Skip to content

Commit bf7d9e0

Browse files
committed
fix(showcase): convert v2 runtime 404 to 400 for smoke probe compat
The v2 createCopilotRuntimeHandler returns 404 for malformed POSTs to the base path, while the v1 API returns 400. The smoke probe treats 404 as "route not wired" and marks agent:built-in-agent red. Wrap the POST handler to convert 404→400 so the probe reads it as proof-of-life.
1 parent c47ac31 commit bf7d9e0

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • showcase/integrations/built-in-agent/src/app/api/copilotkit

showcase/integrations/built-in-agent/src/app/api/copilotkit/route.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ const handler = createCopilotRuntimeHandler({
1515
basePath: "/api/copilotkit",
1616
});
1717

18+
async function withProbeCompat(req: Request): Promise<Response> {
19+
const res = await handler(req);
20+
if (res.status === 404) {
21+
const body = await res.text();
22+
return new Response(body, { status: 400, headers: res.headers });
23+
}
24+
return res;
25+
}
26+
1827
export const GET = (req: Request) => handler(req);
19-
export const POST = (req: Request) => handler(req);
28+
export const POST = (req: Request) => withProbeCompat(req);
2029
export const OPTIONS = (req: Request) => handler(req);

0 commit comments

Comments
 (0)