Files
magpie/docs
yetone 4fbb75c3a8 gateway: Codex's 507 "exceeded request buffer limit" is asked again and told as a 503, not relayed as it came (#2034, sparrowu93)
sparrowu93's pi, on a ChatGPT account, stopped on
"Codex: 507 Insufficient Storage: exceeded request buffer limit while
retrying upstream". That text is Envoy's (ChatGPT's front): its first
try at the backend failed, and the body was more than it buffers to
try again. It is the same backend failure as #1628's 503 "reset before
headers", which magpie already asks again for without resting anybody,
only for a body the front couldn't retry itself. magpie relayed the 507
as it came; pi's _isRetryableError (pi-coding-agent 0.73.0,
agent-session.js) matches 503 but not 507 or these words, so the turn
just ended.

codexDropped now reads that 507 (by Envoy's words alone, any size, since
the 507 itself says the body was large) the way it reads the large
request's 503: the accounts loop asks the next account and the last one
again, nobody rests, and the agent is told a 503 with Envoy's words and
what may help (/compact, fewer or smaller images). The relayed path
(codexUpstreamOn, Codex's own sign-in) asks again the same way: the two
share edgeMayDrop/edgeSaidDrop. A 507 in other words is relayed as it
came. gateway-routing.md says so.

Run:
- New TestCodexUnbufferedAskedAgain, TestCodexUnbufferedTold503,
  TestCodexUnbufferedRelayed, TestCodexOther507Stays, with the
  reporter's literal Envoy text as the fixture. On the old code the first
  three fail: "status 507, want 200 pong: {...\"message\":\"Codex: 507
  Insufficient Storage: exceeded request buffer limit while retrying
  upstream\"...}" (the reporter's message byte for byte), and
  "507 once: 507 ... tried [acct-1]". With edgeSaidDrop matching every
  507, TestCodexOther507Stays fails. Restored, all pass, with #1628's
  TestCodexReset* tests.
- go test -tags nogui ./internal/gateway/ (sandbox HOME, pinned caches),
  gofmt -l, go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet
  (with and without nogui) on internal/gateway.
Not tried: a real 507 from ChatGPT (it needs the backend to fail a
request over Envoy's buffer, which can't be made to happen on purpose).
2026-10-14 05:37:00 +08:00
..