Files
magpie/docs
yetone e0889719c8 gateway: a Responses WebSocket turn streams without the HTTP stream field (#5291)
OpenAI's WebSocket mode doesn't use the HTTP stream field: a
response.create leaves it out and is streamed all the same. magpie made
each frame into the HTTP body its route would have had and kept the
field as the frame said it, so a client that left it out (M4n5ter on X,
AnacondaKC's Niko in #5291) got the provider's reply unstreamed and
every frame of it at the end. Codex sends stream:true itself, so it
never showed there.

turn now sets stream:true on every generating turn, whatever the frame
says (left out or false). It is the one place the three socket routes
(/v1/responses, /responses and Codex's backend route) make their body,
so all three are covered; a warmup (generate false) still answers
locally before it, and HTTP POSTs are unchanged.

Ported from AnacondaKC's patch in #5291 (62e3fd1ad), with these
differences: the test runs on /v1/responses and /responses, with stream
left out and with stream:false, checks the body sent upstream, and
TestCodexSocketStreamsWithoutStreamField covers Codex's route.

Tests: TestResponsesSocketStreamsWithoutStreamField and
TestCodexSocketStreamsWithoutStreamField, both red with responses_ws.go
at origin/main 8ed2ae030 ("no text delta before the upstream
completed"; "sent to ChatGPT unstreamed"), green with the change (on
mica). go vet ./internal/gateway for darwin, linux (nogui) and windows
on mote; gofmt -l clean.

Full suite (go test -tags nogui -count=1 -timeout 45m ./...) runs on
mica after the push; its result goes on #5291.

Not tried: a real client (Niko or the reporter's) against a real
provider.
2026-11-14 11:05:49 +08:00
..