openclaw - ✅(Solved) Fix [Bug]: Heartbeat 回复重复发送 [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#59381Fetched 2026-04-08 02:24:28
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1

Bug Report: Heartbeat 回复重复发送

现象 每次 heartbeat 触发时,用户收到 2 条(有时更多)相同或相似的消息,而不是 1 条。

复现步骤

OpenClaw 配置了 heartbeat,频率约每小时一次 Heartbeat 触发,模型判断无需处理,应回复 HEARTBEAT_OK 用户实际收到 2 条消息(重复) 根本原因 模型在生成回复时,思考过程(reasoning text)泄漏到了可见输出中。思考文字内包含 HEARTBEAT_OK,加上最终输出的 HEARTBEAT_OK,系统识别到两个关键词,发出两条消息。

影响范围

仅影响该 session,不影响其他用户 Token 消耗正常(单次 API 调用,无重复计费) 造成信息冗余,用户体验差 期望行为 每次 heartbeat 只发送 1 条消息。

建议修复方向 系统层面在处理 heartbeat 回复时,只识别并发送第一个 HEARTBEAT_OK,忽略后续重复内容。

环境信息

模型:litellm/bedrock-claude-4-6-sonnet Channel:WEA 首次发现:2026-04-01

Root Cause

Bug Report: Heartbeat 回复重复发送

现象 每次 heartbeat 触发时,用户收到 2 条(有时更多)相同或相似的消息,而不是 1 条。

复现步骤

OpenClaw 配置了 heartbeat,频率约每小时一次 Heartbeat 触发,模型判断无需处理,应回复 HEARTBEAT_OK 用户实际收到 2 条消息(重复) 根本原因 模型在生成回复时,思考过程(reasoning text)泄漏到了可见输出中。思考文字内包含 HEARTBEAT_OK,加上最终输出的 HEARTBEAT_OK,系统识别到两个关键词,发出两条消息。

影响范围

仅影响该 session,不影响其他用户 Token 消耗正常(单次 API 调用,无重复计费) 造成信息冗余,用户体验差 期望行为 每次 heartbeat 只发送 1 条消息。

建议修复方向 系统层面在处理 heartbeat 回复时,只识别并发送第一个 HEARTBEAT_OK,忽略后续重复内容。

环境信息

模型:litellm/bedrock-claude-4-6-sonnet Channel:WEA 首次发现:2026-04-01

Fix Action

Fixed

PR fix notes

PR #59434: fix(heartbeat): suppress reasoning payloads when main reply is HEARTBEAT_OK (#59381)

Description (problem / solution / changelog)

Summary

Fixes #59381 — heartbeat replies sent in duplicate when reasoning text exists.

Root cause

In heartbeat-runner.ts, when the model's main reply is HEARTBEAT_OK (nothing to report) but the model also produced reasoning text (e.g., "Reasoning: I should reply HEARTBEAT_OK since nothing changed"), the early-return path at line 776 was gated on reasoningPayloads.length === 0. This caused the function to fall through to the delivery path, sending the reasoning payloads to the user even though the main reply was suppressed.

When reasoning text itself contains "HEARTBEAT_OK", the user receives what appears to be a duplicate message — the reasoning text leaks through as a visible message.

Fix

Remove the reasoningPayloads.length === 0 guard from the early-return condition. When the main reply is HEARTBEAT_OK (the model decided nothing is worth reporting), all payloads including reasoning should be suppressed. The reasoning is the model's internal thought process about why nothing needs to be reported — it should not be delivered to the user.

Before:

if (shouldSkipMain && reasoningPayloads.length === 0) {

After:

if (shouldSkipMain) {

Test changes

  • Updated existing "reasoning + HEARTBEAT_OK" test case to expect 0 sends (was expecting 1 — the reasoning payload)
  • Added new test case for reasoning text that itself contains "HEARTBEAT_OK" — verifies no payloads are sent

Verification

  • pnpm check passes clean
  • pnpm test -- src/infra/heartbeat-runner.returns-default-unset.test.ts — all 31 tests pass

Changed files

  • src/infra/heartbeat-runner.returns-default-unset.test.ts (modified, +11/-2)
  • src/infra/heartbeat-runner.ts (modified, +1/-1)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Bug Report: Heartbeat 回复重复发送

现象 每次 heartbeat 触发时,用户收到 2 条(有时更多)相同或相似的消息,而不是 1 条。

复现步骤

OpenClaw 配置了 heartbeat,频率约每小时一次 Heartbeat 触发,模型判断无需处理,应回复 HEARTBEAT_OK 用户实际收到 2 条消息(重复) 根本原因 模型在生成回复时,思考过程(reasoning text)泄漏到了可见输出中。思考文字内包含 HEARTBEAT_OK,加上最终输出的 HEARTBEAT_OK,系统识别到两个关键词,发出两条消息。

影响范围

仅影响该 session,不影响其他用户 Token 消耗正常(单次 API 调用,无重复计费) 造成信息冗余,用户体验差 期望行为 每次 heartbeat 只发送 1 条消息。

建议修复方向 系统层面在处理 heartbeat 回复时,只识别并发送第一个 HEARTBEAT_OK,忽略后续重复内容。

环境信息

模型:litellm/bedrock-claude-4-6-sonnet Channel:WEA 首次发现:2026-04-01

Steps to reproduce

Bug Report: Heartbeat 回复重复发送

现象 每次 heartbeat 触发时,用户收到 2 条(有时更多)相同或相似的消息,而不是 1 条。

复现步骤

OpenClaw 配置了 heartbeat,频率约每小时一次 Heartbeat 触发,模型判断无需处理,应回复 HEARTBEAT_OK 用户实际收到 2 条消息(重复) 根本原因 模型在生成回复时,思考过程(reasoning text)泄漏到了可见输出中。思考文字内包含 HEARTBEAT_OK,加上最终输出的 HEARTBEAT_OK,系统识别到两个关键词,发出两条消息。

影响范围

仅影响该 session,不影响其他用户 Token 消耗正常(单次 API 调用,无重复计费) 造成信息冗余,用户体验差 期望行为 每次 heartbeat 只发送 1 条消息。

建议修复方向 系统层面在处理 heartbeat 回复时,只识别并发送第一个 HEARTBEAT_OK,忽略后续重复内容。

环境信息

模型:litellm/bedrock-claude-4-6-sonnet Channel:WEA 首次发现:2026-04-01

Expected behavior

不要重复发消息

Actual behavior

每天的订阅 1,订阅发送有延迟,延迟40分钟以上 2,不要收到重复消息

OpenClaw version

OpenClaw 2026.3.14

Operating system

Mac OS

Install method

No response

Model

litellm/bedrock-claude-4-6-sonnet

Provider / routing chain

AWS Bedrock

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Modify the system to only recognize and send the first occurrence of HEARTBEAT_OK in the response, ignoring any subsequent duplicates.

Guidance

  • Review the model's response generation process to prevent the leakage of reasoning text into visible output, which contains HEARTBEAT_OK and causes duplicate messages.
  • Implement a filter or parser to identify and remove duplicate HEARTBEAT_OK messages from the response before sending them to the user.
  • Verify that the fix does not affect the normal functioning of the heartbeat mechanism or other system features.
  • Test the modified system with different input scenarios to ensure that it correctly handles HEARTBEAT_OK messages and prevents duplicates.

Example

No specific code example can be provided without knowing the exact implementation details of the system. However, the general approach would involve modifying the response processing logic to check for and remove duplicate HEARTBEAT_OK messages.

Notes

The provided information suggests that the issue is specific to the litellm/bedrock-claude-4-6-sonnet model and the WEA channel. The fix should be tested thoroughly to ensure it does not introduce any regressions or affect other models or channels.

Recommendation

Apply a workaround to filter out duplicate HEARTBEAT_OK messages from the response, as the root cause lies in the model's response generation process and modifying the system to handle this specific case is a more straightforward solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

不要重复发消息

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING