Skip to content

Cascading reconnects every ~30min after idle (Gateway WebSocket) #59589

@clawoneloke

Description

@clawoneloke

Bug Description

After approximately 30 minutes of idle time, the WhatsApp gateway begins a cascading reconnect loop. The root cause is that the idle counter increments continuously rather than resetting after each reconnect.

Steps to Reproduce

  1. Run OpenClaw gateway with WhatsApp channel connected
  2. Leave gateway idle for ~30 minutes
  3. Observe: gateway begins disconnecting every 30-60 seconds in a cascading loop

Expected Behavior

Gateway should reconnect normally after idle timeout without entering a reconnect loop.

Actual Behavior

  • Idle timeout triggers at 30 minutes → forces reconnect
  • After reconnect, idle counter does not reset to 0
  • Within seconds/minutes of reconnect, the idle timeout fires again
  • This creates an infinite loop of disconnect/reconnect cycles

Log excerpt:

"Message timeout detected - forcing reconnect"
"minutesSinceLastMessage":30
"WhatsApp Web connection closed (status 499)"
"web reconnect: connection closed"
"web reconnect: scheduling retry"

Environment

  • OpenClaw version: 2026.4.1 (also affected 2026.3.31)
  • OS: Linux (WSL2)
  • Node: 22.22.1
  • Gateway mode: local, loopback
  • Channel: WhatsApp

Related Issues

Impact

Gateway becomes effectively non-functional — continuous disconnections prevent any meaningful operation. Workaround: restart gateway to clear idle counter temporarily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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