Repository navigation
fix(antigravity): query quota from the account's forward endpoint - #8979
Merged
Wei-Shaw merged 1 commit intoNov 20, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
resolveAntigravityForwardBaseURL(account)routes paid Antigravity accounts (Pro/Ultra) tohttps://daily-cloudcode-pa.googleapis.comand other accounts tohttps://cloudcode-pa.googleapis.com(withGATEWAY_ANTIGRAVITY_FORWARD_BASE_URLtaking precedence). Model discovery (upstream_models.go) already queries the same endpoint viaFetchAvailableModelsFromURL.AntigravityQuotaFetcher.FetchQuota, however, callsFetchAvailableModelsandRetrieveUserQuotaSummary, both of which start fromBaseURLs[0](prod). Because Google tracksprodanddailyquota buckets separately andprodreturns HTTP 200 with unused buckets, paid accounts serving traffic ondailycontinuously display0%utilization in both per-model quotas and 5h/weekly quota groups.Fixes #8588
Fixes #8850
Change
resolveAntigravityForwardBaseURL(account)inAntigravityQuotaFetcher.FetchQuota.client.FetchAvailableModelsFromURLandclient.RetrieveUserQuotaSummaryFromURLagainst that endpoint so both per-model quotas and 5h/weekly quota groups match the endpoint serving requests, and failures on the selected endpoint do not silently fall back to readingprod's unrelated0%buckets.antigravity_quota_fetcher_test.gocoveringUltra/Proaccounts (daily),Freeaccounts (prod),GATEWAY_ANTIGRAVITY_FORWARD_BASE_URLoverride, and no fallback toprodwhendailyfails.Verification
go test -tags=unit -v ./internal/service/ -run 'TestFetchQuota|TestBuildQuotaGroups|TestNormalizeTier|TestClassifyForbiddenType|TestExtractValidationURL' -racego test ./internal/pkg/antigravity/go vet ./internal/service/ ./internal/pkg/antigravity/Ultraaccounts:GET /api/v1/admin/accounts/:id/usage?force=truereturns the realdaily5h and weekly utilization instead of0%.