-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
One-shot at cron jobs are disabled before execution, always skipped as "disabled" #91775
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
One-shot
atcron jobs are disabled before execution, always skipped as "disabled"Summary
One-shot cron jobs (
schedule.kind: "at") are stored withenabled: falsedespite thecron addAPI returningenabled: true. When the scheduler fires the job at the scheduled time, it finds the job disabled and skips it with error"disabled". ThedeleteAfterRuncleanup never triggers because the run was skipped rather than completed, leaving zombie disabled jobs in thecron_jobstable.This affects all one-shot jobs regardless of
sessionTargetorpayload.kind. Recurring jobs (schedule.kind: "cron"and"every") are unaffected.Environment
main), macOS, gateway mode local~/.openclaw/state/openclaw.sqlite)Reproduction
{ "name": "test-wake-30s", "schedule": { "kind": "at", "at": "2026-06-09T22:38:50Z" }, "sessionTarget": "main", "payload": { "kind": "systemEvent", "text": "Test wake: 30 second one-shot." }, "delivery": { "mode": "none" }, "enabled": true, "deleteAfterRun": true }cron addreturnsenabled: truein the API response.Immediately query
cron_jobstable:Wait for the scheduled time to pass.
Query again:
The job fired at exactly the scheduled time (
last_run_at_msmatches) but was skipped because it had been flipped toenabled: false.Evidence
Run log
{ "jobId": "80d302d1-71b8-4e76-8681-08a21cdf710a", "status": "skipped", "error": "disabled", "sessionKey": "agent:main:cron:80d302d1-71b8-4e76-8681-08a21cdf710a:run:1781040420024", "runAtMs": 1781040420024, "durationMs": 6 }Duration of 6ms — the skip is immediate, no actual execution attempted.
Stored job JSON
{ "id": "80d302d1-71b8-4e76-8681-08a21cdf710a", "enabled": false, // ← was created with enabled: true "deleteAfterRun": true, "schedule": { "kind": "at", "at": "2026-06-09T21:27:00.000Z" }, "sessionTarget": "main", "payload": { "kind": "systemEvent", "text": "..." } }Scale of impact
Across 3 long-run sprint sessions, 12 one-shot wake jobs were created. Every single one was stored as
enabled: falseand skipped asdisabled. Zero one-shot jobs have ever succeeded on this installation. Recurring jobs (cron,every) work correctly.Root Cause (suspected)
Looking at
src/cron/service/timer.tslines 1416+, the one-shot execution path appears to disable the job as part of itsdeleteAfterRunlifecycle before running the actual execution. The execution then finds the job already disabled and skips it.The likely sequence:
enabled: false) as the first step ofdeleteAfterRunenabled, findsfalse, returnsskipped: disabledok), the deletion step doesn't executeThis is a different issue from #67500 (which was about delivery stalls to idle sessions). #67500's cited fix commits (
355c92d69b38and7e52223d3275) are unrelated to this lifecycle — they address config loading and image understanding registration respectively.Workaround
None found for one-shot jobs. Affected users can work around the limitation by using recurring jobs (
schedule.kind: "cron"or"every") and disabling them after the first successful run, or by usingsessionTarget: "isolated"withpayload.kind: "agentTurn"which uses push-based completion events rather than scheduled wakes.Related