fix(failover): treat stop reason error as timeout

This commit is contained in:
Peter Steinberger
2026-03-03 01:05:06 +00:00
parent a2fdc3415f
commit 1bd20dbdb6
5 changed files with 19 additions and 4 deletions

View File

@@ -751,6 +751,17 @@ describe("runWithModelFallback", () => {
});
});
it("falls back on abort errors with reason: error", async () => {
await expectFallsBackToHaiku({
provider: "openai",
model: "gpt-4.1-mini",
firstError: Object.assign(new Error("aborted"), {
name: "AbortError",
reason: "reason: error",
}),
});
});
it("falls back when message says aborted but error is a timeout", async () => {
await expectFallsBackToHaiku({
provider: "openai",