bitssly on X (11-06): with Codex's quota used up, the Codex app on
Windows flickered and errored, and only a restart fixed it.
With two or more ChatGPT accounts on, Codex's turn is routed through
serve. When every account refused with the backend's 429
usage_limit_reached (or 403 usage_not_included), passthrough wrote it
through writeVendorError. That re-typed it as rate_limit_error and
dropped the x-codex-* headers. codex-rs's api_bridge maps only
usage_limit_reached to UsageLimitReached (plan, reset, windows from
the x-codex-* headers). Any other 429 is a retryable status ending in
"exceeded retry limit, last status 429", so the app had no limit or
reset to show. On one account the refusal was already relayed as sent.
codexOutRefusal/writeCodexOut (codex_out_reply.go) now relay a ChatGPT
account's usage_limit_reached/usage_not_included on Responses as the
backend wrote it: its status, its error object (plan_type, resets_at
kept as written, through json.Number) with magpie's message, and its
x-codex-* headers. A rate_limit_exceeded 429, a key's 429 and other
protocols keep magpie's shape. Turns held before any account is asked
(a cap the user set, credits not to be spent) keep rate_limit_error and
magpie's advice: Codex shows no message on a usage_limit_reached, and
TestCodexNoCreditsEveryAccount guards that advice.
The full-window "hit a snag" page itself is the #4550 class: magpie
ends the app-server at the used-up takeover or a switch off a spent
account, and the ChatGPT app's identity check throws. v0.1.3045 and
later reopen the app when it logged fatal_error_broadcasted. That still
needs bitssly's version and logs to confirm.
Run at origin/main 8f69ca29c plus this, on mote:
- gofmt -l internal/gateway: nothing
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
vet ./..., go build, GOOS=linux go build -tags nogui, GOOS=windows go
build: ok
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok (1154s)
On xiaomi-gpu (win-run): TestCodexEveryAccountOutToldAsTheBackend,
TestCodexRateLimitNotToldAsUsedUp and TestCodexOneAccountSpent*: ok.
Rebased on 303a31dd6 (37c1bc043 touched provider and a gateway
test), then at the pushed head on mote: go build, go vet
./internal/gateway ./internal/provider, go test -tags nogui -run
"Codex|Group" ./internal/gateway: ok.
Broken by hand: with the codexOutRefusal call disabled,
TestCodexEveryAccountOutToldAsTheBackend/usage_limit_reached is red
(type rate_limit_error, plan_type/resets_at missing, no x-codex-*
headers on either turn).
Not tried: the full go test ./... (mote at load 428 with two full
suites queued on suite.lock; this changes only internal/gateway); a
real Codex app against a used-up account; a usage_limit_reached that
arrives in-stream after a 200 (response.failed), which this doesn't
change.