Skip to content

Cron jobs with sessionTarget=main don't fire after midnight #10449

@VicThor-wpp

Description

@VicThor-wpp

Description

Cron jobs configured with sessionTarget: main, wakeMode: next-heartbeat, and payload.kind: systemEvent stop firing after the gateway has been running for an extended period (overnight).

Steps to Reproduce

  1. Configure multiple cron jobs with:

    • sessionTarget: "main"
    • wakeMode: "next-heartbeat"
    • payload: { kind: "systemEvent", text: "..." }
    • Various schedules (e.g., 0 8 * * *, 30 8 * * *, etc.)
    • Timezone configured (e.g., tz: "America/Montevideo")
  2. Let the gateway run overnight without restart

  3. Check cron status the next morning

Expected Behavior

Cron jobs should fire at their scheduled times and inject systemEvents into the main session.

Actual Behavior

  • Crons show lastRunAtMs from the previous day
  • nextRunAtMs shows times that have already passed
  • Manual cron run returns { ran: false, reason: "not-due" } even when nextRunAtMs is in the past
  • Gateway restart fixes the issue (recalculates schedules correctly)

Environment

  • OpenClaw version: 2026.2.3-1 (d84eb46)
  • OS: Linux (WSL2)
  • Node: v24.11.1
  • Timezone: America/Montevideo (GMT-3)

Workaround

Migrated crons to sessionTarget: isolated with payload.kind: agentTurn, which appears more reliable.

Additional Context

The scheduler seems to not recalculate nextRunAtMs correctly after midnight, possibly a timezone-related issue or a bug in the cron evaluation loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions