Skip to content

[Bug]: WhatsApp inbound handler dead after 408 reconnect cycle — watchdog detects but reconnect doesn't restore (2026.4.26 regression) #73914

Closed

Description

@legonhilltech-jpg

Summary

After upgrading to 2026.4.26 (which included WhatsApp stability improvements), the WhatsApp inbound handler enters a silent failure loop within <24 hours. The built-in watchdog correctly detects the problem (app-silent) but the 499 reconnect it triggers does not restore inbound message delivery. This persists across multiple full gateway restarts.

Related: #66920, #63855 — same symptom (silent inbound message loss with "Listening" logged), but those were filed against 2026.4.8–2026.4.14. This reports the issue persisting/regressing in 2026.4.26.

Environment

  • OpenClaw: 2026.4.26 (be8c246)
  • Node: v25.8.2
  • macOS 26.2 (arm64)
  • Two WhatsApp accounts (default + secondary), dual-account setup
  • sleep 0, disksleep 0, displaysleep 0 confirmed — not a system sleep issue

Observed Behavior

Timeline (all times UTC-4)

  1. 10:39 — Last successful inbound message received (group message on default account)
  2. 11:53 — One more inbound, then silence
  3. 12:27–12:29 — Built-in watchdog starts warning: ⚠️ web gateway heartbeat - no messages in 30+ minutes (correct detection)
  4. 13:20 — Gateway SIGTERM restart (watchdog-triggered)
  5. After 13:20 — WhatsApp connects, logs "Listening for personal WhatsApp inbound messages" on both accounts
  6. messagesHandled: 0, lastInboundAt: null — zero inbound messages processed after reconnect
  7. 15:20, 17:20, 19:20 — Three more full gateway restarts, same result each time
  8. 21:05 — Manual restart finally restored connectivity (both accounts connected)

Key log patterns

Watchdog fires correctly but reconnect does not restore inbound:

watchdogReason: "app-silent"
minutesSinceAppActivity: 120
lastInboundAt: null
messagesHandled: 0

408 disconnects still occurring throughout the day:

WhatsApp Web connection closed (status 408). Retry 1/12 in 2.37s…

Secondary account sends fail with forbidden:

failed to send via web session — err: "Error: forbidden"
No active WhatsApp Web listener (account: secondary)

After each restart, "Listening" logged but no inbound ever arrives:

[whatsapp] Listening for personal WhatsApp inbound messages.
[whatsapp] Listening for personal WhatsApp inbound messages.

(Two lines = two accounts connecting, but messagesHandled stays at 0)

Expected Behavior

  • After watchdog-triggered reconnect or gateway restart, inbound messages should be delivered
  • The 408 → reconnect cycle should fully re-register message event handlers
  • messagesHandled should increment when messages are sent to bound groups

Analysis

The new built-in watchdog (checking minutesSinceAppActivity) is a great improvement over the old behavior — it correctly identifies the stale connection. However, the reconnect path (499 → fresh connection → "Listening") appears to not fully restore the inbound message pipeline. The connection is established but the event handler registration is incomplete.

This may be the same underlying Baileys event handler registration issue from #66920/#63855 surviving the fix — the reconnect re-establishes the WebSocket but does not re-register the messages.upsert (or equivalent) listener.

Reproduction

  1. Configure dual-account WhatsApp with group allowlists
  2. Let the gateway run — 408 disconnects will occur naturally
  3. After the first app-silent watchdog cycle (~2 hours), observe that messagesHandled: 0 and lastInboundAt: null persist
  4. Send a message to a bound group — it will not appear in logs
  5. Restart gateway — connection logs "Listening" but inbound remains dead
  6. Eventually a restart may restore it (non-deterministic — took 5 restart cycles in our case)

Workaround

Repeated full gateway restarts eventually restore the connection (non-deterministic).

Activity

  1. legonhilltech-jpg commented on Apr 29, 2026

    @legonhilltech-jpg
    Author

    Update: Fresh QR re-link with wiped credentials — same result

    Completely deleted both WhatsApp credential directories (~/.openclaw/credentials/whatsapp/default/ and secondary/), stopped the gateway (unloaded LaunchAgent to prevent auto-restart), started fresh, and re-linked the primary account via QR scan.

    Result: Same behavior. Connection established, "Listening for personal WhatsApp inbound messages" logged, but inbound messages sent to a bound group do not appear in logs. Inbound message log entries are completely absent post-reconnect.

    This rules out:

    • Corrupted/stale Baileys session state
    • Cached credentials carrying over bad state from a previous version
    • Auth/key exchange issues

    The inbound message handler is simply not registering or firing on 2026.4.26, even with a completely fresh session. The issue appears to be in the plugin code itself, not in connection state.

    Additional observation: 408 churn increased dramatically

    After the upgrade to 2026.4.26, 408 disconnects are occurring every 1-3 minutes (previously ~17 min intervals). Timeline from tonight:

    21:27:02 — 408 disconnect
    21:27:08 — reconnected
    21:27:52 — 408 disconnect (44 seconds later)
    21:27:57 — reconnected
    21:28:51 — 408 disconnect
    21:28:59 — reconnected
    21:30:09 — 408 disconnect
    21:30:15 — reconnected
    

    This is far more aggressive than the pre-upgrade pattern and may be contributing to the inbound handler failure.

  2. clawsweeper commented on Apr 30, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Current main has a focused WhatsApp reconnect/liveness implementation for the reported post-408 app-silent failure path, with regression coverage and docs/changelog notes tying it to the related #63855/#66920 reports. The fix is on main but I could not verify a containing release tag, so users on v2026.4.27 or older still need a newer build.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the current plugin-owned reconnect and inbound fallback implementation on main, and ship it in the next release so 2026.4.26/v2026.4.27 users can move off the affected behavior without adding core-specific WhatsApp policy.

    Do we have a high-confidence way to reproduce the issue?

    Yes. The issue maps to an existing focused e2e reproduction that simulates a 408 reconnect followed by continued transport frames with no app-message delivery and verifies that the monitor creates another listener; the original nondeterministic live dual-account soak was not rerun here.

    Is this the best way to solve the issue?

    Yes. The current fix stays inside the WhatsApp plugin boundary, separates transport liveness from app-message silence, preserves quiet healthy sessions, adds a shorter recovery window for recently active reconnects, and adds a group metadata fallback without moving WhatsApp-specific policy into core.

    Security review:

    Security review: No PR diff was under review; this is ordinary WhatsApp runtime bug triage, not a patch security review.

    What I checked:

    Likely related people:

    • vincentkoc: Current blame for the WhatsApp reconnect controller, app-silent watchdog wiring, inbound group metadata fallback, and changelog proof lines points to Vincent Koc; the related local report also names vincentkoc on the focused WhatsApp reconnect PR trail. (role: introduced/proved current reconnect behavior; confidence: high; commits: 005eeca06f3c; files: extensions/whatsapp/src/connection-controller.ts, extensions/whatsapp/src/auto-reply/monitor.ts, extensions/whatsapp/src/inbound/monitor.ts)
    • velvet-shark: The current changelog credits @velvet-shark for the adjacent web.whatsapp.* Baileys socket timing fix that addresses repeated 408 disconnect and handshake timeout loops, which is part of the reported failure pattern. (role: adjacent 408 timing contributor; confidence: medium; files: CHANGELOG.md, extensions/whatsapp/src/socket-timing.ts, src/config/types.base.ts)

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 46888f5afbe9; fix evidence: commit 005eeca06f3c, main fix timestamp 2026-04-30T08:52:12Z.

  3. locked as resolved and limited conversation to collaborators on May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions