


























@@ -160,10 +160,8 @@ describe("runCronIsolatedAgentTurn — LiveSessionModelSwitchError retry (#57206
160160expect(result.status).toBe("error");
161161expect(String(result.error)).toContain("transient network error");
162162expect(updateSessionStoreMock).toHaveBeenCalled();
163-expect(cronSession.sessionEntry).toMatchObject({
164-model: "claude-sonnet-4-6",
165-modelProvider: "anthropic",
166-});
163+expect(cronSession.sessionEntry.model).toBe("claude-sonnet-4-6");
164+expect(cronSession.sessionEntry.modelProvider).toBe("anthropic");
167165});
168166169167it("retries with switched auth profile state from LiveSessionModelSwitchError", async () => {
@@ -209,16 +207,13 @@ describe("runCronIsolatedAgentTurn — LiveSessionModelSwitchError retry (#57206
209207210208expect(result.status).toBe("ok");
211209expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(2);
212-expect(runEmbeddedPiAgentMock.mock.calls[1]?.[0]).toMatchObject({
213-provider: "anthropic",
214-model: "claude-sonnet-4-6",
215-authProfileId: "profile-b",
216-authProfileIdSource: "user",
217-});
218-expect(cronSession.sessionEntry).toMatchObject({
219-authProfileOverride: "profile-b",
220-authProfileOverrideSource: "user",
221-});
210+const retryParams = runEmbeddedPiAgentMock.mock.calls[1]?.[0];
211+expect(retryParams?.provider).toBe("anthropic");
212+expect(retryParams?.model).toBe("claude-sonnet-4-6");
213+expect(retryParams?.authProfileId).toBe("profile-b");
214+expect(retryParams?.authProfileIdSource).toBe("user");
215+expect(cronSession.sessionEntry.authProfileOverride).toBe("profile-b");
216+expect(cronSession.sessionEntry.authProfileOverrideSource).toBe("user");
222217});
223218224219it("returns error (not infinite loop) when LiveSessionModelSwitchError is thrown repeatedly", async () => {
@@ -266,7 +261,9 @@ describe("runCronIsolatedAgentTurn — LiveSessionModelSwitchError retry (#57206
266261expect(result.status).toBe("error");
267262// Circuit breaker: max 2 retries → 3 total attempts (initial + 2 retries)
268263expect(callCount).toBe(3);
269-expect(logWarnMock).toHaveBeenCalledWith(expect.stringContaining("retry limit reached"));
264+expect(logWarnMock).toHaveBeenCalledWith(
265+"[cron:cron-model-switch-job] LiveSessionModelSwitchError retry limit reached (2); aborting",
266+);
270267});
271268272269it("does not retry when the thrown error is not a LiveSessionModelSwitchError", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。