Skip to content

Bug: cron tool doesn't set state.nextRunAtMs, jobs never auto-fire #9472

@Aqelyy

Description

@Aqelyy

Environment

  • OpenClaw version: 2026.2.1
  • OS: macOS (Darwin 25.2.0 arm64)
  • Node: v22.22.0

Description

When creating cron jobs via the cron agent tool, the job is created but state.nextRunAtMs is not set, resulting in nextWakeAtMs: null in cron status. Jobs never auto-fire at the scheduled time.

Steps to Reproduce

  1. Use the cron tool to add a job:
{
  "action": "add",
  "job": {
    "name": "Test",
    "schedule": {"kind": "at", "atMs": 1770272283000},
    "sessionTarget": "isolated",
    "wakeMode": "now",
    "payload": {"kind": "agentTurn", "message": "Test", "deliver": true, "channel": "telegram", "to": "123456"}
  }
}
  1. Check cron statusnextWakeAtMs: null
  2. Job never fires automatically
  3. Manual cron run <jobId> --force works

Expected Behavior

state.nextRunAtMs should be set when job is created, and job should auto-fire at scheduled time.

Workaround

Using CLI works correctly:

openclaw cron add --name "Test" --at "2m" --session isolated --message "Test" --deliver --wake now

CLI creates jobs with proper state: { nextRunAtMs: <timestamp> } while the tool creates jobs with empty state: {}.

Additional Context

Discovered while setting up wake-up call alarms. The difference between tool and CLI behavior suggests the tool endpoint is missing the state initialization logic that the CLI has.

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