Commit Graph
1 Commits
Author SHA1 Message Date
yetone 56bc93e9fa gateway: a 400 saying the user's location isn't supported goes to the next member or the fallback, and isn't told as too long (#1621, WardLu)
Antigravity (and Gemini, Code Assist) answer a request from an address
Google doesn't serve with HTTP 400 FAILED_PRECONDITION "User location is
not supported for the API use." retryable() only let a 400/422 through
for model, quota and credit wording, so a routing group stopped at the
member and the backup provider was never asked; Claude Code's turn just
ended. tooLongUnsaid could also read the bare 400 on a long request as a
context overflow.

regionWords now names the refusal: Google's sentence, OpenAI's
unsupported_country_region_territory code and its "Country, region, or
territory not supported" message. A 400/422 matching it is retryable, and
tooLongUnsaid leaves it alone. It is about the address the request went
out from (the machine, or the account's own proxy), not the request, so
the member is rested as failOther: the default 1 min backoff doubling to
10 min, never the 30 min credit rest or days. As WardLu set out, not every
400 is retryable: "location field is not supported", "Invalid value for
location parameter" and "messages: field required" stay where they were,
and a 200 whose text has the sentence switches nothing.

Run: go test -tags nogui ./internal/gateway/ (TestTurnDoneSaidAtTheTurnsEnd
red under load, the cause in #1629 and fixed in its own commit; everything
else green), -run 'Region|Shape|NoFallback|PayloadTooLarge|Fallback'
green; gofmt -l; go vet -tags nogui for linux, windows and darwin.
Without the change in fallback.go, TestRegionRefusalIsRetryable,
TestRegionRefusalIsNotTooLong, TestGroupFailsOverARegionRefusal and
TestFallbackOnRegionRefusal all fail.
2026-10-11 22:45:09 +08:00