fix: handle HTTP 529 (Anthropic overloaded) in failover error classification
Classify Anthropic's 529 status code as "rate_limit" so model fallback triggers reliably without depending on fragile message-based detection. Closes #28502
This commit is contained in:
committed by
Peter Steinberger
parent
84d9b64326
commit
1ef9a2a8ea
@@ -18,6 +18,8 @@ describe("failover-error", () => {
|
||||
expect(resolveFailoverReasonFromError({ status: 502 })).toBe("timeout");
|
||||
expect(resolveFailoverReasonFromError({ status: 503 })).toBe("timeout");
|
||||
expect(resolveFailoverReasonFromError({ status: 504 })).toBe("timeout");
|
||||
// Anthropic 529 (overloaded) should trigger failover as rate_limit.
|
||||
expect(resolveFailoverReasonFromError({ status: 529 })).toBe("rate_limit");
|
||||
});
|
||||
|
||||
it("infers format errors from error messages", () => {
|
||||
|
||||
@@ -178,6 +178,9 @@ export function resolveFailoverReasonFromError(err: unknown): FailoverReason | n
|
||||
if (status === 502 || status === 503 || status === 504) {
|
||||
return "timeout";
|
||||
}
|
||||
if (status === 529) {
|
||||
return "rate_limit";
|
||||
}
|
||||
if (status === 400) {
|
||||
return "format";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user