openclaw - 💡(How to fix) Fix [Bug] WhatsApp 499 reconnection loop: inactivity timer not reset after successful reconnect [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#62258Fetched 2026-04-08 03:07:05
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Fix Action

Workaround

Disabling the health monitor stops the loop but loses legitimate disconnect detection:

{
  "channels": {
    "whatsapp": {
      "healthMonitor": { "enabled": false }
    }
  }
}

Code Example

[whatsapp] No messages received in 118m - restarting connection
[whatsapp] Web connection closed (status 499). Retry 1/12 in 2.16s…
[whatsapp] Listening for personal WhatsApp inbound messages.
[whatsapp] No messages received in 119m - restarting connection  ← timer NOT reset

---

{
  "channels": {
    "whatsapp": {
      "healthMonitor": { "enabled": false }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Bug Description

The WhatsApp gateway enters an infinite disconnect/reconnect loop (status 499) when no inbound messages are received for an extended period. The health monitor detects "no messages in X min" and triggers a reconnection, but the inactivity timer is not reset after a successful reconnect. This causes the timer to immediately trigger another reconnect ~60s later, creating an infinite loop.

Reproduction

  1. Connect WhatsApp Web via OpenClaw gateway
  2. Wait for a period with no inbound messages (typically 2-6 hours)
  3. The health monitor triggers a reconnect due to inactivity
  4. After successful reconnect, the timer still shows the old lastMessageAt value
  5. ~60 seconds later, the health monitor triggers another reconnect
  6. Loop continues indefinitely until an actual inbound message arrives

Evidence

Over ~24 hours, we observed 202 disconnect/reconnect events in distinct bursts:

  • Sat Apr 5, 08:31–09:59 UTC → 85 events
  • Sat Apr 5, 11:00–15:59 UTC → 64 events
  • Sat Apr 5, 20:00–Sun 07:43 UTC → 53 events

Gateway logs show the pattern:

[whatsapp] No messages received in 118m - restarting connection
[whatsapp] Web connection closed (status 499). Retry 1/12 in 2.16s…
[whatsapp] Listening for personal WhatsApp inbound messages.
[whatsapp] No messages received in 119m - restarting connection  ← timer NOT reset

Collateral Damage

  • Cron job deliveries fail with "No active WhatsApp Web listener"
  • Pending delivery entries stuck in backoff
  • Agent runs fail during the reconnect window

Workaround

Disabling the health monitor stops the loop but loses legitimate disconnect detection:

{
  "channels": {
    "whatsapp": {
      "healthMonitor": { "enabled": false }
    }
  }
}

Expected Behavior

After a successful reconnect, lastMessageAt (or equivalent inactivity timer) should be reset to the current timestamp, preventing the health monitor from immediately triggering another reconnect.

Environment

  • OpenClaw latest (d74a122)
  • WhatsApp channel (personal, linked device)
  • Ubuntu ARM64 (t4g.2xlarge)
  • Node v22.22.2

extent analysis

TL;DR

Reset the lastMessageAt timer after a successful reconnect to prevent the infinite disconnect/reconnect loop.

Guidance

  • Verify that the lastMessageAt timer is being updated correctly after a successful reconnect by checking the gateway logs for the expected reset.
  • Implement a fix to reset the lastMessageAt timer after a successful reconnect, ensuring the health monitor waits for the full inactivity period before triggering another reconnect.
  • Review the health monitor configuration to ensure it is correctly detecting legitimate disconnects and triggering reconnects only when necessary.
  • Consider implementing a temporary workaround, such as disabling the health monitor, to prevent the infinite loop while a permanent fix is developed.

Example

// Example of resetting lastMessageAt after successful reconnect
{
  "channels": {
    "whatsapp": {
      "onReconnect": {
        "resetLastMessageAt": true
      }
    }
  }
}

Note: This example is hypothetical and may not be a direct solution, as the actual implementation details are not provided in the issue.

Notes

The provided workaround of disabling the health monitor is not ideal, as it loses legitimate disconnect detection. A permanent fix should focus on correctly resetting the lastMessageAt timer after a successful reconnect.

Recommendation

Apply a workaround to reset the lastMessageAt timer after a successful reconnect, as this addresses the root cause of the infinite loop and prevents collateral damage to cron job deliveries and agent runs.

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