[Bug]: cron-owned exec completion events are incorrectly relayed to the user by heartbeat
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
After an isolated cron run already completes with its own final result, OpenClaw still relays the cron-internal exec completion event to the user through heartbeat as a separate user-facing async-result message.
Steps to reproduce
- Start from a clean Linux runtime. In this reproduction,
~/.openclaw was archived and rebuilt with only:
openclaw.json
.env
cron/jobs.json
hooks/
extensions/
- Run:
openclaw cron run --expect-final 392e2cfd-abd2-40a2-8aa2-fc05937e372b
- Observe the actual cron run transcript:
~/.openclaw/agents/main/sessions/db42c881-a887-4cc6-a5bf-10b426cbfa58.jsonl
- Confirm the cron run itself finishes with:
- Observe the later heartbeat relay transcript:
~/.openclaw/agents/main/sessions/e70f3c08-0015-4ba8-96ee-52f83e2f04a3.jsonl
- Confirm heartbeat receives a user message whose body starts with:
An async command you ran earlier has completed. The result is:
Exec completed (rapid-br, code 0) :: news snapshot written to temp/news/raw-latest.md
- Run:
openclaw system heartbeat last --json
- Observe that Telegram receives a second user-facing completion report for the same internal cron execution.
Expected behavior
Once the cron run has already produced its own final result (news_fetcher ok), the internal exec completion should remain internal and should not later be relayed to the user by heartbeat as a separate async-result message.
Actual behavior
The cron run finishes correctly with news_fetcher ok, but OpenClaw still emits an internal exec completion event and later relays that event to the user through heartbeat.
In this clean-runtime reproduction, the final user-facing relay was:
[完成] 异步命令已完成
- 结果:成功,退出码 0
- 输出:`news snapshot written to temp/news/raw-latest.md`
如果你要,我也可以继续帮你查看这个快照内容。
This shows the bug still exists even after removing stale runtime state; only the language of the relay changed.
OpenClaw version
2026.4.11 (769908e)
Operating system
Ubuntu 24.04 (Linux x86_64)
Install method
npm global
Model
Observed cron path:
- initial provider/model attempt:
minimax/MiniMax-M2.7-highspeed
- final successful cron result provider/model:
openai/gpt-5.4-mini
- later heartbeat relay model:
openai/gpt-5.4-mini
Provider / routing chain
openclaw -> configured agent default model chain -> minimax first, then OpenAI fallback
Additional provider/model setup details
- Agent default model chain in
~/.openclaw/openclaw.json:
- primary:
minimax/MiniMax-M2.7-highspeed
- fallbacks include:
openai-codex/gpt-5.4-mini
openai/gpt-5.4-mini
openai-codex/gpt-5.4
openai/gpt-5.4
anthropic/claude-opus-4-6
google/gemini-3.1-flash-lite-preview
- The reproduction was re-run after rebuilding
~/.openclaw from a minimal clean Linux runtime, so this report is not based on migrated stale session state.
Logs, screenshots, and evidence
Affected job:
- Name: 新闻原始抓取
- Job ID: 392e2cfd-abd2-40a2-8aa2-fc05937e372b
Cron run transcript:
- ~/.openclaw/agents/main/sessions/db42c881-a887-4cc6-a5bf-10b426cbfa58.jsonl
Observed final cron answer:
- news_fetcher ok
Run history:
- ~/.openclaw/cron/runs/392e2cfd-abd2-40a2-8aa2-fc05937e372b.jsonl
Observed run entry:
- summary: news_fetcher ok
- status: ok
- delivered: false
Heartbeat relay transcript:
- ~/.openclaw/agents/main/sessions/e70f3c08-0015-4ba8-96ee-52f83e2f04a3.jsonl
Observed heartbeat input:
An async command you ran earlier has completed. The result is:
Exec completed (rapid-br, code 0) :: news snapshot written to temp/news/raw-latest.md
Please relay the command output to the user in a helpful way. If the command succeeded, share the relevant output. If it failed, explain what went wrong.
Observed heartbeat output:
[完成] 异步命令已完成
- 结果:成功,退出码 0
- 输出:`news snapshot written to temp/news/raw-latest.md`
如果你要,我也可以继续帮你查看这个快照内容。
Observed heartbeat delivery preview from:
- openclaw system heartbeat last --json
Root-cause evidence from installed dist:
File: dist/bash-tools.exec-runtime-jfecOhNR.js
Current behavior:
- maybeNotifyOnExit(...) enqueues:
Exec completed (...) :: <output>
- then requests heartbeat wake with reason "exec-event"
File: dist/heartbeat-runner-U2x6TbnN.js
Current behavior:
- buildExecEventPrompt(...) builds a user-facing relay request:
"An async command you ran earlier has completed..."
- later heartbeat delivers the resulting reply to the user
Impact and severity
- Affected users/systems/channels: direct Telegram user-facing heartbeat delivery on cron-owned isolated runs
- Severity: Medium to High (incorrect user-visible completion reports from internal cron execution)
- Frequency: Reproduced after clean runtime rebuild on the affected job
- Consequence: internal control-plane
exec completion events escape into user-visible chat and produce duplicate/misleading completion messages
Additional information
- This issue is distinct from stale
lastHeartbeatText inheritance and from missing exec-event body bugs.
- In this reproduction, the bug persisted after rebuilding
~/.openclaw, which rules out stale migrated runtime state as the primary cause.
- The minimal safe fix is to suppress
notifyOnExit / user-facing exec-event relay for cron-owned internal exec runs, or otherwise mark cron-owned exec completion events so heartbeat consumes them internally instead of relaying them to the user.
[Bug]: cron-owned exec completion events are incorrectly relayed to the user by heartbeat
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
After an isolated cron run already completes with its own final result, OpenClaw still relays the cron-internal
execcompletion event to the user through heartbeat as a separate user-facing async-result message.Steps to reproduce
~/.openclawwas archived and rebuilt with only:openclaw.json.envcron/jobs.jsonhooks/extensions/~/.openclaw/agents/main/sessions/db42c881-a887-4cc6-a5bf-10b426cbfa58.jsonl~/.openclaw/agents/main/sessions/e70f3c08-0015-4ba8-96ee-52f83e2f04a3.jsonlExpected behavior
Once the cron run has already produced its own final result (
news_fetcher ok), the internalexeccompletion should remain internal and should not later be relayed to the user by heartbeat as a separate async-result message.Actual behavior
The cron run finishes correctly with
news_fetcher ok, but OpenClaw still emits an internalexeccompletion event and later relays that event to the user through heartbeat.In this clean-runtime reproduction, the final user-facing relay was:
This shows the bug still exists even after removing stale runtime state; only the language of the relay changed.
OpenClaw version
2026.4.11 (769908e)
Operating system
Ubuntu 24.04 (Linux x86_64)
Install method
npm global
Model
Observed cron path:
minimax/MiniMax-M2.7-highspeedopenai/gpt-5.4-miniopenai/gpt-5.4-miniProvider / routing chain
openclaw -> configured agent default model chain -> minimax first, then OpenAI fallback
Additional provider/model setup details
~/.openclaw/openclaw.json:minimax/MiniMax-M2.7-highspeedopenai-codex/gpt-5.4-miniopenai/gpt-5.4-miniopenai-codex/gpt-5.4openai/gpt-5.4anthropic/claude-opus-4-6google/gemini-3.1-flash-lite-preview~/.openclawfrom a minimal clean Linux runtime, so this report is not based on migrated stale session state.Logs, screenshots, and evidence
Root-cause evidence from installed dist:
Impact and severity
execcompletion events escape into user-visible chat and produce duplicate/misleading completion messagesAdditional information
lastHeartbeatTextinheritance and from missing exec-event body bugs.~/.openclaw, which rules out stale migrated runtime state as the primary cause.notifyOnExit/ user-facing exec-event relay for cron-owned internal exec runs, or otherwise mark cron-owned exec completion events so heartbeat consumes them internally instead of relaying them to the user.