Repository navigation
fix(cron): failed one-shot jobs are disabled without any failure alert - #167908
erlightbourn-source wants to merge 2 commits into
Conversation
…g it silently A one-shot (schedule.kind=at) that fails permanently, or exhausts its transient retries, is disabled and never runs again, so the failure-alert streak (default after=2) can never be reached and the disable was silent. Mark that outcome as terminal and let maybeEmitFailureAlert bypass the after threshold for it. Routes, cooldown, bestEffort and failureAlert:false are unchanged; retryable first failures keep the threshold.
|
🦞👀 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: blocked before merge. What this changesThe automation scheduler sends a configured failure alert when a timed one-shot job permanently fails or exhausts its retries, even below its failure-count threshold. Example: A timed one-shot command exits with code 2 under the default alert policy.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision Merge readiness⛔ Blocked before merge - 2 items remain This PR addresses a source-confirmed silent failure that remains on current main. The implementation is focused and the previous proof gap is resolved; overriding explicitly configured alert thresholds still needs an area-owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherOpenClaw’s automation scheduler runs scheduled jobs and records their outcomes. Its failure-alert owner applies notification policy and passes committed alerts to the Gateway for delivery. flowchart TD
A[Timed one-shot job] --> B[Run outcome]
B --> C{Retry remains?}
C -->|Yes| D[Schedule retry]
C -->|No| E[Disable job]
E --> F[Apply alert policy]
F --> G[Persist outcome and alert intent]
G --> H[Gateway delivers notification]
Technical reviewBest possible solution: Keep the repair in the existing outcome and alert owners, with an explicit owner-approved terminal threshold contract. Do we have a high-confidence way to reproduce the issue? Yes: current main disables terminal timed one-shots before their error streak can reach the default threshold of 2. Contributor base/head Gateway output independently demonstrates the silent base result and delivered head alerts. Is this the best way to solve the issue? Yes structurally: carrying the terminal disposition into the existing alert owner is a narrow repair that preserves persistence and transport ownership. Bypassing explicit thresholds remains a product-contract choice. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8eb960d42a70. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +9, Tests +135, Docs 0. Total +144 across 5 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 HistoryReviewed October 9, 2026, 3:26 PM ET / 19:26 UTC (Revision 3). |
… document the terminal exception Drop the recurring streak-reset replay (unchanged by this fix, covered at service level).
|
On the decision question (bypassing an explicit I'd keep the terminal exception for explicit values too, not just the inherited default. A terminal timed one-shot is disabled and never runs again, so its streak stops at whatever count it had. For a permanent error that's 1. For exhausted transient retries it's 4, since Everything else is unchanged: routing, Pushed in 1f428ad:
Base-fail/head-pass for the changed tests: on base If maintainers would rather narrow it to the inherited default only, it's a one-line change and I'm happy to make it. |
|
Real Gateway proof is now in the PR body under "Real Gateway run (base vs head, same state dir)". On base, a first permanent failure and exhausted retries ( @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @erlightbourn-source, good catch and nice proof. The threshold half of this landed in #169102 (terminal one-shot failures now notify on that failure, with owned jobs getting a repair turn and an alert fallback), and your I'll close this PR once #169314 lands. |
Classify operator cancellation and Gateway retirement at their producers so terminal one-shots do not request a repair, alert, safety notice, or retry. This fixes the cancellation regression introduced by #169102 while retaining watchdog timeout retries and recurring-job policy. Record terminal timed and watcher-fired on-exit failures through the existing auto-disable owner, making them visible in doctor. Preserve watcher occurrence provenance across worker finalization and keep ordinary paused/armed force-runs out of that terminal disposition. Use the existing owner repair with alert fallback, a resolved failure alert, or the generic safety notice; retain shared cooldown and incident suppression without sending an extra notice. The auto-disable owner's safety notice remains active for failureAlert:false and inherited bestEffort suppression; terminal test expectations follow that existing policy. Document the terminal behavior and doctor visibility. Release-note context: terminal one-shot failures no longer disappear silently, while operator cancels and restart retirements remain quiet. This maintainer re-expression supersedes #131590 and #167908 on current main. Co-authored-by: lonexreb <[email protected]> Co-authored-by: erlightbourn-source <[email protected]>
Classify operator cancellation and Gateway retirement at their producers so terminal one-shots do not request a repair, alert, safety notice, or retry. This fixes the cancellation regression introduced by #169102 while retaining watchdog timeout retries and recurring-job policy. Preserve completed payload and delivery facts when cancellation interrupts webhook response cleanup. Record terminal timed and watcher-fired on-exit failures through the existing auto-disable owner, making them visible in doctor. Carry watcher occurrence provenance from the durable queue's launcher through worker finalization; keep ordinary paused/armed force-runs out of that terminal disposition and preserve later schedule edits. No schema, configuration, or compatibility path. Use the existing owner repair with alert fallback, a resolved failure alert, or the safety notice. Retain shared cooldown and incident suppression without an extra notice. The safety notice remains active for failureAlert:false and inherited bestEffort suppression. Document terminal behavior and doctor visibility. Release-note context: terminal one-shot failures no longer disappear silently, while operator cancels and restart retirements remain quiet. This maintainer re-expression supersedes #131590 and #167908 on current main after #169364. Co-authored-by: lonexreb <[email protected]> Co-authored-by: erlightbourn-source <[email protected]>
…et (#169314) Classify operator cancellation and Gateway retirement at their producers so terminal one-shots do not request a repair, alert, safety notice, or retry. This fixes the cancellation regression introduced by #169102 while retaining watchdog timeout retries and recurring-job policy. Preserve completed payload and delivery facts when cancellation interrupts webhook response cleanup. Record terminal timed and watcher-fired on-exit failures through the existing auto-disable owner, making them visible in doctor. Carry watcher occurrence provenance from the durable queue's launcher through worker finalization; keep ordinary paused/armed force-runs out of that terminal disposition and preserve later schedule edits. No schema, configuration, or compatibility path. Use the existing owner repair with alert fallback, a resolved failure alert, or the safety notice. Retain shared cooldown and incident suppression without an extra notice. The safety notice remains active for failureAlert:false and inherited bestEffort suppression. Document terminal behavior and doctor visibility. Release-note context: terminal one-shot failures no longer disappear silently, while operator cancels and restart retirements remain quiet. This maintainer re-expression supersedes #131590 and #167908 on current main after #169364. Co-authored-by: lonexreb <[email protected]> Co-authored-by: erlightbourn-source <[email protected]>
…et (openclaw#169314) Classify operator cancellation and Gateway retirement at their producers so terminal one-shots do not request a repair, alert, safety notice, or retry. This fixes the cancellation regression introduced by openclaw#169102 while retaining watchdog timeout retries and recurring-job policy. Preserve completed payload and delivery facts when cancellation interrupts webhook response cleanup. Record terminal timed and watcher-fired on-exit failures through the existing auto-disable owner, making them visible in doctor. Carry watcher occurrence provenance from the durable queue's launcher through worker finalization; keep ordinary paused/armed force-runs out of that terminal disposition and preserve later schedule edits. No schema, configuration, or compatibility path. Use the existing owner repair with alert fallback, a resolved failure alert, or the safety notice. Retain shared cooldown and incident suppression without an extra notice. The safety notice remains active for failureAlert:false and inherited bestEffort suppression. Document terminal behavior and doctor visibility. Release-note context: terminal one-shot failures no longer disappear silently, while operator cancels and restart retirements remain quiet. This maintainer re-expression supersedes openclaw#131590 and openclaw#167908 on current main after openclaw#169364. Co-authored-by: lonexreb <[email protected]> Co-authored-by: erlightbourn-source <[email protected]>
Related: #131590
What Problem This Solves
Fixes: a one-shot cron job (
schedule.kind: "at") that fails permanently, or uses up its transient retries, is disabled with no failure alert whenfailureAlert.afteris at its default of 2.User Impact
User impact: operators now get the configured failure alert the first time a one-shot job fails terminally, so a missed reminder or scheduled send no longer disappears silently. Recurring jobs and retryable first failures behave exactly as before.
Why This Change Was Made
A one-shot is disabled after its terminal failure, so its consecutive-error streak can never reach
after=2, and the alert threshold is never met. This change marks that outcome as terminal and letsmaybeEmitFailureAlertskip theafterthreshold for it only. Alert routing, cooldown,bestEffortandfailureAlert: falseare unchanged.This overlaps with #131590, which takes a broader approach (it also changes the disable reason and docs). This PR is the minimal version: 4 files, +146/−4, most of it a regression test. Maintainers can pick whichever they prefer, and I'm happy to close this one if #131590 lands.
Evidence
Real Gateway run (base vs head, same state dir)
Isolated Gateway built from this checkout (
OPENCLAW_HOME=/tmp/..., loopback, token auth,OPENCLAW_SKIP_CHANNELS=1). Timed one-shot command jobs (--at), each withfailureAlert: { mode: "webhook", to: <local receiver> }. The local receiver neededcron.webhookSsrfPolicy.dangerouslyAllowPrivateNetwork: truein the test config.3e90389813(no fix in the builtdist, checked by grep): ranproof-base-permanent(exit 2, defaultafter),proof-base-exhausted(exit 1,after: 5) andproof-base-exhausted-timeout(timeoutSeconds: 1,after: 5, 4 timed-out attempts). All three were disabled, no alert was emitted (lastFailureAlertAtMsunset), and 0 webhook requests arrived.proof-upgrade-permanent(defaultafter) andproof-upgrade-exhausted(after: 5) were created and configured on the base build. The Gateway was then stopped and restarted on the head build (1f428ad278) against the same state, with the jobs' existing failure-alert settings unchanged.afterWebhook bodies received on head (redacted to the receiver's view):
Tests
timer-outcomes.regression.test.ts:failureAlert: false.after.after: 5.3e90389813, 3 of these tests fail. On head, 33/33 pass across the two files.vitest run src/cronon the original head, rebased on main 3e90389: 2303 passed, 7 skipped, 0 failed. One file (run.session-workspace-authority.test.ts) errored in setup on my machine because a local Xcode license prompt blockedgit init. That's an environment issue, not this change.Contract note
docs/cli/cron.mdnow documents the terminal exception: a disabled one-shot can never reachafter, so its terminal failure alerts immediately. Cooldown, routing,bestEffortandfailureAlert: falsestill apply. See the reasoning in the thread.