Version tested: OpenClaw 2026.3.1, Baileys 7.0.0-rc.9
OpenClaw's inbound debounce (default 6s) can't tell if the sender is still typing. Send "Hello", start writing a long follow-up → the bot responds to "Hello" alone before you finish.
Listen for WhatsApp "composing" presence events and extend the debounce while the sender is typing.
Add touch(key, extendMs) and touchByPrefix(prefix, extendMs) to createInboundDebouncer. These reset the flush timer on an existing buffer without adding a message. extendMs temporarily overrides the debounce duration.
presenceSubscribeon each inbound message (Baileys won't send typing events without it)- LID→E164 cache — presence events arrive with WhatsApp's internal LID format, not phone numbers. Cache the mapping from inbound messages so composing events match the right debounce buffer.
presence.updatelistener — on "composing", resolve sender E164, calldebouncer.touchByPrefix(prefix, 15000). 15s covers the ~10s gap between WhatsApp composing events.- Cleanup — remove listener on socket close.
- Works for all senders.
- Normal debounce (no typing) is unchanged.
- WhatsApp sends composing events every ~10s while typing. The 15s extend timeout covers this with margin.
- The dist filenames contain hashes that may differ across OpenClaw versions. Find the equivalent files by grepping for
createInboundDebouncerandmessages.upsert. - Overwrites on
openclaw update— save your diffs and reapply.