mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
* fix(agents): classify provider-native failover errors Co-authored-by: Altay <altay@hey.com> * fix(agents): scope provider failover codes * docs(changelog): credit provider failover fix * style(anthropic): format failover classifier * docs(changelog): defer release-owned entry --------- Co-authored-by: Pick-cat <266665499+Pick-cat@users.noreply.github.com> Co-authored-by: Altay <altay@hey.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { GOOGLE_GEMINI_PROVIDER_HOOKS } from "./provider-hooks.js";
|
|
|
|
describe("GOOGLE_GEMINI_PROVIDER_HOOKS.classifyFailoverReason", () => {
|
|
it.each([
|
|
{ provider: "google", code: "UNAVAILABLE", expected: "overloaded" },
|
|
{ provider: "google-vertex", code: "DEADLINE_EXCEEDED", expected: "timeout" },
|
|
{ provider: "google-antigravity", code: "INTERNAL", expected: "server_error" },
|
|
{ provider: "google-gemini-cli", code: "UNAVAILABLE", expected: "overloaded" },
|
|
] as const)("classifies $provider $code as $expected", ({ provider, code, expected }) => {
|
|
expect(
|
|
GOOGLE_GEMINI_PROVIDER_HOOKS.classifyFailoverReason({
|
|
provider,
|
|
errorMessage: "",
|
|
code,
|
|
}),
|
|
).toBe(expected);
|
|
});
|
|
|
|
it("leaves unknown codes for generic classification", () => {
|
|
expect(
|
|
GOOGLE_GEMINI_PROVIDER_HOOKS.classifyFailoverReason({
|
|
provider: "google-vertex",
|
|
errorMessage: "",
|
|
code: "INSUFFICIENT_QUOTA",
|
|
}),
|
|
).toBeUndefined();
|
|
});
|
|
});
|