Files
magpie/internal/gateway
yetone 2ba62f7f76 gateway: agy's "Individual quota reached … Resets in" rests the account until then
@Airan_FS on X (11-17): an Antigravity account served through agy-cli
answered "⚠ Individual quota reached. Please upgrade your subscription to
increase your limits. Resets in …" as the model's reply, and routing never
asked the next account.

The agy-cli plugin 0.1.87 (magpie-community/plugins afe4c086, on the dist
branch) now ends such a turn with a rate_limit_error in agy's words, before
or after reply text, so the gateway fails over and rests the account as for
any plugin quota error. Here, quotaResetAfter also reads the notice's
"Resets in 1h18m40s" (Go's duration form, which resetsInWords can't read
since no word ends after its "h"), scoped to the "individual quota reached"
line, so the account rests until Google's reset instead of quotaRest's 15
minutes and isn't asked again every quarter hour. gateway-routing.md says so.

Tests from the literal notice (discuss.ai.google.dev report, the tweet):
TestAgyCLIQuotaNoticeRestsUntilItsResetAndFallsOver (group falls over to
the next member, rest "resets" ~1h18m40s, next turn skips it),
TestAgyCLIQuotaNoticeMidReplyStillRests (partial text kept, still rests),
TestAgyQuotaNoticeResetIsRead.

Run (mica, at f33278541 = this change less the doc line): go test ./...
-timeout 45m: 102 ok, no FAIL. mote: GOOS=windows go vet ./... ok,
GOOS=linux go vet -tags nogui ./... ok; gofmt -l clean.

Broken by hand: the old quotaResetAfter with these tests: the account
rests 14m59s by "quota" and resetsAfter reads 0, so all three fail.

Not tried: a real agy account with its quota used up.
2026-11-17 04:14:34 +08:00
..
gateway tests: a Chat client's reply translated from Anthropic's Messages streams as the vendor sends it — the first chunk when its first event comes, each word as it is written, never the whole reply held to the stream's end — and now a test holds it to that. A reporter's OpenAI-format client on Z.ai's GLM saw the opposite for a while (every event of a reply in one burst once the stream ended, while the same provider's Messages replies streamed fine), and it measured out to be the vendor's doing, not the gateway's: the reporter's own request bodies, replayed at full size against the vendor's chat and Messages endpoints through the gateway's build and beside it, streamed both ways on the day. Nothing locked the translation's pacing, though, so a future hold would read as the vendor's again. TestChatFromAnthropicStreamsAsItComes paces a Messages upstream at 200ms a word — glm-5.3 at an Anthropic-only provider, and a Claude model where Chat and Anthropic URLs both sit, which the Messages redirect takes there anyway — and wants the client's first chunk before the upstream has written its last word (relative to the upstream, not the wall clock, so a loaded runner's setup time is not held against it), at least two of the five pauses reaching it, and one ask on /v1/messages; holding every event of the chat encoder until finish (as the report read) fails it on both branches with the first chunk at the stream's end. And the keepalive table that walks every protocol's quiet stream (TestQuietStreamsKeptAliveEveryProtocol) had responses, anthropic, chat and anthropic from chat; chat from anthropic, the path a chat client on a Messages-only provider takes, was the row missing, and it keeps alive the same as the rest. go test -race -count=2 on the two tests, go vet and the nogui build pass. (#1310)
2026-10-14 15:28:27 +08:00
wip
2026-11-12 12:45:39 +08:00
wip
2026-11-12 12:45:39 +08:00