Repository navigation
fix(quota): fix antigravity/agy multi-model quota skipping in combos - #7695
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for the 'antigravity' and 'agy' providers to the quota and rate-limiting systems, ensuring that model families (such as Claude and Gemini) are properly isolated. It updates prefix normalization, provider checks, rate limiter key generation, and quota exhaustion logic, and adds corresponding unit tests. Feedback on these changes highlights two key issues: in both the quota cache and the rate limiter, grouping unknown models under the generic 'other' family will cause them to incorrectly share quota evaluations and rate limits. To prevent this, exact-model scoping should be preserved for any models classified under the 'other' family.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const requestedFamily = getAntigravityQuotaFamily(requestedModel); | ||
| const matchingWindows = quotaNames.filter((windowName) => { | ||
| return getAntigravityQuotaFamily(windowName) === requestedFamily; | ||
| }); |
There was a problem hiding this comment.
Grouping all unknown models under the 'other' family in isQuotaExhaustedForRequest causes them to share a single quota evaluation. If one unknown model is exhausted but another is not, the exhausted model will not be correctly blocked because matchingWindows.every(...) will evaluate to false. To preserve exact-model scoping for unknown models, we should match the exact model name when the family is 'other'.
const requestedFamily = getAntigravityQuotaFamily(requestedModel);
const matchingWindows = quotaNames.filter((windowName) => {
const family = getAntigravityQuotaFamily(windowName);
if (family === "other" || requestedFamily === "other") {
const getBare = (m: string) => {
const norm = m.toLowerCase().trim().replace(/^(antigravity|agy)\/\//, "");
const idx = norm.indexOf("/");
return idx >= 0 ? norm.slice(idx + 1) : norm;
};
return getBare(windowName) === getBare(requestedModel);
}
return family === requestedFamily;
});| if ((provider === "antigravity" || provider === "agy") && model) { | ||
| const family = getAntigravityQuotaFamily(model); | ||
| return `${provider}:${connectionId}:${family}`; | ||
| } |
There was a problem hiding this comment.
Using the 'other' family name directly in the rate limiter key groups all unknown models under a single rate limiter. A 429 on one unknown model would then incorrectly pause requests for all other unknown models on the same connection. We should use the exact model name as the scope when the family is 'other' to preserve exact-model rate limiting.
| if ((provider === "antigravity" || provider === "agy") && model) { | |
| const family = getAntigravityQuotaFamily(model); | |
| return `${provider}:${connectionId}:${family}`; | |
| } | |
| if ((provider === "antigravity" || provider === "agy") && model) { | |
| const family = getAntigravityQuotaFamily(model); | |
| const scope = family === "other" ? model : family; | |
| return `${provider}:${connectionId}:${scope}`; | |
| } |
|
Nice fix — the family-scoping approach is correct and I confirmed the 'other' family exact-scoping issue flagged by the automated review is already handled in your second commit. Tests are well-targeted (Claude/Gemini isolation + 'agy' alias + 'other' exact-scope). Looks ready to merge as-is. |
…der the cognitive-complexity cap Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
|
Thanks @irvandikky! Real fix for connection-wide quota exhaustion short-circuiting on antigravity/agy multi-model combos. I extracted three helpers from |
ad5e67d
into
cheaper-inference:release/v3.8.49
… (owner-approved) The /fix-prs validation-train sweep surfaced a cluster of otherwise-clean contributor feature PRs (#6973/#7683/#7662/#7672/#7633/#7767) whose per-PR +1/+2 own-growth collectively exceeded the tip's 3-unit complexity slack (2056 vs 2059). This was the 4th such block of the day (#7695/#7747/#7768 each needed helper extraction earlier). Owner approved raising both ceilings to give new-feature PRs breathing room: complexity to 2072 (combined-cluster 2068 + 4 headroom), cognitive to 900 (combined 896 + 4). Structural shrink stays debt (#3501); tighten via --update next cycle.
…heaper-inference#7695) * fix(quota): fix antigravity/agy multi-model quota skipping in combos * fix(quota): preserve exact-model scoping for unknown models in 'other' family * refactor(quota): extract helper to keep isQuotaExhaustedForRequest under the cognitive-complexity cap Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: irvandikky <irvandikky@users.noreply.github.com> Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
… (owner-approved) The /fix-prs validation-train sweep surfaced a cluster of otherwise-clean contributor feature PRs (cheaper-inference#6973/cheaper-inference#7683/cheaper-inference#7662/cheaper-inference#7672/cheaper-inference#7633/cheaper-inference#7767) whose per-PR +1/+2 own-growth collectively exceeded the tip's 3-unit complexity slack (2056 vs 2059). This was the 4th such block of the day (cheaper-inference#7695/cheaper-inference#7747/cheaper-inference#7768 each needed helper extraction earlier). Owner approved raising both ceilings to give new-feature PRs breathing room: complexity to 2072 (combined-cluster 2068 + 4 headroom), cognitive to 900 (combined 896 + 4). Structural shrink stays debt (cheaper-inference#3501); tighten via --update next cycle.
…heaper-inference#7695) * fix(quota): fix antigravity/agy multi-model quota skipping in combos * fix(quota): preserve exact-model scoping for unknown models in 'other' family * refactor(quota): extract helper to keep isQuotaExhaustedForRequest under the cognitive-complexity cap Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: irvandikky <irvandikky@users.noreply.github.com> Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
… (owner-approved) The /fix-prs validation-train sweep surfaced a cluster of otherwise-clean contributor feature PRs (cheaper-inference#6973/cheaper-inference#7683/cheaper-inference#7662/cheaper-inference#7672/cheaper-inference#7633/cheaper-inference#7767) whose per-PR +1/+2 own-growth collectively exceeded the tip's 3-unit complexity slack (2056 vs 2059). This was the 4th such block of the day (cheaper-inference#7695/cheaper-inference#7747/cheaper-inference#7768 each needed helper extraction earlier). Owner approved raising both ceilings to give new-feature PRs breathing room: complexity to 2072 (combined-cluster 2068 + 4 headroom), cognitive to 900 (combined 896 + 4). Structural shrink stays debt (cheaper-inference#3501); tighten via --update next cycle.
Fixes a bug in combos where an exhausted antigravity/agy model blocks all other models in the same provider connection due to connection-wide quota exhaustion short-circuiting in quotaCache.ts. Scopes rate limiters by model family in rateLimitManager.ts and updates antigravityQuotaFamily.ts for 'agy' spelling alias.