Repository navigation
fix(antigravity): normalize tool calls and classify resource exhaustion as lockout - #2828
Merged
diegosouzapw merged 11 commits intoMay 29, 2026
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Kilo Code Review could not run — your account is out of credits. Add credits or switch to a free model to enable reviews on this change. |
diegosouzapw
merged commit May 29, 2026
f1eb08c
into
cheaper-inference:release/v3.8.6
2 of 3 checks passed
Merged
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.
Related Issues & Background
Currently, when utilizing Gemini or customized Antigravity backends with complex routing combinations (such as combos incorporating fallback behaviors), the router struggles with two major issues:
Resource has been exhaustedor credits running out), the error was labeled asrate_limitedrather thanquota_exhausted. Becauserate_limiteddefaults to a tiny cooldown (e.g. 5 seconds), every single incoming request repeatedly attempts to invoke the broken model, suffering slow network timeouts (4s to 12s per call) before eventually routing to a fallback low-tier model.Key Changes In This Pull Request
1. Gemini / Antigravity Tool Call Normalization & Sanitization
stripZeroWidthText()) in the response sanitizer to guarantee correct payload parsing.containsTextualToolCallMarker()&parseTextualToolCallContent()) to transparently capture and convert inline textual tool calls to structured OpenAItool_callsformats when missing, suppressing them from plaintext outputs so client UIs stay clean.applyTextualToolCallStreamingGuard()) to buffer fragmented JSON slices before emitting, preventing client-side parsers from choking on partial pseudo-tags.2. Adaptive Model Lockout for Quota Exhaustion (429 classification)
src/shared/utils/classify429.tsandopen-sse/services/accountFallback.tsto seamlessly classify Google'sResource has been exhaustedandCheck quotawarnings.src/sse/services/auth.tsto analyze 429 response bodies usinglooksLikeQuotaExhausted(). If a quota limit signature is found, the system marks the backend model asquota_exhausted.quota_exhaustedstatus, the combo router dynamically skips the node altogether—returning fallback targets (like Flash) instantly (reducing latency from 13 seconds of network cascading down to < 2.5 seconds).Verification & Testing
Node --test tests/unit/classify429.test.ts(14/14 tests passing)