Repository navigation
fix(whatsapp): drain debounced inbound before close - #81246
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. source-reproducible: on current main, Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the scoped WhatsApp listener drain after normal maintainer review and CI; if it lands, use it to supersede the broader Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: on current main, Is this the best way to solve the issue? Yes. The listener-local drain uses the existing What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 4fdd71d1867a. |
a85b13c to
b774e28
Compare
* fix(whatsapp): drain debounced inbound before close * docs(changelog): note WhatsApp debounce close drain (cherry picked from commit 81a3de1)
* fix(whatsapp): drain debounced inbound before close * docs(changelog): note WhatsApp debounce close drain
* fix(whatsapp): drain debounced inbound before close * docs(changelog): note WhatsApp debounce close drain
* fix(whatsapp): drain debounced inbound before close * docs(changelog): note WhatsApp debounce close drain
* fix(whatsapp): drain debounced inbound before close * docs(changelog): note WhatsApp debounce close drain
* fix(whatsapp): drain debounced inbound before close * docs(changelog): note WhatsApp debounce close drain (cherry picked from commit 81a3de1)
Summary
WhatsApp batches rapid inbound messages through a debounce window. When
close()starts while a batch is still pending, OpenClaw already has those messages in memory, but the socket can be closed before the batch reaches the message handler. That means user code that replies from the debounced inbound message may run too late to use the still-open socket.This PR keeps the fix scoped to the WhatsApp listener:
messages.upserthandlers so close waits until already-received inbound work has reached the debouncerflushKey()API before closing the socketThe regression coverage proves that debounced inbound
reply()andsendMedia()calls run beforesock.end(), and that close waits for an in-flight inbound handler before draining.Verification
pnpm test extensions/whatsapp/src/monitor-inbox.behavior.test.tspnpm check:changedgit diff --check