Hook plugins stop receiving events after WhatsApp reconnect (bug)
We identified a consistent issue in OpenClaw affecting hook plugins using definePluginEntry.
Behavior
- api.on("message_received") works on cold start
- After WhatsApp reconnect (status 428), zero events are delivered
- Plugin stays ready, no errors, but becomes deaf
api.on("message_received", ...)
api.on("message_sending", ...)
Key finding
The built-in whatsapp-group-jsonl hook also stops after reconnect → not a plugin bug.
Root cause (analysis)
On reconnect:
- WhatsApp channel recreates its internal client
- Event bridge to dispatcher is lost
- Hook listeners are not rebound
- No lifecycle event is exposed for plugins to re-register
Conclusion
Hooks are lost after reconnect and cannot be restored from plugin side.
Suggested fix
Ensure listeners are rebound after reconnect:
function attach(client) {
client.on("message", (m) =>
dispatcher.emit("message_received", m)
);
}
async function reconnect() {
client = await newClient();
attach(client); // critical
}
Question
Is there a planned fix or recommended way to keep hooks alive after reconnect?
⸻