diff --git a/apps/fabro-web/app/routes/run-detail/failure.test.ts b/apps/fabro-web/app/routes/run-detail/failure.test.ts index b24eefd87..f489e7b76 100644 --- a/apps/fabro-web/app/routes/run-detail/failure.test.ts +++ b/apps/fabro-web/app/routes/run-detail/failure.test.ts @@ -50,6 +50,15 @@ describe("buildRunFailureView", () => { expect(failure?.nextStep).toBe("Add credit or raise the spend limit with Anthropic, then choose Retry from Actions."); }); + test("reads a spent quota as billing, though the provider answered 429", () => { + const failure = view( + failedRun({ + message: "model request failed (quota_exceeded): provider gemini Quota exceeded for metric generate_content_requests [provider gemini, status 429, code RESOURCE_EXHAUSTED]", + }), + ); + expect(failure?.headline).toBe("gemini declined the request for billing reasons"); + }); + test("names an unknown provider by its id", () => { const failure = view( failedRun({ message: "model request failed (authentication): provider acme bad key [provider acme, status 401, code unauthorized]" }), diff --git a/apps/fabro-web/app/routes/run-detail/failure.ts b/apps/fabro-web/app/routes/run-detail/failure.ts index 7e3618f48..35a76d081 100644 --- a/apps/fabro-web/app/routes/run-detail/failure.ts +++ b/apps/fabro-web/app/routes/run-detail/failure.ts @@ -141,7 +141,11 @@ function parseModelRequest(message: string): ModelRequest | null { } function requestAdvice({ kind, status, code }: ModelRequest, message: string, who: string): Advice { - if (/credit balance|insufficient[_ ]quota|payment required|billing|spend limit/i.test(message) || status === 402) { + if ( + kind === "quota_exceeded" || + status === 402 || + /credit balance|insufficient[_ ]quota|payment required|billing|spend limit/i.test(message) + ) { return { headline: `${who} declined the request for billing reasons`, nextStep: `Add credit or raise the spend limit with ${who}, then ${RETRY}.`,