Problem
When a cron job fires and spawns an agent session, the gateway sets runningAtMs
on the cron's state. If the session times out or crashes, runningAtMs is never
cleared. The scheduler then skips the cron on every subsequent tick because it
thinks a session is still running.
The only way to clear it is a disable/enable toggle via the API, which is not
discoverable and requires knowing the internal state model.
Expected Behavior
The gateway should auto-clear runningAtMs when:
- The spawned session ends (completes, times out, or errors)
runningAtMs has been set for longer than the cron's timeoutSeconds + a buffer
Observed Behavior
runningAtMs persists indefinitely. Crons silently stop executing with no
error logged. The only visible symptom is that nextRunAtMs stays in the past
and the cron never fires again.
Workaround
Disable/enable the cron via the API:
POST /tools/invoke
{"tool":"cron","args":{"action":"update","id":"<job-id>","patch":{"enabled":false}}}
// wait 100ms
POST /tools/invoke
{"tool":"cron","args":{"action":"update","id":"<job-id>","patch":{"enabled":true}}}
This clears state entirely and resets nextRunAtMs.
Environment
- OpenClaw gateway v2026.2.x
- macOS, launchd-managed gateway process
Problem
When a cron job fires and spawns an agent session, the gateway sets
runningAtMson the cron's state. If the session times out or crashes,
runningAtMsis nevercleared. The scheduler then skips the cron on every subsequent tick because it
thinks a session is still running.
The only way to clear it is a disable/enable toggle via the API, which is not
discoverable and requires knowing the internal state model.
Expected Behavior
The gateway should auto-clear
runningAtMswhen:runningAtMshas been set for longer than the cron'stimeoutSeconds+ a bufferObserved Behavior
runningAtMspersists indefinitely. Crons silently stop executing with noerror logged. The only visible symptom is that
nextRunAtMsstays in the pastand the cron never fires again.
Workaround
Disable/enable the cron via the API:
This clears
stateentirely and resetsnextRunAtMs.Environment