Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
Version: OpenClaw 2026.4.15-beta.1 / Baileys v7.0.0-rc.9
Description:
When an agent sends a WhatsApp message proactively (using the message tool or any outbound send), a ghost chat is created on the sender's device for the same contact. The message never reaches the recipient.
Root cause:
The createWebSendApi function in send-api.ts calls toWhatsappJid(to) directly, which always builds a number@s.whatsapp.net JID — completely ignoring the LID mapping files that Baileys stores in the credentials directory (lid-mapping-{number}.json).
When WhatsApp internally uses LID for a contact, sending to @s.whatsapp.net creates a separate thread on the sender's WhatsApp Web session that is invisible to the recipient.
Affected file:
extensions/whatsapp/src/inbound/send-api.ts — createWebSendApi function, sendMessage method, line 509.
Fix:
Before calling toWhatsappJid(to), check if a lid-mapping-{digits}.json file exists in the credentials directory for that account. If found, use {lid}@lid as the JID instead of @s.whatsapp.net.
const digits = to.replace(/\D/g, "");
const lidMapPath = path.join(authDir, `lid-mapping-${digits}.json`);
let lid: string | null = null;
try { lid = JSON.parse(fs.readFileSync(lidMapPath, "utf8")); } catch {}
const jid = lid ? `${lid}@lid` : toWhatsappJid(to);
Additional issue:
After re-linking WhatsApp (new QR scan), the lid-mapping-{lid}_reverse.json files are created empty, losing the LID→PN mapping for existing contacts. These need to be preserved across re-links or repopulated from senderPn on incoming messages.
Environment:
- Server: yes (Ubuntu 24.04, Docker)
- Multiple clients on same IP: no
- Proxy: no
openclaw_bug_report_lid_mapping.pdf
Steps to reproduce
- Have an agent configured with WhatsApp (Baileys/OpenClaw)
- Receive a message from an external contact (so their LID is registered)
- Ask the agent to proactively send a message to that contact's phone number
- A ghost/duplicate chat is created on the sender's WhatsApp Web — the message never reaches the recipient
- The ghost chat is only visible on the sender's device (WhatsApp Web/Desktop), not on Android/iOS
Expected behavior
Sending a message to a contact's phone number should route to the existing conversation,
and the message should be delivered to the recipient. No duplicate or ghost chats should be created.
Actual behavior
A ghost chat is created on the sender's WhatsApp Web/Desktop for the same contact phone number.
The message appears as sent (with checkmarks) but never reaches the recipient.
The ghost chat is not visible on the recipient's device or on Android/iOS — only on the sender's WhatsApp Web session.
OpenClaw version
2026.4.15-beta.1
Operating system
Ubuntu 24.04 (Docker container)
Install method
No response
Model
anthropic/claude-haiku-4-5-20251001
Provider / routing chain
Anthropic API (direct)
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
Version: OpenClaw 2026.4.15-beta.1 / Baileys v7.0.0-rc.9
Description:
When an agent sends a WhatsApp message proactively (using the
messagetool or any outbound send), a ghost chat is created on the sender's device for the same contact. The message never reaches the recipient.Root cause:
The
createWebSendApifunction insend-api.tscallstoWhatsappJid(to)directly, which always builds anumber@s.whatsapp.netJID — completely ignoring the LID mapping files that Baileys stores in the credentials directory (lid-mapping-{number}.json).When WhatsApp internally uses LID for a contact, sending to
@s.whatsapp.netcreates a separate thread on the sender's WhatsApp Web session that is invisible to the recipient.Affected file:
extensions/whatsapp/src/inbound/send-api.ts—createWebSendApifunction,sendMessagemethod, line 509.Fix:
Before calling
toWhatsappJid(to), check if alid-mapping-{digits}.jsonfile exists in the credentials directory for that account. If found, use{lid}@lidas the JID instead of@s.whatsapp.net.Additional issue:
After re-linking WhatsApp (new QR scan), the
lid-mapping-{lid}_reverse.jsonfiles are created empty, losing the LID→PN mapping for existing contacts. These need to be preserved across re-links or repopulated fromsenderPnon incoming messages.Environment:
openclaw_bug_report_lid_mapping.pdf
Steps to reproduce
Expected behavior
Sending a message to a contact's phone number should route to the existing conversation,
and the message should be delivered to the recipient. No duplicate or ghost chats should be created.
Actual behavior
A ghost chat is created on the sender's WhatsApp Web/Desktop for the same contact phone number.
The message appears as sent (with checkmarks) but never reaches the recipient.
The ghost chat is not visible on the recipient's device or on Android/iOS — only on the sender's WhatsApp Web session.
OpenClaw version
2026.4.15-beta.1
Operating system
Ubuntu 24.04 (Docker container)
Install method
No response
Model
anthropic/claude-haiku-4-5-20251001
Provider / routing chain
Anthropic API (direct)
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response