Skip to content

[Bug]: WhatsApp self-chat mode: outbound messages echo back as inbound user messages #54460

Description

@BenHuss360

Bug type

Regression (worked before, now fails)

Summary

In WhatsApp self-chat mode, the gateway's own outbound replies are echoed back by WhatsApp and processed as new inbound user messages, causing the agent to see and respond to its own output.

Steps to reproduce

1.⁠ ⁠Configure WhatsApp with ⁠ selfChatMode: true ⁠, ⁠ dmPolicy: "allowlist" ⁠, ⁠ allowFrom ⁠ including your own number
2.⁠ ⁠Send a message to the bot from the same WhatsApp number
3.⁠ ⁠Bot sends a reply via ⁠ auto-reply sent (text) ⁠
4.⁠ ⁠~100ms later, the same reply text arrives back as ⁠ inbound web message ⁠ with a new correlation ID
5.⁠ ⁠The gateway forwards it to the agent as a new user message

Expected behavior

Outbound messages sent by the gateway should be suppressed when WhatsApp echoes them back. Prior to the current session this was not observed (though self-chat mode may not have been heavily used before).

Actual behavior

Every outbound reply is echoed back as a new inbound message. Log evidence:

09:23:11.902 [web-auto-reply] auto-reply sent (text) — "That's not good..."
09:23:12.019 [web-auto-reply] inbound web message (self) — "That's not good..." [new correlationId: 3EB0F8BBCDA5A1E41F9AFE]

Messages are tagged ⁠ (self) ⁠ but not filtered. The agent receives them as user input.

OpenClaw version

2026.3.23-2

Operating system

Ubuntu 24.04 (Linux 6.8.0-94-generic x64)

Install method

npm global

Model

anthropic/claude-opus-4-6

Provider / routing chain

openclaw -> anthropic

Additional provider/model setup details

Default setup, prompt caching enabled (⁠ cacheRetention: "long" ⁠). No proxies or routers.

Logs, screenshots, and evidence

# Outbound send
09:23:11.902 [web-auto-reply] correlationId:3B015562DBEBF376648D auto-reply sent (text) "That's not good..."

# Echo arrives 117ms later as new inbound
09:23:12.019 [web-auto-reply] correlationId:3EB0F8BBCDA5A1E41F9AFE inbound web message (self): "That's not good..."

# Pattern repeats for every outbound message throughout the session
# All messages show from:+447951613159 to:+447951613159
# Baileys fromMe flag not visible in gateway-level logs

Impact and severity

•⁠ ⁠Affected: All WhatsApp self-chat mode users (personal number setup)
•⁠ ⁠Severity: Medium (does not block usage but significantly degrades experience)
•⁠ ⁠Frequency: 100% — every single outbound message echoes back
•⁠ ⁠Consequence: Wasted tokens processing echo messages, agent confusion responding to its own output, degraded conversation quality

Additional information

The ⁠ selfChatMode: true ⁠ config correctly tags all messages as ⁠ (self) ⁠, but since both real user messages and bot echoes come from the same number, the tag alone can't distinguish them. Possible fixes: (1) track recently-sent outbound message IDs/hashes and suppress matching inbound, or (2) use Baileys' ⁠ fromMe ⁠ flag on message keys to distinguish user-typed vs API-sent messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions