diff --git a/src/agents/pi-embedded-helpers.test.ts b/src/agents/pi-embedded-helpers.test.ts index 0a4d5069f..4d981663b 100644 --- a/src/agents/pi-embedded-helpers.test.ts +++ b/src/agents/pi-embedded-helpers.test.ts @@ -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", () => { diff --git a/src/agents/pi-embedded-helpers.ts b/src/agents/pi-embedded-helpers.ts index 579e3f18e..d1e28b7fe 100644 --- a/src/agents/pi-embedded-helpers.ts +++ b/src/agents/pi-embedded-helpers.ts @@ -343,6 +343,7 @@ const ERROR_PATTERNS = { "resource has been exhausted", "quota exceeded", "resource_exhausted", + "usage limit", ], timeout: [ "timeout",