openclaw - 💡(How to fix) Fix [Bug]: WhatsApp proactive outbound messages fail when socket degraded, reactive messages succeed [1 comments, 2 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#59107Fetched 2026-04-08 02:28:29
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
commented ×1labeled ×1

When the WhatsApp WebSocket connection is degraded (socket not open), proactive outbound messages sent via sessions_send frequently fail, sometimes succeed. Reactive messages (inbound-triggered replies) consistently succeed because they go through handleSendMessage which has retry logic with exponential backoff.

Root Cause

When the WhatsApp WebSocket connection is degraded (socket not open), proactive outbound messages sent via sessions_send frequently fail, sometimes succeed. Reactive messages (inbound-triggered replies) consistently succeed because they go through handleSendMessage which has retry logic with exponential backoff.

RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When the WhatsApp WebSocket connection is degraded (socket not open), proactive outbound messages sent via sessions_send frequently fail, sometimes succeed. Reactive messages (inbound-triggered replies) consistently succeed because they go through handleSendMessage which has retry logic with exponential backoff.

What "proactive" means here:

Proactive = messages initiated by sessions_send/cron/heartbeat, not triggered by an inbound message. These are outbound messages the agent sends on its own (e.g., a proactive ping to check in with the user).

Steps to reproduce

  1. WhatsApp socket in degraded state (status 499 / reconnecting)
  2. sessions_send triggers WhatsApp proactive outbound message
  3. Message frequently fails immediately (though may occasionally succeed)
  4. Inbound message during same degraded state → reply consistently succeeds

Expected behavior

Proactive outbound messages should use the same retry queue as reactive messages, so they succeed when the WhatsApp socket recovers.

Actual behavior

Proactive outbound messages fail immediately when WhatsApp socket is degraded. Reactive replies succeed consistently because they are queued and retried.

OpenClaw version

2026.3.24

Operating system

macOS 26.0.1

Install method

No response

Model

minimax-portal/minimax-m2.7 & openai-codex/gpt-5.4

Provider / routing chain

openclaw -> minimax / openai-codex

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: WhatsApp users using cron/heartbeat for outbound messages from agents Severity: Blocks workflow Frequency: Almost always (due to WhatsApp gateway instability - status 499) Consequence: Missed messages

Additional information

No response

extent analysis

TL;DR

Implement retry logic with exponential backoff for proactive outbound messages sent via sessions_send to handle WhatsApp socket degradation.

Guidance

  • Identify the current implementation of sessions_send and modify it to incorporate retry logic similar to handleSendMessage, ensuring proactive messages are queued and retried when the WhatsApp socket is degraded.
  • Verify the retry logic by simulating a degraded WhatsApp socket (status 499) and checking if proactive outbound messages are successfully sent after the socket recovers.
  • Review the existing handleSendMessage function to understand its retry mechanism and exponential backoff strategy, which can be applied to sessions_send for consistency.
  • Consider adding logging or monitoring to track the success and failure rates of proactive outbound messages, helping to identify if the implemented fix is effective.

Example

def sessions_send(message):
    # Existing implementation
    # ...

    # Proposed modification to include retry logic
    max_retries = 5
    retry_delay = 1  # initial delay in seconds
    for attempt in range(max_retries):
        try:
            # Send message via WhatsApp socket
            # ...
            break
        except SocketError:
            # Exponential backoff
            retry_delay *= 2
            time.sleep(retry_delay)
    else:
        # Handle max retries exceeded
        # ...

Notes

The provided solution assumes that the sessions_send function can be modified to include retry logic. However, without the exact implementation details of sessions_send and handleSendMessage, the example code snippet is hypothetical. The key idea is to apply a similar retry mechanism used in handleSendMessage to sessions_send.

Recommendation

Apply workaround: Implement retry logic with exponential backoff for proactive outbound messages sent via sessions_send, as this directly addresses the identified issue of messages failing when the WhatsApp socket is degraded.

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…

FAQ

Expected behavior

Proactive outbound messages should use the same retry queue as reactive messages, so they succeed when the WhatsApp socket recovers.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: WhatsApp proactive outbound messages fail when socket degraded, reactive messages succeed [1 comments, 2 participants]