
























@@ -159,6 +159,67 @@ describe("maybeRepairLegacyCronStore", () => {
159159);
160160});
161161162+it("repairs invalid persisted cron payload model sentinels", async () => {
163+const storePath = await makeTempStorePath();
164+await writeCronStore(storePath, [
165+{
166+id: "bad-model-default",
167+name: "Bad model default",
168+enabled: true,
169+createdAtMs: Date.parse("2026-02-01T00:00:00.000Z"),
170+updatedAtMs: Date.parse("2026-02-02T00:00:00.000Z"),
171+schedule: { kind: "every", everyMs: 60_000, anchorMs: 1 },
172+sessionTarget: "isolated",
173+wakeMode: "now",
174+payload: {
175+kind: "agentTurn",
176+message: "Status",
177+model: "default",
178+},
179+delivery: { mode: "announce" },
180+state: {},
181+},
182+{
183+id: "bad-model-null",
184+name: "Bad model null",
185+enabled: true,
186+createdAtMs: Date.parse("2026-02-01T00:00:00.000Z"),
187+updatedAtMs: Date.parse("2026-02-02T00:00:00.000Z"),
188+schedule: { kind: "every", everyMs: 60_000, anchorMs: 1 },
189+sessionTarget: "isolated",
190+wakeMode: "now",
191+payload: {
192+kind: "agentTurn",
193+message: "Status",
194+model: "null",
195+},
196+delivery: { mode: "announce" },
197+state: {},
198+},
199+]);
200+201+await maybeRepairLegacyCronStore({
202+cfg: createCronConfig(storePath),
203+options: {},
204+prompter: makePrompter(true),
205+});
206+207+const persisted = JSON.parse(await fs.readFile(storePath, "utf-8")) as {
208+jobs: Array<Record<string, unknown>>;
209+};
210+for (const job of persisted.jobs) {
211+expect((job.payload as Record<string, unknown>).model).toBeUndefined();
212+}
213+expect(noteMock).toHaveBeenCalledWith(
214+expect.stringContaining("2 jobs store an invalid cron payload model inheritance sentinel"),
215+"Cron",
216+);
217+expect(noteMock).toHaveBeenCalledWith(
218+expect.stringContaining("Cron store normalized"),
219+"Doctor changes",
220+);
221+});
222+162223it("warns instead of replacing announce delivery for notify fallback jobs", async () => {
163224const storePath = await makeTempStorePath();
164225await fs.mkdir(path.dirname(storePath), { recursive: true });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。