


























@@ -663,7 +663,7 @@ describe("runWithModelFallback", () => {
663663expect(run).toHaveBeenCalledTimes(1);
664664});
665665666-it("treats LiveSessionModelSwitchError as failover on last candidate (#58466)", async () => {
666+it("treats LiveSessionModelSwitchError as failover on last candidate (#58496 family)", async () => {
667667const cfg = makeCfg();
668668const switchError = new LiveSessionModelSwitchError({
669669provider: "anthropic",
@@ -689,7 +689,7 @@ describe("runWithModelFallback", () => {
689689expect(run).toHaveBeenCalledTimes(1);
690690});
691691692-it("continues fallback chain past LiveSessionModelSwitchError to next candidate (#58466)", async () => {
692+it("continues fallback chain past LiveSessionModelSwitchError to next candidate (#58496 family)", async () => {
693693const cfg = makeCfg();
694694const switchError = new LiveSessionModelSwitchError({
695695provider: "anthropic",
@@ -756,6 +756,30 @@ describe("runWithModelFallback", () => {
756756]);
757757});
758758759+it("does not redirect stale live-session switch errors back to the current candidate (#58496 family)", async () => {
760+const cfg = makeCfg();
761+const switchError = new LiveSessionModelSwitchError({
762+provider: "openai",
763+model: "gpt-4.1-mini",
764+});
765+const run = vi.fn().mockRejectedValueOnce(switchError).mockResolvedValueOnce("ok");
766+767+const result = await runWithModelFallback({
768+ cfg,
769+provider: "openai",
770+model: "gpt-4.1-mini",
771+ run,
772+});
773+774+expect(result.result).toBe("ok");
775+expect(result.provider).toBe("anthropic");
776+expect(result.model).toBe("claude-haiku-3-5");
777+expect(run.mock.calls).toEqual([
778+["openai", "gpt-4.1-mini"],
779+["anthropic", "claude-haiku-3-5"],
780+]);
781+});
782+759783it("falls back on auth errors", async () => {
760784await expectFallsBackToHaiku({
761785provider: "openai",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。