From 074fabc5406f335f3c667d0c2d2a6af65296a04e Mon Sep 17 00:00:00 2001 From: Feelw00 Date: Wed, 8 Apr 2026 20:21:35 +0900 Subject: [PATCH] fix(cron): backfill updatedAtMs in fresh-clone path Jobs loaded from a git-cloned jobs.json (no state file, no inline state) had updatedAtMs undefined, violating the type contract and breaking updatedAtMs sort. Backfill from createdAtMs. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/cron/store.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cron/store.ts b/src/cron/store.ts index 369fd8c5c70..57554af8f9f 100644 --- a/src/cron/store.ts +++ b/src/cron/store.ts @@ -143,6 +143,9 @@ export async function loadCronStore(storePath: string): Promise { // No state file, no inline state: fresh clone or first run. for (const job of store.jobs) { job.state = (job.state && typeof job.state === "object" ? job.state : {}) as never; + if (typeof job.updatedAtMs !== "number") { + job.updatedAtMs = typeof job.createdAtMs === "number" ? job.createdAtMs : Date.now(); + } } } // else: migration mode — no state file but jobs.json has inline state. Use as-is.