From 5b49cc412976f792cf376b29390ec70b5ebf52c6 Mon Sep 17 00:00:00 2001 From: StingNing Date: Sun, 1 Mar 2026 20:54:02 +0800 Subject: [PATCH] fix(cron): notify user when cron job is auto-disabled after repeated errors (openclaw#29098) thanks @ningding97 Verified: - pnpm install --frozen-lockfile - pnpm check - pnpm test -- --run src/cron/service.runs-one-shot-main-job-disables-it.test.ts Co-authored-by: ningding97 <17723822+ningding97@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> --- CHANGELOG.md | 2 ++ src/cron/service/jobs.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80a40fb1362..1d37d36e89c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,8 @@ Docs: https://docs.openclaw.ai ### Fixes +- Cron/Schedule errors: notify users when a job is auto-disabled after repeated schedule computation failures. (#29098) Thanks . +- Cron/Schedule errors: notify users when a job is auto-disabled after repeated schedule computation failures. (#29098) Thanks . - Onboarding/Custom providers: raise default custom-provider model context window to the runtime hard minimum (16k) and auto-heal existing custom model entries below that threshold during reconfiguration, preventing immediate `Model context window too small (4096 tokens)` failures. (#21653) Thanks @r4jiv007. - Web UI/Assistant text: strip internal `...` scaffolding from rendered assistant messages (while preserving code-fence literals), preventing memory-context leakage in chat output for models that echo internal blocks. (#29851) Thanks @Valkster70. - Dashboard/Sessions: allow authenticated Control UI clients to delete and patch sessions while still blocking regular webchat clients from session mutation RPCs, fixing Dashboard session delete failures. (#21264) Thanks @jskoiz. diff --git a/src/cron/service/jobs.ts b/src/cron/service/jobs.ts index d8c67683d03..b98a28aed66 100644 --- a/src/cron/service/jobs.ts +++ b/src/cron/service/jobs.ts @@ -208,6 +208,19 @@ function recordScheduleComputeError(params: { { jobId: job.id, name: job.name, errorCount, err: errText }, "cron: auto-disabled job after repeated schedule errors", ); + + // Notify the user so the auto-disable is not silent (#28861). + const notifyText = `⚠️ Cron job "${job.name}" has been auto-disabled after ${errorCount} consecutive schedule errors. Last error: ${errText}`; + state.deps.enqueueSystemEvent(notifyText, { + agentId: job.agentId, + sessionKey: job.sessionKey, + contextKey: `cron:${job.id}:auto-disabled`, + }); + state.deps.requestHeartbeatNow({ + reason: `cron:${job.id}:auto-disabled`, + agentId: job.agentId, + sessionKey: job.sessionKey, + }); } else { state.deps.log.warn( { jobId: job.id, name: job.name, errorCount, err: errText },