Skip to content

[Bug]: openclaw system event --mode now silently skipped when HEARTBEAT.md is effectively empty #14527

@nklwsy

Description

@nklwsy

Summary

openclaw system event --text "..." --mode now CLI command is silently skipped when HEARTBEAT.md contains only comments or whitespace. The CLI returns ok, but the gateway never triggers an agent run because the heartbeat wake reason "wake" is not exempted from the isHeartbeatContentEffectivelyEmpty check.

Steps to reproduce

  1. Ensure HEARTBEAT.md contains only comments (e.g. # Keep this file empty...) or is empty
  2. Run: openclaw system event --text "Test notification" --mode now
  3. CLI returns ok
  4. Observe that the main session agent is never woken up — no agent run is triggered

Expected behavior

openclaw system event --mode now should always wake the agent regardless of HEARTBEAT.md content, since the system event itself carries the payload that needs processing. The "wake" reason should be exempted from the empty-heartbeat-file check, similar to how "exec-event" and "cron:*" reasons are already exempted.

Actual behavior

In health-format-C-6Pxyam.jsrunHeartbeatOnce(), when HEARTBEAT.md is effectively empty, the function returns { status: "skipped", reason: "empty-heartbeat-file" } before reaching the agent run. The exemption check only covers:

  • isExecEventReason (reason === "exec-event")
  • isCronEventReason (reason?.startsWith("cron:"))

But openclaw system event --mode now uses reason: "wake" (set in gateway-cli line ~4048), which is not exempted.

Relevant code path:

gateway-cli: enqueueSystemEvent(text, ...) → requestHeartbeatNow({ reason: "wake" })
health-format: runHeartbeatOnce() → isHeartbeatContentEffectivelyEmpty() → skipped

Suggested fix

Add "wake" to the exemption list in runHeartbeatOnce():

const isWakeReason = opts.reason === "wake";

if (isHeartbeatContentEffectivelyEmpty(...) 
    && !isExecEventReason && !isCronEventReason && !isWakeReason) {
    // skip
}

Or more broadly, exempt any reason that has a pending system event in the queue.

Environment

  • OpenClaw version: 2026.2.9 (33c75cb)
  • OS: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
  • Node: v22.22.0
  • Install method: npm global

Logs or screenshots

Gateway log shows no wake/enqueue activity after CLI returns ok:

07:16:45Z [INFO] ok                          ← CLI returns success
... (no lane enqueue or agent run until user manually sends a message at 07:21:17Z)
07:21:17Z [DEBUG] lane enqueue: lane=session:agent:main:main queueSize=1  ← triggered by user message, not system event

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions