fix: add 'usage limit' to rate limit detection patterns

OpenAI/ChatGPT returns "You have hit your ChatGPT usage limit (plus plan)"
when users exceed their plan quota. This error wasn't being recognized as a
rate limit, so fallback to alternative models wasn't triggering.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jonathan Wilkins
2026-01-10 13:49:23 -08:00
committed by Peter Steinberger
parent 08cc8f2281
commit 0afa370869
2 changed files with 9 additions and 0 deletions

View File

@@ -272,6 +272,14 @@ describe("classifyFailoverReason", () => {
);
expect(classifyFailoverReason("bad request")).toBeNull();
});
it("classifies OpenAI usage limit errors as rate_limit", () => {
expect(
classifyFailoverReason(
"You have hit your ChatGPT usage limit (plus plan)",
),
).toBe("rate_limit");
});
});
describe("isCloudCodeAssistFormatError", () => {

View File

@@ -343,6 +343,7 @@ const ERROR_PATTERNS = {
"resource has been exhausted",
"quota exceeded",
"resource_exhausted",
"usage limit",
],
timeout: [
"timeout",