Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ export function classifyError(status: number, type: string, message: string): Oc
text.includes("quota exhausted") ||
text.includes("account quota exceeded") ||
text.includes("monthly quota exceeded") ||
text.includes("daily quota exceeded")
text.includes("daily quota exceeded") ||
// Anthropic answers a spent plan with HTTP 400, not 429; without this it classifies as
// invalid_request_error, a hard stop, and a combo never hops to its next tier.
text.includes("out of extra usage")
) {
return { message, type: "insufficient_quota", code: "insufficient_quota" };
}
Expand Down
1 change: 1 addition & 0 deletions tests/codex-integration/combos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ describe("combo failure policy and advancement", () => {
expect(comboFailureDecision(status, "provider failure")).toBe("hop");
}
expect(comboFailureDecision(400, "context_length_exceeded")).toBe("hop");
expect(comboFailureDecision(400, "You're out of extra usage")).toBe("hop");
expect(comboFailureDecision(403, '{"code":"origin_rejected"}')).toBe("stop");
expect(comboFailureDecision(413, "request too large")).toBe("stop");
expect(comboFailureDecision(409, "conflict")).toBe("stop");
Expand Down
4 changes: 4 additions & 0 deletions tests/server/error-fidelity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ describe("error fidelity", () => {
type: "invalid_request_error",
code: "context_length_exceeded",
});
expect(classifyError(400, "invalid_request_error", "You're out of extra usage")).toMatchObject({
type: "insufficient_quota",
code: "insufficient_quota",
});
expect(classifyError(429, "upstream_error", "Rate limit reached for model")).toMatchObject({
type: "rate_limit_error",
code: "rate_limit_exceeded",
Expand Down
Loading