Repository navigation
fix(quota): stop resending requests to an account whose weekly window is empty - #112
Merged
Merged
Conversation
… is empty fetchAccountQuotaDetails saved only the five-hour window, so an account with weekly at 0% and fiveHour above it kept being selected: 429, a mark in rateLimitResetTimes, and the same account again on the next request. It now keeps the minimum of both windows, and the fetchAvailableModels fallback covers 3.8 Flash, Argon and Claude 5.5 instead of returning an empty cachedQuota. Three empty responses in a row no longer end in 'All Antigravity accounts failed': the loop retries the same endpoint instead of burning the three fallbacks, the attempt counter is per request instead of a global map, and EmptyResponseError is propagated. Also: verifyAccountAccess points at the fallback endpoint with the CLI user agent and a model that still exists; google_search uses the same user agent, honours thinking and rotates accounts; the synthetic usageMetadata chunk is emitted unwrapped.
Automated verification
typechecktestsbuild |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Five defects from the audit, all in the quota and search path.
Weekly quota hidden by the five-hour window.
fetchAccountQuotaDetails(quota.ts) stored onlyfiveHourincachedQuota, so an account withweekly = 0%andfiveHour > 0%was picked again on every request: 429, mark inrateLimitResetTimes, same account again. It now keeps the minimum of both windows, andALLOWED_PREFIXEScovers 3.8 Flash, Argon and Claude 5.5, which used to getcachedQuota: {}from the fallback.All Antigravity accounts failedafter three empty bodies. Thecontinuein the endpoint loop burned the three fallbacks without retrying, and the globalemptyResponseAttemptsmap left the counter at 3, aborting the next request of the session. Now the loop retries the same endpoint, the counter is per request, andEmptyResponseErroris propagated.verifyAccountAccesspointed at PROD (429), used the retired Electron user agent and a model that no longer exists.google_searchused the obsolete user agent, the sandbox host without fallback or account rotation, and ignoredthinking(missing from the v2 schema).flush()emitted the syntheticusageMetadatachunk wrapped in{ response: ... }, which the SDK parser discards.Eleven new tests, including one where an account with
weeklyat zero must not be selected again. Suite: 48 files, 1222 tests.