Repository navigation
fix(cron): auto-disable notice skips the failure-alert route when a recurring automation is disabled after 10 failures - #174309
Conversation
…r is the cause A time-based recurring automation is auto-disabled after 10 consecutive execution failures. The safety notice for that terminal failure was only queued as a system event for the owning agent and delivered through an immediate heartbeat turn, while the job's resolved failure route was told to stay quiet (`autoDisableNotificationOwnsFailure`). When the consecutive failures are the model provider itself (outage, revoked key, unsupported model), the heartbeat turn fails the same way, the admitted system event is consumed with it, and nobody is told that the automation stopped. A webhook or announce failure route that had been delivering the threshold alerts without a model goes silent exactly on the failure that matters. Treat the terminal recurring failure like a terminal one-shot failure: the route-backed alert carries the auto-disable notice (threshold and cooldown do not apply, the earlier alert's incident signature does not suppress it), and only a job without a failure route hands the notice to its owning agent as a system event. The notice text is shared, so the route and the agent read the same words and recovery command.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesSend recurring automation auto-disable notices directly through the configured failure-alert route after ten consecutive failures. Example: The owned automation proof-outage reaches its tenth failure while its provider returns HTTP 500.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main notification bug and resolves both prior findings; no remaining merge blocker was found. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherCron finalization records execution outcomes and disablement, then dispatches committed notification intents through the Gateway's existing webhook, channel, or owning-agent transport. flowchart TD
A[Execution failure] --> B[Cron outcome finalization]
B --> C[Persist disabled job and notification]
C --> D[Failure alert dispatcher]
D --> E[Configured webhook or channel]
C --> F[Owning agent fallback]
Technical reviewBest possible solution: Land the focused routing fix through the existing failure-alert owner while retaining the owning-agent fallback. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the route bypass, and the contributor supplies matching published-release gateway and webhook traces; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs notification selection at its existing owner, reuses the established transport, and preserves unrelated scheduling, one-shot repair, and opt-out behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b0ab44081ef4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +70, Tests +157, Docs 0. Total +227 across 6 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 16, 2026, 8:59 PM ET / October 17, 2026, 00:59 UTC (Revision 2). |
…te, not via repair The first commit let a recurring job's terminal failure into the owner repair branch whenever the job had an owner conversation, as a terminal one-shot does. A repair turn needs the same model that just failed ten times; if it settles with an error, the route stays silent, and the repair brief described the job as one-time. A recurring job disabled by this failure now always sends its notice through the resolved route, even while an earlier repair request is pending; the repair branch is unchanged for one-shots and non-terminal failures. The tenth-failure regression now expects the routed notice, and new cases cover the owner fallback (no route, alerts disabled) and owned jobs with webhook and announce routes.
bc8f244 to
68df5a3
Compare
|
Addressed both findings in 68df5a3: a recurring job disabled by its 10th failure now sends the notice directly through the resolved route and never through owner repair (also when a repair is pending), and the existing tenth-failure regression now expects the routed notice, with new cases for the no-route owner fallback and owned webhook/announce jobs. The PR body has an owned-job before/after run at that head (job created through @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…ecurring automation is disabled after 10 failures (openclaw#174309) * fix(cron): auto-disable notice is lost when the failing model provider is the cause A time-based recurring automation is auto-disabled after 10 consecutive execution failures. The safety notice for that terminal failure was only queued as a system event for the owning agent and delivered through an immediate heartbeat turn, while the job's resolved failure route was told to stay quiet (`autoDisableNotificationOwnsFailure`). When the consecutive failures are the model provider itself (outage, revoked key, unsupported model), the heartbeat turn fails the same way, the admitted system event is consumed with it, and nobody is told that the automation stopped. A webhook or announce failure route that had been delivering the threshold alerts without a model goes silent exactly on the failure that matters. Treat the terminal recurring failure like a terminal one-shot failure: the route-backed alert carries the auto-disable notice (threshold and cooldown do not apply, the earlier alert's incident signature does not suppress it), and only a job without a failure route hands the notice to its owning agent as a system event. The notice text is shared, so the route and the agent read the same words and recovery command. * fix(cron): send the recurring auto-disable notice straight to the route, not via repair The first commit let a recurring job's terminal failure into the owner repair branch whenever the job had an owner conversation, as a terminal one-shot does. A repair turn needs the same model that just failed ten times; if it settles with an error, the route stays silent, and the repair brief described the job as one-time. A recurring job disabled by this failure now always sends its notice through the resolved route, even while an earlier repair request is pending; the repair branch is unchanged for one-shots and non-terminal failures. The tenth-failure regression now expects the routed notice, and new cases cover the owner fallback (no route, alerts disabled) and owned jobs with webhook and announce routes.
Closes #174308
What Problem This Solves
Fixes: the auto-disable safety notice of a recurring automation never reaches its configured failure-alert destination (webhook or announce) when the job is disabled after 10 consecutive failures; it is only queued for a model turn, so while the failing model provider is the cause nobody is told.
User Impact
User impact: operators who route automation failure alerts to a webhook or a channel now receive the "was auto-disabled after 10 consecutive run failures" notice on that route, with the recovery command, even while the model provider is down. Jobs without a failure route keep today's in-app notice to the owning agent. No config change, no new option.
Why This Change Was Made
The recurring terminal failure set
autoDisableNotificationOwnsFailure, which madefinalizeCronFailureNotificationsskip the resolved failure route entirely; the notice only became a system event for the owning agent, i.e. a model turn. NowmaybeEmitFailureAlertsends the auto-disable notice directly through the resolved route when a recurring job is disabled by this failure: the threshold, cooldown, the streak's earlier incident signature, and a pending repair request do not hold it back, and it never takes the owner-repair branch (a repair turn needs the same model that just failed ten times). The in-app system event is queued only when no route alert was queued (no route,failureAlert: false, best-effort delivery). The repair branch itself is unchanged for one-shots and non-terminal failures. The notice text is built once (buildCronAutoDisableNotice) so the route and the agent read the same words.This is the option ClawSweeper recommended for its decision question ("Deliver the safety notice directly: use the configured route independently of model-backed repair, preserving the no-route owner fallback"). The first commit had admitted recurring terminal failures of owned jobs into the repair branch; the second commit removes that and updates the existing tenth-failure regression.
Evidence
Tested at
68df5a3e4e982f1114f9ee47805487909dd0a4b1(base7621a15a943). Same script, same inputs, two entry points: the published[email protected]package and this branch built withpnpm build, each asnode openclaw.mjs gateway runon a fresh state in anode:24-bookwormcontainer, with a local OpenAI-compatible stub answering HTTP 500 and a local webhook receiver as the failure-alert destination (cron.failureAlert.mode: "webhook"). The job is owned: created through the shippedcron.addRPC withowner: { agentId: "main", sessionKey: "agent:main:main" }, the shape the agent's automations tool stores when a conversation creates a job. The 10th failure is reached by persisting a 9-failure streak with an elapsed backoff (the natural path takes ~5.5 h). The stub also flags any request that carries the scheduler's repair brief.Before (published 2026.10.4, owned job)
After (this PR at
68df5a3e4e, owned job)Earlier run, unowned job created with
openclaw automations add(after-run at the first commitb01e4182; the second commit does not change the unowned path):Tests (Node runtime, as CI;
node:24-bookworm, pnpm 12.10.1, freshpnpm install --frozen-lockfileat68df5a3e4e):PR CI on
68df5a3e4e: all checks green, includingchecks-node-changed-*,check-lint*,check-test-types*,check-docs.Not covered: no live chat channel was exercised for an announce route (the routed notice uses the existing failure-alert transport; announce-route behavior is covered by the unit cases above).
Checks
pnpm test src/cron --maxWorkers=4(251 files) at68df5a3e4e; new/updated cases proven red on base production code.src/cron/service/{auto-disable,failure-alerts,timer-outcomes}.ts+87/-17; tests +161/-4; docs: one sentence indocs/automation/cron-jobs/delivery.md.Merge danger
Two-way door. Behavior changes only on the terminal (10th) failure of a time-based recurring job that has a resolved failure route: that route now carries the notice directly and the in-app system event is not queued for it. Jobs without a route,
failureAlert: false, best-effort delivery, one-shots, schedule-error auto-disable, startup replay, and all non-terminal alerts and repair requests are unchanged. No stored data, protocol, or config shape changes.