Antigravity answers the system prompt of Claude Code and the Claude Agent
SDK (Claude Desktop's chats) with 429 "Resource has been exhausted" at
whatever quota is left (#666). The detail text already said it was not a
quota, but when Antigravity was the last one left (a direct model, the
reporter's case) the route still fell through to failureOf: the try was
counted 额度用尽 on the Routing page and in the account's tally, and the
429 went to the client, so Claude Desktop asked ten times over.
What changed:
- codeassist.go: antigravityTurnedAway(p, system, said) needs the
Antigravity account, a Claude Code / SDK system prompt and the
"resource has been exhausted" words. A real quota 429 ("You have
exhausted your capacity ... reset after ...", QUOTA_EXHAUSTED) stays a
quota and rests the account as before. turnedAwayStatus = 400 (the
Anthropic and OpenAI SDKs retry 408, 409, 429 and 5xx, not 400);
ledger ErrType "prompt_turned_away".
- gateway.go: such a try is failPrompt (was failRefused in a group, and
failQuota as the last), no rest, no usage re-asked, no passing retry,
no auto reset. The last one left answers the agent 400 with the
vendor's words and the hint; in a group the next member is asked, and
if it fails only on a quota the agent is told the turned-away 400. The
in-reply (stream error event) form is told the same way.
- continuation.go / translate: the hint is appended to the in-reply form
too, and the ledger row carries the ErrType.
- routing.js: the hint joins HINTS, so the Routing page shows Antigravity's
words as "It said: ..." and the explanation on its own line, translated
in zh, zh-TW, ja and de (i18n.js).
Tests (each fails on the old gateway.go/continuation.go/routing.js):
- TestAntigravityTurnedAwayLastIsNoQuota (stream and not): 400, asked once,
failPrompt, no rest, ledger 400 prompt_turned_away.
- TestAntigravityTurnedAwayInsideTheReplyLast, TestAntigravityTurnedAwayThenAQuota,
TestAntigravityQuotaOnAClaudeCodeTurnStaysQuota (scope: a real quota
429 still rests and reaches the agent as 429),
TestAntigravityTurnedAwayHintIsTheRoutingPages.
- gui/tests/routing-ag-turned-away.test.cjs: row status word, account
tally, "It said" line and the hint line, in en/zh/zh-TW/ja/de.
The real-quota fixture's words are from public reports, not captured from
a real account.
Run: gofmt -l internal/ (clean); go vet ./internal/gateway/ and
GOOS=linux / GOOS=windows go vet -tags nogui ./internal/gateway/;
go build ./..., GOOS=linux and GOOS=windows go build -tags nogui ./...;
go test -tags nogui ./internal/gateway/ ./internal/gui/... under a
scratch HOME with pinned caches (ok); GUI node tests (new test,
routing-*, gui-de, gui-ja, gui-zh-tw, i18n-keys) in Chromium and WebKit.