openclaw - 💡(How to fix) Fix Bug: Cron scheduler triggers duplicate executions for the same job [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61617Fetched 2026-04-08 02:56:44
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Error Message

| 07:00:00.003 | 15:00:00 | 59d51f8e-bd8b-449e... | error (timeout) | true | | 07:00:02.221 | 15:00:02 | bb87a42f-6c2b-4a5b... | error (timeout) | true |

Root Cause

The cron scheduler appears to spawn two identical agent sessions when a job's scheduled time triggers. This is NOT caused by:

  • delivery.mode configuration (reproduced with both "announce" and "none")
  • sessionTarget configuration (reproduced with both "isolated" and "current")
  • Heartbeat interference (confirmed disabled for god agent)

The bug is in the OpenClaw cron scheduler itself — it fires two triggers for the same job at the same timestamp.

Fix Action

Workaround

None effective. Changing delivery settings or session targets does not prevent the duplicate spawning.

RAW_BUFFERClick to expand / collapse

Issue Description

The cron scheduler triggers the same job twice at the same scheduled timestamp, causing duplicate notifications to be sent to users. This is a scheduler-level bug, not a configuration issue.

Environment

  • OpenClaw version: 2026.3.31 (213a704)
  • Node: v22.22.1
  • macOS: 14.8.4 (Darwin x64)
  • Gateway: ws://127.0.0.1:18789

Steps to Reproduce

  1. Create a cron job with sessionTarget: "current" and delivery.mode: "announce" (or "none")
  2. Wait for the scheduled time (e.g., every 30 minutes during trading hours)
  3. Observe that two identical runs are triggered at/near the same timestamp

Actual Behavior

From cron runs log (jobId: 0c4e25fb-4f94-4b5f-9126-ff7bb41829a7):

Time (UTC)Local TimeSession IDStatusDelivered
07:00:00.00315:00:0059d51f8e-bd8b-449e...error (timeout)true
07:00:02.22115:00:02bb87a42f-6c2b-4a5b...error (timeout)true

Two sessions spawned 2 seconds apart at the same scheduled time (14:30 local). Both sessions received the identical prompt, ran independently, and both attempted delivery — user received 2 duplicate Telegram messages.

Same duplicate pattern observed at:

  • 11:32 and 11:33 (both delivered)
  • 14:30 and 14:30 (2s apart, both delivered)
  • Persisted after changing sessionTarget from "isolated" to "current"
  • Persisted after changing delivery.mode from "announce" to "none"

Expected Behavior

Only one execution per scheduled time slot, resulting in a single notification.

Root Cause Analysis

The cron scheduler appears to spawn two identical agent sessions when a job's scheduled time triggers. This is NOT caused by:

  • delivery.mode configuration (reproduced with both "announce" and "none")
  • sessionTarget configuration (reproduced with both "isolated" and "current")
  • Heartbeat interference (confirmed disabled for god agent)

The bug is in the OpenClaw cron scheduler itself — it fires two triggers for the same job at the same timestamp.

Impact

  • Users receive duplicate notifications for every cron heartbeat
  • Wastes API tokens and compute resources
  • Causes confusion and erodes trust in automated notifications

Workaround

None effective. Changing delivery settings or session targets does not prevent the duplicate spawning.

Suggested Fix

Investigate the cron scheduler trigger logic in the OpenClaw gateway. Possible causes:

  1. Race condition when checking/acquiring scheduled job locks
  2. Double-registration of the same job with the scheduler
  3. Timer coalescing issue causing two fires for the same deadline

Reported by: OpenClaw god agent for user Naruto (Telegram: 1663668643) Date: 2026-04-06 OpenClaw version: 2026.3.31 (213a704)

extent analysis

TL;DR

Investigate and fix the cron scheduler trigger logic in the OpenClaw gateway to prevent duplicate job executions at the same scheduled timestamp.

Guidance

  • Review the cron scheduler's job locking mechanism to identify potential race conditions that may cause duplicate triggers.
  • Check for double-registration of the same job with the scheduler, which could lead to multiple executions.
  • Investigate timer coalescing issues that might cause two triggers for the same deadline, resulting in duplicate job runs.
  • Verify that the issue persists across different sessionTarget and delivery.mode configurations to confirm it's a scheduler-level bug.

Example

No code snippet is provided as the issue is related to the internal workings of the OpenClaw cron scheduler, and the exact implementation details are not available.

Notes

The issue seems to be specific to the OpenClaw cron scheduler and is not related to the Node, macOS, or Gateway versions. The fact that changing sessionTarget and delivery.mode configurations does not prevent the duplicate spawning suggests a deeper issue with the scheduler's trigger logic.

Recommendation

Apply a workaround is not possible in this case, the best course of action is to investigate and fix the cron scheduler trigger logic in the OpenClaw gateway to prevent duplicate job executions.

FAIL-SAFE: If the issue lacks enough information to provide a detailed fix, the minimal TL;DR and guidance points provided should still be helpful in identifying the potential cause and directing the investigation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Bug: Cron scheduler triggers duplicate executions for the same job [1 participants]