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 @@ -431,7 +431,10 @@ export function classifyError(status: number, type: string, message: string): Oc
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")
text.includes("out of extra usage") ||
// Same spent-plan state, newer wording: a third-party client is refused with HTTP 400 because
// its usage now bills against extra usage, not the plan limits.
text.includes("third-party apps now draw from your extra usage")
) {
return { message, type: "insufficient_quota", code: "insufficient_quota" };
}
Expand Down
3 changes: 3 additions & 0 deletions tests/codex-integration/combos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,9 @@ describe("combo failure policy and advancement", () => {
}
expect(comboFailureDecision(400, "context_length_exceeded")).toBe("hop");
expect(comboFailureDecision(400, "You're out of extra usage")).toBe("hop");
expect(
comboFailureDecision(400, "Third-party apps now draw from your extra usage, not your plan limits"),
).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
6 changes: 6 additions & 0 deletions tests/server/error-fidelity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ describe("error fidelity", () => {
type: "insufficient_quota",
code: "insufficient_quota",
});
expect(
classifyError(400, "invalid_request_error", "Third-party apps now draw from your extra usage, not your plan limits"),
).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