Skip to content

[Bug] Cron job state.runningAtMs not cleared after successful completion, blocking future runs #17554

@InternetJohnny

Description

@InternetJohnny

Summary

A cron job can complete successfully (lastStatus: "ok") but retain a stale runningAtMs timestamp in its state. This causes cron.run (manual trigger) to return {"ran": false, "reason": "already-running"} and prevents the job from being triggered again until the field is manually removed from jobs.json.

Steps to reproduce

  1. Have a cron job running on an every schedule (e.g. everyMs: 3600000)
  2. The job completes successfully — lastStatus: "ok", consecutiveErrors: 0
  3. Attempt to manually trigger via cron.run RPC or control UI
  4. Blocked with already-running because state.runningAtMs was never cleared

Expected behavior

runningAtMs should always be cleared on completion. Suggest adding a staleness check (e.g. if runningAtMs older than 2 × timeoutSeconds, treat as stale).

Actual behavior

{
  "lastRunAtMs": 1771179192872,
  "lastStatus": "ok",
  "consecutiveErrors": 0,
  "runningAtMs": 1771182792873
}

Workaround: Manually remove runningAtMs from ~/.openclaw/cron/jobs.json.

OpenClaw version

2026.2.13

Operating system

macOS 26.2 Apple Silicon

Install method

npm global

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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