From c4527f97bd833784d4b423a3658d24d81d55ec00 Mon Sep 17 00:00:00 2001 From: Austin Liu <193228693+Dingding-leo@users.noreply.github.com> Date: Thu, 6 Aug 2026 18:36:19 +0930 Subject: [PATCH] [v3.8.50] fix(open-sse): add 'has been exhausted' to CREDITS_EXHAUSTED_SIGNALS (fixes #8631) (#8704) Validated in local merge-train T7 (ungrouped batch 2) --- open-sse/services/accountFallback.ts | 6 ++++++ tests/unit/error-classifier.test.ts | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/open-sse/services/accountFallback.ts b/open-sse/services/accountFallback.ts index a09b78924d..be048f69c9 100644 --- a/open-sse/services/accountFallback.ts +++ b/open-sse/services/accountFallback.ts @@ -184,6 +184,12 @@ export const CREDITS_EXHAUSTED_SIGNALS = [ "out of credits", "payment required", "free tier of the model has been exhausted", + // #8631: narrower than a bare "has been exhausted" — that generic phrase also + // appears in Gemini's transient RPM/TPM 429 body ("Resource has been exhausted + // (e.g. check quota)."), which must stay RATE_LIMIT_EXCEEDED, not terminal. + // Anchoring on "tier" keeps free-tier depletion wording matched while excluding + // Gemini's "resource has been exhausted" rate-limit phrasing. + "tier has been exhausted", // #5239: providers (e.g. DeepSeek/GLM-style) return "Insufficient account balance" // on a depleted key. 402 is already terminalized by status, but catch non-402 // out-of-credit bodies here too. diff --git a/tests/unit/error-classifier.test.ts b/tests/unit/error-classifier.test.ts index 4a13235779..afb6cd58c1 100644 --- a/tests/unit/error-classifier.test.ts +++ b/tests/unit/error-classifier.test.ts @@ -27,6 +27,11 @@ test("classifyProviderError: 400 + billing signal => QUOTA_EXHAUSTED", () => { error: { message: "insufficient_quota: exceeded your current quota" }, }); assert.equal(result, PROVIDER_ERROR_TYPES.QUOTA_EXHAUSTED); + + const resultExhausted = classifyProviderError(400, { + error: { message: "The free tier of the model has been exhausted." }, + }); + assert.equal(resultExhausted, PROVIDER_ERROR_TYPES.QUOTA_EXHAUSTED); }); test("classifyProviderError: Kimi billing-cycle 403 => QUOTA_EXHAUSTED", () => {