openclaw - 💡(How to fix) Fix [Bug]: WhatsApp: Watchdog timer not reset causes infinite reconnect loop + dedupe cache cleared causes duplicate replies [1 comments, 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#61356Fetched 2026-04-08 02:59:32
View on GitHub
Comments
1
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

WhatsApp: Watchdog timer not reset causes infinite reconnect loop + dedupe cache cleared causes duplicate replies

Error Message

listener.signalClose?.({ status: 499, error: "watchdog-timeout" });

Root Cause

WhatsApp: Watchdog timer not reset causes infinite reconnect loop + dedupe cache cleared causes duplicate replies

Code Example

**Bug 1: Watchdog timer 不重置导致无限重连**

**描述:**
WhatsApp 插件的 watchdog 机制在 30 分钟无消息后会重启连接,但 timer 在 reconnect 后没有重置,导致无限循环重连(每分钟一次)。

**日志证据:**

---

**代码位置:**
`/opt/homebrew/lib/node_modules/openclaw/dist/login-DW2Orybl.js`

---

**问题:** 重连后 `lastInboundAt` 没有被重置,导致 timer 每分钟都触发重连。

**建议修复:** 在重连成功后重置 `lastInboundAt = Date.now()`

---

**Bug 2: 重连后 dedupe cache 被清空导致重复回复**

**描述:**
Watchdog 重连后,dedupe cache 可能被清空,导致之前收到的消息被当作新消息重复处理,同一秒内发送了 10 次回复。

**日志证据:**

---

**代码位置:**
`/opt/homebrew/lib/node_modules/openclaw/dist/login-DW2Orybl.js`

---

**问题:** 重连时调用了 `resetWebInboundDedupe()`,清空了去重缓存,导致之前收到的消息被重复处理。

**建议修复:** 
1. 重连时不要清空 dedupe cache
2. 或者保留最近 N 分钟的消息 ID


### OpenClaw version

2026.4.2 (d74a122)

### Operating system

Darwin 25.4.0 (arm64)

### Install method

_No response_

### Model

glm-5

### Provider / routing chain

openclaw-venus-glm5

### Additional provider/model setup details

_No response_

### Logs, screenshots, and evidence
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

WhatsApp: Watchdog timer not reset causes infinite reconnect loop + dedupe cache cleared causes duplicate replies

Steps to reproduce

NOT_ENOUGH_INFO

Expected behavior

NOT_ENOUGH_INFO

Actual behavior

**Bug 1: Watchdog timer 不重置导致无限重连**

**描述:**
WhatsApp 插件的 watchdog 机制在 30 分钟无消息后会重启连接,但 timer 在 reconnect 后没有重置,导致无限循环重连(每分钟一次)。

**日志证据:**

[2026-04-05 21:01:15] WhatsApp gateway disconnected (status 499) [2026-04-05 21:01:18] WhatsApp gateway connected [2026-04-05 21:02:18] WhatsApp gateway disconnected (status 499) [2026-04-05 21:02:22] WhatsApp gateway connected ... (每分钟重复)


**代码位置:**
`/opt/homebrew/lib/node_modules/openclaw/dist/login-DW2Orybl.js`

```javascript
const MESSAGE_TIMEOUT_MS = tuning.messageTimeoutMs ?? 1800 * 1e3;  // 30分钟
const WATCHDOG_CHECK_MS = tuning.watchdogCheckMs ?? 60 * 1e3;     // 1分钟

active.watchdogTimer = setInterval(() => {
    if (!active.lastInboundAt) return;
    const timeSinceLastMessage = Date.now() - active.lastInboundAt;
    if (timeSinceLastMessage <= MESSAGE_TIMEOUT_MS) return;
    // 重启连接,但 timer 没有重置
    listener.signalClose?.({ status: 499, error: "watchdog-timeout" });
}, WATCHDOG_CHECK_MS);

问题: 重连后 lastInboundAt 没有被重置,导致 timer 每分钟都触发重连。

建议修复: 在重连成功后重置 lastInboundAt = Date.now()


Bug 2: 重连后 dedupe cache 被清空导致重复回复

描述: Watchdog 重连后,dedupe cache 可能被清空,导致之前收到的消息被当作新消息重复处理,同一秒内发送了 10 次回复。

日志证据:

20:01:36 Inbound message +85251691556 (收到消息)
... 11分钟延迟 ...
20:12:57 Auto-replied to +85251691556
20:12:57 Auto-replied to +85251691556
20:12:57 Auto-replied to +85251691556
... (同一秒内共 10 次)

代码位置: /opt/homebrew/lib/node_modules/openclaw/dist/login-DW2Orybl.js

function resetWebInboundDedupe() {
    recentInboundMessages.clear();
    recentOutboundMessages.clear();
}

问题: 重连时调用了 resetWebInboundDedupe(),清空了去重缓存,导致之前收到的消息被重复处理。

建议修复:

  1. 重连时不要清空 dedupe cache
  2. 或者保留最近 N 分钟的消息 ID

OpenClaw version

2026.4.2 (d74a122)

Operating system

Darwin 25.4.0 (arm64)

Install method

No response

Model

glm-5

Provider / routing chain

openclaw-venus-glm5

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Reset the lastInboundAt timer after a successful reconnect and preserve the dedupe cache to prevent infinite reconnect loops and duplicate replies.

Guidance

  • Identify the lines of code responsible for resetting the lastInboundAt timer and modify them to update the timer after a successful reconnect.
  • Modify the resetWebInboundDedupe function to preserve the dedupe cache instead of clearing it, or implement a mechanism to retain recent message IDs.
  • Review the reconnect logic to ensure it properly resets the watchdog timer and preserves the dedupe cache.
  • Test the modified code to verify that the infinite reconnect loop and duplicate replies are resolved.

Example

// Reset lastInboundAt after reconnect
listener.signalClose?.({ status: 499, error: "watchdog-timeout" });
active.lastInboundAt = Date.now(); // Reset lastInboundAt

// Preserve dedupe cache
function resetWebInboundDedupe() {
    // Instead of clearing, preserve recent message IDs
    // recentInboundMessages.clear();
    // recentOutboundMessages.clear();
}

Notes

The provided code snippets and suggestions are based on the assumption that the issue lies in the watchdog timer and dedupe cache reset logic. However, without additional context or information, it is difficult to provide a comprehensive solution.

Recommendation

Apply the suggested workaround by resetting the lastInboundAt timer and preserving the dedupe cache to prevent infinite reconnect loops and duplicate replies. This approach addresses the identified issues and provides a potential solution to the problem.

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

NOT_ENOUGH_INFO

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: WhatsApp: Watchdog timer not reset causes infinite reconnect loop + dedupe cache cleared causes duplicate replies [1 comments, 1 participants]