mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-20 09:35:30 +00:00
fix: narrow rate-limit pattern to avoid billing misclassification
This commit is contained in:
@@ -535,6 +535,8 @@ describe("classifyFailoverReason", () => {
|
||||
).toBe("rate_limit");
|
||||
expect(classifyFailoverReason("all credentials for model x are cooling down")).toBeNull();
|
||||
expect(classifyFailoverReason("invalid request format")).toBe("format");
|
||||
expect(classifyFailoverReason("credit balance too low")).toBe("billing");
|
||||
// Billing with "limit exhausted" must stay billing, not rate_limit (avoids key-disable regression)
|
||||
expect(
|
||||
classifyFailoverReason("HTTP 402 payment required. Your limit exhausted for this plan."),
|
||||
).toBe("billing");
|
||||
@@ -593,6 +595,7 @@ describe("classifyFailoverReason", () => {
|
||||
"LLM error 1310: Weekly/Monthly Limit Exhausted. Your limit will reset at 2026-03-06 22:19:54 (request_id: 20260303141547610b7f574d1b44cb)",
|
||||
),
|
||||
).toBe("rate_limit");
|
||||
// Independent coverage for /weekly\/monthly limit/i (no generic "limit exhausted")
|
||||
expect(classifyFailoverReason("LLM error: weekly/monthly limit reached")).toBe("rate_limit");
|
||||
});
|
||||
it("classifies permanent auth errors as auth_permanent", () => {
|
||||
|
||||
Reference in New Issue
Block a user