aetrox333 on Discord: on Codex, bare gpt-6-luna and gpt-6.1-terra
failed with 502 "OpenAI can't be reached (Post …: EOF)" after 43ms
every time, through a fake-IP proxy (chatgpt.com at 198.18.0.12),
while auto/gpt-6-luna and auto/gpt-6.1-terra answered 200 every time.
Cause: a bare Codex model goes to ChatGPT on Codex's own sign-in
(codexUpstreamOn), which ended the turn with 502 at the first transport
error. Go's transport sends a POST again by itself only on a reused
connection (replayable, #2136), so an EOF on a fresh one, a proxy
closing it before a byte of a reply, came straight back to Codex.
auto/ and codex/ go through the accounts loop, which takes the same
502 as passing and asks again after a pause on a new connection, or
asks the group's next member. Both routes share one client, transport,
proxy choice and HTTP/1.1; a recorded diff of the two requests showed
no difference that would change how a proxy treats them (the routed
one adds instructions, Openai-Beta, Session-Id and its own token).
Now a dropped or reset connection with no reply on the own sign-in's
/responses is asked again, retryPause<<n apart, up to lastRetries, as
an overload is (askAgain: the trace shows each try, Codex is kept
alive). The caller gone and a wait that ran out are not asked again.
After the last try Codex is told OpenAI can't be reached, as before.
Run (mote, at this head rebased on dca1d138c): gofmt -l; go vet
./internal/gateway on darwin, linux (-tags nogui) and windows;
go test ./internal/gateway -run 'Codex|Overload|Busy|Retry|Unreach|Socket'
ok 54s; the two new tests -count=3 ok.
Broken by hand: with the new branch turned off,
TestCodexOwnSignInAskedAgainAfterEOF fails with the reporter's exact
text ("OpenAI can't be reached (Post \"…/backend-api/codex/responses\":
EOF)"), and TestCodexOwnSignInEOFTold sees 1 try, not 3. The codex/
case in the first test passes on the old code too (the accounts loop
asked again already), which is the asymmetry reported.
Not tried: the real ChatGPT backend through a real Clash/Surge TUN
proxy; why the reporter's proxy drops the first connection is not
known, and a proxy that drops every connection still ends in 502 (now
after three tries). Whether the reporter's auto/ 200s came from Codex's
sign-in on a second try or from another member of the group is not
known. Magpie's own ChatGPT accounts relayed on this path (on != nil)
and the API-key route are left as they were; the full suite runs after
the push.