Skip to content

Cron/heartbeat deliveries duplicated 2-6x per trigger #59703

@cgood12

Description

@cgood12

Bug Description

Cron jobs and heartbeat polls are being delivered to the agent session multiple times per trigger. Each scheduled event (cron or heartbeat) results in 2-6 duplicate deliveries in a single batch.

Environment

  • OpenClaw version: 2026.4.1
  • OS: macOS 15.7.3 (arm64), Node v25.8.2
  • Gateway: Local, LaunchAgent, single process
  • Channel: Telegram
  • Heartbeat interval: Was 5m, now 15m (workaround)

Reproduction

  1. Set up any cron job or heartbeat with every: 5m
  2. Wait for the next trigger
  3. Observe the agent session receives the same message 2-6 times in a single delivery batch

What we've tried

  • Confirmed cron store is clean: openclaw cron list shows 10 unique jobs, no duplicates
  • Gateway restart (openclaw gateway restart) — did not fix
  • Fresh session via /new — did not fix
  • Killed all zombie subagents — did not fix

Investigation findings

  • Gateway logs showed two simultaneous WebSocket connections from the Control UI (conn=99c83f3c webchat v2026.3.28 and conn=d9d51181 webchat vcontrol-ui), established within 4ms of each other
  • However, closing browser tabs and restarting gateway did not resolve the issue
  • The duplication count varies (2x, 3x, 4x, 6x) suggesting it may be related to the number of active WS connections or subscribers

Impact

  • Token burn: Each duplicate delivery loads the full agent context on an Opus-class model. At 5m heartbeat intervals with 3-6x duplication, this burned ~60% of API usage allowance in 5 hours with zero user activity.
  • Session context pollution: Duplicate messages fill the context window, triggering unnecessary compaction cycles.

Expected behavior

Each cron trigger and heartbeat poll should result in exactly one delivery to the target agent session.

Workaround

Increased heartbeat interval from 5m to 15m to reduce the burn rate, but the underlying duplication remains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions