Skip to content

WhatsApp watchdog reconnect loop: inactivity timer not reset after reconnect #55246

@FredMyMan

Description

@FredMyMan

Bug

The WhatsApp inactivity watchdog triggers after 30 minutes of no inbound messages and restarts the socket connection (status 499). However, the 'last message received' timestamp is not reset after a successful reconnect.

This causes a reconnect loop: after the first 30-minute trigger, the watchdog fires again ~60 seconds later (31m, 32m, 33m...) in an infinite cycle until a real inbound message arrives.

Impact

  • Unnecessary disconnect/reconnect every ~60 seconds during quiet periods
  • Risk of dropping inbound messages during the 2-4 second reconnect window
  • Noisy logs

Expected behavior

The inactivity timer should reset after a successful reconnect, so the next watchdog check waits a full 30 minutes.

Logs

2026-03-26T17:01:12.586+02:00 [whatsapp] Web connection closed (status 499). Retry 1/12 in 2.29s
2026-03-26T17:02:16.467+02:00 [whatsapp] No messages received in 31m - restarting connection
2026-03-26T17:02:16.470+02:00 [whatsapp] Web connection closed (status 499). Retry 1/12 in 2.39s
2026-03-26T17:03:20.633+02:00 [whatsapp] No messages received in 32m - restarting connection
2026-03-26T17:03:20.636+02:00 [whatsapp] Web connection closed (status 499). Retry 1/12 in 2.16s
```n
Pattern continues every ~60s until an actual inbound message resets the counter.

## Environment

- OpenClaw 2026.3.24
- WhatsApp channel (personal)
- Windows, pm2

Metadata

Metadata

Assignees

No one assigned

    Labels

    close:duplicateClosed as duplicatededupe:childDuplicate issue/PR child in dedupe cluster

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions