mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-07 07:42:13 +03:00
fix: treat zero-reset Antigravity 429s as transient (#8626)
Validated in local merge-train T7 (ungrouped batch 2)
This commit is contained in:
@@ -61,6 +61,14 @@ const FULL_QUOTA_COOLDOWN_MS = 24 * 60 * 60 * 1000; // 24 hours
|
||||
export function classify429(errorMessage: string): Category {
|
||||
const lower = (errorMessage || "").toLowerCase();
|
||||
|
||||
// Cloud Code may report an exhausted-capacity message with a zero reset
|
||||
// window for a burst/RPM throttle. The explicit zero reset is stronger
|
||||
// evidence than the generic wording, so retry briefly instead of applying
|
||||
// the durable quota cooldown.
|
||||
if (/\breset\s+(?:after|in)\s+0s\b/.test(lower)) {
|
||||
return "rate_limited";
|
||||
}
|
||||
|
||||
// Check for quota exhaustion first (most specific)
|
||||
for (const kw of QUOTA_EXHAUSTED_KEYWORDS) {
|
||||
if (lower.includes(kw)) return "quota_exhausted";
|
||||
|
||||
@@ -70,6 +70,16 @@ test("classify429: standard Gemini rate limit 'resource has been exhausted' -> r
|
||||
);
|
||||
});
|
||||
|
||||
test("classify429: exhausted capacity with reset after 0s is rate_limited", () => {
|
||||
const message = "You have exhausted your capacity on this model. Your quota will reset after 0s.";
|
||||
const category = classify429(message);
|
||||
assert.equal(category, "rate_limited");
|
||||
|
||||
const decision = decide429(category, 2_000);
|
||||
assert.equal(decision.kind, "soft_retry");
|
||||
assert.equal(decision.retryAfterMs, 2_000);
|
||||
});
|
||||
|
||||
// ── DB persistence (the missing wire — Bug #2) ───────────────────────────────
|
||||
|
||||
test("markConnectionQuotaExhausted persists 24h cooldown; isConnectionRateLimited returns true", async () => {
|
||||
|
||||
Reference in New Issue
Block a user