Files
magpie/docs
yetone e9ae318589 gateway: a relay's 500 "负载已经达到上限" is a busy server, not quota, so a group's Patience waits it out (#1418, real-jacket)
real-jacket's relay answered 500 "当前模型 gpt-5.5 负载已经达到上限,请稍后重试
(request id: …)". usedUpWords matched 上限, so failure() called it
failQuota: the key rested till a reset and busy() (5xx only when
failOther) never let Patience wait, so the agent got the 500 at once.

Change: a 5xx is out of quota only on a vendor's own quota code
(quotaCodes: Claude Code's "usage limit reached|<unix>",
usage_limit_reached, RESOURCE_EXHAUSTED). The quota words still classify a
4xx, and the 429 plan words are unchanged; credit is unchanged.
gateway-routing.md says so.

Run:
- routing_test's failure table: the literal 500 → failOther; a 503
  "upstream quota service unavailable" → failOther; 500
  usage_limit_reached and 503 RESOURCE_EXHAUSTED → failQuota; 403
  "今日额度已达上限" → failQuota; 429 "当前分组上游负载已饱和" → failRate.
- New TestGroupWaitsOutRelayLoadLimit (two members answering the literal
  500, Patience 240): fails on the old code with the 500 (a 1, b 3), now
  200 after a replan with no quota rest.
- go test ./internal/gateway, gofmt, GOOS=linux/windows go vet -tags nogui.

Not done: a 429 with the same load wording still reads as quota (no
literal case of it seen).
2026-10-11 19:59:15 +08:00
..