openclaw - ✅(Solved) Fix WhatsApp watchdog reconnect loop: lastInboundAt persists across reconnects [1 pull requests, 2 comments, 3 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#59830Fetched 2026-04-08 02:39:59
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
0
Author
Timeline (top)
commented ×2closed ×1cross-referenced ×1locked ×1

Root Cause

In channel.runtime-Dto237Iv.js (the WhatsApp web channel runtime):

  1. MESSAGE_TIMEOUT_MS defaults to 30 minutes (1800s)
  2. When a connection starts, lastInboundAt is initialized from the previous connection's value (line ~2630: createActiveConnectionRun(status.lastInboundAt ?? status.lastMessageAt ?? null))
  3. After 30 min of silence, the watchdog kills the connection and forces a reconnect
  4. The new connection inherits the old lastInboundAt timestamp
  5. The watchdog immediately sees "30+ min since last message" and kills the connection again
  6. This creates an infinite reconnect loop

Fix Action

Workaround

Increase MESSAGE_TIMEOUT_MS to 4 hours (hotpatch the default from 1800 * 1e3 to 14400 * 1e3).

PR fix notes

PR #60007: fix(whatsapp): reset watchdog timeout after reconnect

Description (problem / solution / changelog)

Summary

  • reset WhatsApp reconnect runs to start with a fresh watchdog window
  • use the new connection start time as the watchdog baseline until the next inbound message arrives
  • update the reconnect watchdog test to prove the new listener survives before the fresh timeout expires

Root cause

The reconnect path reused the previous run's lastInboundAt, so a quiet channel could reconnect and immediately trip the watchdog again with stale message age.

Validation

  • pnpm test -- extensions/whatsapp/src/auto-reply.web-auto-reply.connection-and-logging.e2e.test.ts
  • pnpm build

Fixes #59830

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/whatsapp/src/auto-reply.web-auto-reply.connection-and-logging.e2e.test.ts (modified, +6/-2)
  • extensions/whatsapp/src/auto-reply/monitor.ts (modified, +7/-8)
RAW_BUFFERClick to expand / collapse

Bug

The WhatsApp watchdog timer causes an infinite reconnect loop during quiet hours (night, weekends, etc.) when no messages are received for 30+ minutes.

Root Cause

In channel.runtime-Dto237Iv.js (the WhatsApp web channel runtime):

  1. MESSAGE_TIMEOUT_MS defaults to 30 minutes (1800s)
  2. When a connection starts, lastInboundAt is initialized from the previous connection's value (line ~2630: createActiveConnectionRun(status.lastInboundAt ?? status.lastMessageAt ?? null))
  3. After 30 min of silence, the watchdog kills the connection and forces a reconnect
  4. The new connection inherits the old lastInboundAt timestamp
  5. The watchdog immediately sees "30+ min since last message" and kills the connection again
  6. This creates an infinite reconnect loop

Expected Behavior

After a reconnect, the watchdog should give the new connection fresh time before considering it stale. The lastInboundAt should be reset (or the watchdog should use connection start time as baseline).

Proposed Fix

In createActiveConnectionRun(), reset lastInboundAt to null (or Date.now()) instead of inheriting the old value. This way the watchdog only triggers after 30 real minutes of silence on the new connection, not based on stale timestamps from the old one.

Workaround

Increase MESSAGE_TIMEOUT_MS to 4 hours (hotpatch the default from 1800 * 1e3 to 14400 * 1e3).

Affected File

dist/channel.runtime-Dto237Iv.js (built from the WhatsApp web channel monitor source)

extent analysis

TL;DR

Reset lastInboundAt to null or Date.now() in createActiveConnectionRun() to prevent the infinite reconnect loop.

Guidance

  • Identify the createActiveConnectionRun function in channel.runtime-Dto237Iv.js and update the lastInboundAt initialization to reset its value.
  • Verify the fix by monitoring the connection behavior during quiet hours and checking for the absence of infinite reconnect loops.
  • As a temporary workaround, consider increasing MESSAGE_TIMEOUT_MS to 4 hours to reduce the frequency of reconnects.
  • Review the code changes to ensure that the watchdog timer is correctly reset after a reconnect.

Example

// In createActiveConnectionRun()
const newLastInboundAt = Date.now(); // or null
createActiveConnectionRun(newLastInboundAt);

Notes

This fix assumes that the issue is solely caused by the incorrect initialization of lastInboundAt. Additional logging or debugging may be necessary to confirm the root cause.

Recommendation

Apply the proposed fix by resetting lastInboundAt in createActiveConnectionRun(), as it directly addresses the identified root cause and prevents the infinite reconnect loop.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING