fix(open-sse): add 'has been exhausted' to CREDITS_EXHAUSTED_SIGNALS (fixes #8631)

Adds 'has been exhausted' string to CREDITS_EXHAUSTED_SIGNALS array so free-tier depletion errors like 'The free tier of the model has been exhausted.' are classified as QUOTA_EXHAUSTED rather than falling through to generic error handling.
This commit is contained in:
Dingding-leo
2026-07-27 03:07:54 +09:30
parent 1f04333a19
commit f89f92f45a
2 changed files with 7 additions and 5 deletions

View File

@@ -183,6 +183,7 @@ export const CREDITS_EXHAUSTED_SIGNALS = [
"out of credits",
"payment required",
"free tier of the model has been exhausted",
"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.

View File

@@ -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: 429 without billing signal => RATE_LIMITED", () => {
@@ -132,10 +137,6 @@ test("classifyProviderError: 404 => MODEL_NOT_FOUND", () => {
});
test("classifyProviderError: 404 with provider => MODEL_NOT_FOUND", () => {
const result = classifyProviderError(
404,
{ error: { message: "Not Found" } },
"v0-vercel"
);
const result = classifyProviderError(404, { error: { message: "Not Found" } }, "v0-vercel");
assert.equal(result, PROVIDER_ERROR_TYPES.MODEL_NOT_FOUND);
});