wjh66 on Discord (Windows, v0.1.2710, Codex on the ChatGPT sign-in,
gpt-6.1-sol): every turn showed "reconnecting 5/5", and app.log had the
backend's "Our servers are currently overloaded" again and again.
With one ChatGPT account, magpie asks an overloaded turn again
(lastRetries) and keeps Codex alive past keepHeldAfter with the stream's
200 and comments. When the retries ran out, the backend's busy status
(529, or a 503 saying overloaded) went to Codex in that stream as
response.failed with code server_error. Codex reads server_error as
Retryable (codex-rs codex-api sse/responses_error.rs) and sent the turn
five more times, each one asked three times by magpie: 18 asks of an
overloaded model, then the last error alone. The backend itself says
an overload in a stream as server_is_overloaded (#1418), which Codex
reads as ServerOverloaded: "Selected model is at capacity. Please try a
different model.", without the reconnects.
streamError now gives a Responses client server_is_overloaded when the
status is 529, or a 5xx whose words say overloaded (saidOverloaded).
Other failures keep server_error, which Codex retries. A routing group
or the codex subscription's fallbacks still take an overload before any
of this, as before.
This does not explain the earlier "error decoding response body".
Codex says that only when the body of a 2xx fails to read. magpie's
streams read clean over real TCP in every overload shape tried (see
07f4d46c5, which logs a reply cut early).
Ran on mote at this change rebased on 1cb4d4301: gofmt; go vet
darwin, GOOS=linux -tags nogui, GOOS=windows; go test -count=1
-timeout 45m ./internal/gateway: ok but for TestCodexPoolSaysTheClientsVersion,
the known #4807 (the machine's own Codex 0.165.0 identity reaches it).
At the pushed head (rebased on f95bacdfb, whose new commits add
hub_mcp.go to the gateway, nothing of streamError): go vet darwin,
linux, windows, and the overload, StreamError and Hub tests: ok. On Windows (win-run):
TestCodexKeptAliveOverload*, TestStreamErrorOverloadOnly,
TestCodexOneAccount*, TestCodexOwnModel*, *Overload*, *StreamError*,
TestCodexReplyBrokenOffLogged, TestCodexClientGoneLogged: ok, 50 tests.
Broken by hand: with the else-if turned off,
TestCodexKeptAliveOverloadSaysServerIsOverloaded is red in both
subtests (503 message, 529): code "server_error".
Not tried: a real ChatGPT account or the real Codex client against
this build. Whether gpt-6.1-sol is busy for this account only, or the
same request without magpie. The Windows system proxy between Codex
and 127.0.0.1 as the cause of the decode error.