Commit Graph
2 Commits
Author SHA1 Message Date
yetone bf60ea5968 routing: an earlier account's overload reads overloaded, not quota used up (danzi002)
danzi002 on Discord (v0.1.3005): a Codex request's row read "529 · 额度用尽"
(quota used up) while its detail said ChatGPT's 529
service_unavailable_error server_is_overloaded, on an account with its
allowance left. The account was not rested as spent: an overload is
failOther, rested a moment at most (vendorOverloaded). The words came
from the row. When the last account left is out of its allowance after
an earlier one failed otherwise, Codex is told the earlier failure
(Try.Earlier), and the route takes that one's status, but the row paired
that status with the last try's own fail, quota.

The route now records the kind of the failure the agent was told
(Route.Fail, from toldFail: overloaded for a 529 or a 5xx that says
overloaded, the prompt turned away, else failure's reading), at both
places serve tells an earlier try's failure: Try.Earlier, and every
account after it passed over by a middleware. The Routing page and the
panel's request rows (endWord) say that kind when it is there.
"servers overloaded" is a new word for the row only (en, zh, zh-TW, ja, de),
never a rest's Why.

Run (mote, through mote-run; rebased on origin/main 234903cb2, the
first three lines and the i18n/GUI line below run again there):
- go test -tags nogui -count=1 -run 'TestToldOverloadIsNotQuota|TestToldFailKinds|TestCodexCapacityNotLabelledUsageLimit' ./internal/gateway: ok
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok (764s, before the rebase on 234903cb2)
- gofmt -l internal/gateway: clean; go vet -tags nogui ./internal/gateway,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok
- node --test routing-told-overload (new; Chromium and WebKit, en zh
  zh-TW ja de, 1100 and 420px) and routing-went-on: 40 of 40
- node --test i18n-keys i18n-en-no-cjk routing-told-overload routing-went-on: 48 of 48
- node --test routing-*.test.cjs panel-routing*.test.cjs i18n-*.test.cjs:
  2673 of 2704. One red was mine: i18n-keys, the plugin word
  "overloaded" is also a Go string (affinity.go), so the word is now
  "servers overloaded". The other reds are in routing-levels, -many-keys,
  -order-unknown, -row-swap, -rule-drag, -rule-remove, -rules-line,
  -steady, -steps-cap and -story-shrinks: rerun alone, 26 of 124 red here,
  and 24 of 96 red on origin/main 0e55a7593 (mote at load ~25), already
  filed (#5088, #4932 and others)

Broken by hand:
- the two t.Fail = toldFail(other) updates removed:
  TestToldOverloadIsNotQuota red ("the route says the agent was told a
  "" failure, want "overloaded": its row reads 529 · quota")
- endWord back to last.fail: routing-told-overload red in every engine
  and language

Not tried: a real ChatGPT 529 overload (can't be caused on demand), so
the reporter's own path is inferred: several ChatGPT accounts, the last
out of its allowance. The middleware passed-over site has no test of its
own; it uses the same toldFail. The whole GUI suite and the full
go test ./... were not run before the push; the full suite runs after.
2026-11-05 11:13:43 +08:00
yetone 7353a4bc2a gateway: a row told an earlier try's 529 overload says its kind, not the last account's usage_limit_reached (蛋仔)
蛋仔 on Discord: a Codex turn over ChatGPT accounts showed in Usage →
Requests as "529 · usage_limit_reached · 4 次尝试", while Codex said
"Selected model is at capacity. Please try a different model." The
model at capacity is no used-up quota.

Cause: when the last account left is out of its allowance and one
asked before it failed otherwise, serve tells the agent that earlier
failure (waroy's rule): call.Status and call.Error were swapped for
the earlier try's, but call.Usage.ErrType kept the last account's
usage_limit_reached, so the row paired the 529 and its words with the
quota's kind. The same swap where middleware passes every account
over. Try now keeps the failure's kind (errType, unexported, not in
the trace JSON) wherever it is kept as `other`, and both swaps take it.

Accounts were not rested for the overload: failure(529, …) is not
failQuota, vendorOverloaded rests the overloaded account 30s at most a
minute with no failure counted, and only the account that answered
usage_limit_reached rests till its reset. The new test checks that too.
Anthropic's 529 overloaded_error handling (saidOverloaded,
vendorOverloaded, fallback/patience status lists) is unchanged; the
own-sign-in path (codex_backend.go) records its own failure's kind and
never swapped one in. What Codex is told is unchanged.

Test: TestCodexCapacityNotLabelledUsageLimit (two ChatGPT accounts,
acct-1 529 with the backend's overload and with the words Codex
showed, acct-2 429 usage_limit_reached): the row is 529 · server_error,
the overloaded account rests a minute at most, one account rests hours.

Run on mote (mote-run), at this tree on origin/main 7dd2434d3:
- broken by hand (the two swaps without ErrType): the new test FAILs,
  "row: 529 · \"usage_limit_reached\" · \"Codex: Selected model is at
  capacity. Please try a different model.\"", both subtests; restored,
  ok.
- gofmt -l internal/gateway: empty; go vet, GOOS=linux go vet -tags
  nogui, GOOS=windows go vet of ./internal/gateway: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok (791.8s)
- GUI files that render err_type (ledger-cache-tokens,
  usage-ledger-detail, usage-session-speed, usage-loops): Chromium 60
  pass 0 fail, WebKit 30 pass 0 fail (no GUI change).

Rebased on origin/main 844c35505 (no internal/gateway change since
7dd2434d3); the new test and the overload/spent tests: ok there.

Not tried: a real ChatGPT account at capacity (can't be made to
happen); the full ./... suite (runs after the push); Windows/Linux runs.
2026-11-04 19:25:42 +08:00