You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A route returning undefined makes POST /threads/:id/runs/wait answer 500 #714
Split out of #711, which fixed the same bug class on the middleware-reject path. This instance is still live.
The bug
packages/cli/src/lib/dev/runtime-fetch-core.ts:2633 serializes a completed run with:
returnResponse.json(result.output,{status: 200})
result.output is typed unknown and is literally the route's return value (await entry(input, context) in packages/cli/src/lib/runtime/execute-route-core.ts). Response.json(undefined) throws, so a route that returns nothing is caught by the outer handler and answers:
500 {"error":{"kind":"execution_error","message":"Unexpected runtime server failure"}}
The same route over POST /threads/:id/runs/stream answers 200, so the two endpoints disagree about the same run.
Reproduce
A route whose entry returns nothing:
exportconstworkflow=async()=>undefined
Then POST /threads/:id/runs/wait against it.
Why it matters
Before #373 this path was sendJson(200, undefined), which sent a 200 with an empty body. So this is a regression from the same commit that caused #711, just on the route-output path rather than the middleware path.
Not obviously a one-line fix
Unlike the middleware case, the right behavior is a real decision rather than restoring parity by reflex. A route that returns nothing could reasonably be a 200 with an empty body (the old behavior), or it could be a route authoring mistake worth surfacing as a named error. The current 500 is the worst of both: it is an unnamed, undiagnosable failure that contradicts the streaming endpoint. Whichever is chosen should apply to both endpoints.
Activity
fix(cli): answer a body-less middleware reject with its status, not 5…
fix(cli): name the route when runs/wait output cannot be serialized
feat(software-factory): the first live issue, #714 replayed and repai…
feat(software-factory): factory review shows what is approved and app…
docs(software-factory): the live #714 replay through up and run, as i…
feat(software-factory): factory up and factory run, one command each (#…
fix(software-factory): the five findings of the first live run (#1047 …