fix(cron): prevent list/status from silently skipping recurring jobs (openclaw#16201) thanks @zerone0x

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: zerone0x <39543393+zerone0x@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
zerone0x
2026-02-15 03:33:29 +08:00
committed by GitHub
parent 64b7f3455e
commit c60844931b
3 changed files with 237 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import {
isJobDue,
nextWakeAtMs,
recomputeNextRuns,
recomputeNextRunsForMaintenance,
} from "./jobs.js";
import { locked } from "./locked.js";
import { ensureLoaded, persist, warnIfDisabled } from "./store.js";
@@ -53,7 +54,9 @@ export async function status(state: CronServiceState) {
return await locked(state, async () => {
await ensureLoaded(state, { skipRecompute: true });
if (state.store) {
const changed = recomputeNextRuns(state);
// Use the maintenance-only version so that read-only operations never
// advance a past-due nextRunAtMs without executing the job (#16156).
const changed = recomputeNextRunsForMaintenance(state);
if (changed) {
await persist(state);
}
@@ -71,7 +74,9 @@ export async function list(state: CronServiceState, opts?: { includeDisabled?: b
return await locked(state, async () => {
await ensureLoaded(state, { skipRecompute: true });
if (state.store) {
const changed = recomputeNextRuns(state);
// Use the maintenance-only version so that read-only operations never
// advance a past-due nextRunAtMs without executing the job (#16156).
const changed = recomputeNextRunsForMaintenance(state);
if (changed) {
await persist(state);
}