


















@@ -176,7 +176,9 @@ function expectPrimarySkippedForReason(
176176) {
177177expect(result.result).toBe("ok");
178178expect(run).toHaveBeenCalledTimes(1);
179-expect(run).toHaveBeenCalledWith("anthropic", "claude-haiku-3-5");
179+expect(run).toHaveBeenCalledWith("anthropic", "claude-haiku-3-5", {
180+isFinalFallbackAttempt: true,
181+});
180182expect(result.attempts[0]?.reason).toBe(reason);
181183}
182184@@ -192,6 +194,7 @@ function expectPrimaryProbeSuccess(
192194expect(run).toHaveBeenCalledTimes(1);
193195expect(run).toHaveBeenCalledWith("openai", "gpt-4.1-mini", {
194196allowTransientCooldownProbe: true,
197+isFinalFallbackAttempt: false,
195198});
196199}
197200@@ -251,9 +254,11 @@ async function expectProbeFailureFallsBack({
251254expect(run).toHaveBeenCalledTimes(2);
252255expect(run).toHaveBeenNthCalledWith(1, "openai", "gpt-4.1-mini", {
253256allowTransientCooldownProbe: true,
257+isFinalFallbackAttempt: false,
254258});
255259expect(run).toHaveBeenNthCalledWith(2, "anthropic", "claude-haiku-3-5", {
256260allowTransientCooldownProbe: true,
261+isFinalFallbackAttempt: false,
257262});
258263}
259264@@ -529,8 +534,11 @@ describe("runWithModelFallback – probe logic", () => {
529534expect(fallbackResult.result).toBe("fallback-ok");
530535expect(fallbackRun).toHaveBeenNthCalledWith(1, "openai", "gpt-4.1-mini", {
531536allowTransientCooldownProbe: true,
537+isFinalFallbackAttempt: false,
538+});
539+expect(fallbackRun).toHaveBeenNthCalledWith(2, "anthropic", "claude-haiku-3-5", {
540+isFinalFallbackAttempt: false,
532541});
533-expect(fallbackRun).toHaveBeenNthCalledWith(2, "anthropic", "claude-haiku-3-5");
534542535543const decisionPayloads = logCapture.records
536544.filter((record) => record.message === "model fallback decision")
@@ -690,9 +698,14 @@ describe("runWithModelFallback – probe logic", () => {
690698691699expect(run).toHaveBeenNthCalledWith(1, "google", "gemini-3-flash-preview", {
692700allowTransientCooldownProbe: true,
701+isFinalFallbackAttempt: false,
702+});
703+expect(run).toHaveBeenNthCalledWith(2, "anthropic", "claude-haiku-3-5", {
704+isFinalFallbackAttempt: false,
705+});
706+expect(run).toHaveBeenNthCalledWith(3, "deepseek", "deepseek-chat", {
707+isFinalFallbackAttempt: true,
693708});
694-expect(run).toHaveBeenNthCalledWith(2, "anthropic", "claude-haiku-3-5");
695-expect(run).toHaveBeenNthCalledWith(3, "deepseek", "deepseek-chat");
696709});
697710698711it("prunes stale probe throttle entries before checking eligibility", () => {
@@ -774,6 +787,7 @@ describe("runWithModelFallback – probe logic", () => {
774787expect(run).toHaveBeenCalledTimes(1);
775788expect(run).toHaveBeenCalledWith("openai", "gpt-4.1-mini", {
776789allowTransientCooldownProbe: true,
790+isFinalFallbackAttempt: true,
777791});
778792});
779793此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。