mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 20:33:43 +00:00
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>
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user