Repository navigation
fix(whatsapp): release deferred ingress lane so debounce merges same-chat bursts (#119382) - #119425
licheer-zte wants to merge 1 commit into
Conversation
…chat bursts A deferred claim means the message is sitting in the channel debounce window, not that the conversation lane is busy. WhatsApp inherited the core drain's default deferredLaneOccupancy="hold", so while message 1 waited in the debounce window the per-conversation lane stayed owned and message 2 from the same chat was blocked. Each message then entered a fresh, empty window and paid the full debounceMs, so a burst of N messages became N turns instead of one merged turn (regression of openclaw#101335 on WhatsApp after it moved to the shared durable-ingress drain). Mirror Telegram's deferredLaneOccupancy="release" opt-in so same-chat messages can reach the debouncer and merge.
|
Codex review: needs real behavior proof before merge. Reviewed August 5, 2026, 7:32 AM ET / 11:32 UTC. ClawSweeper reviewWhat this changesThe PR releases WhatsApp’s durable per-chat ingress lane after deferred dispatch so same-chat messages can join the configured inbound debounce window. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 7 items remain Keep this PR open, but it is not ready to merge: the monitor-wide lane release also admits same-chat messages while a non-debounced reply remains deferred, contradicting an existing WhatsApp integration contract. Priority: P2 Review scores
Verification
How this fits togetherWhatsApp inbound events enter a durable queue and are drained one chat at a time before reaching the inbound debouncer or reply pipeline. A deferred claim remains durable until adoption, while lane occupancy controls whether later messages from that chat can enter. flowchart LR
A[WhatsApp inbound message] --> B[Durable ingress queue]
B --> C[Per-chat ingress lane]
C --> D{Deferred work type}
D --> E[Debounce merge window]
D --> F[Active reply handoff]
E --> G[Merged reply turn]
F --> H[Serialized follow-up delivery]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +5, Tests +2. Total +7 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Represent lane release as a per-deferred-message outcome, releasing only a message actually held in the debounce buffer while retaining serialization for a deferred active reply; cover both paths and show a redacted burst result. Do we have a high-confidence way to reproduce the issue? Yes, from source: the existing non-debounced integration scenario defers its first reply, and the proposed all-deferred lane release makes core admit the second same-chat claim before adoption. Is this the best way to solve the issue? No: a monitor-wide release is too broad because deferred active replies and deferred debounce buffers have different ordering contracts; lane release must be tied to actual buffering. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 80da61668eb6. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
@clawsweeper re-review — real behavior proof and CI status evidence were added to the PR body and the |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(whatsapp): release deferred ingress lane so debounce merges same-chat bursts (#119382) This is item 1/3 in the current shard. Shard 44/45. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Closing: ClawSweeper requires after-fix real behavior proof through the live WhatsApp ingress boundary before merge, and the patrol environment has no WhatsApp runtime. The required real-environment evidence cannot be produced here. Reopen or resubmit with WhatsApp runtime evidence when available. |
What Problem This Solves
messages.inbound.byChannel.whatsappdebounce never merges same-chat bursts: every message becomes its own turn and each one pays the fulldebounceMswindow. This is #101335 again, on a different channel — WhatsApp moved to the shared durable-ingress drain in 2026.7.2 and inherited the core drain's defaultdeferredLaneOccupancy: "hold", while Telegram was fixed by opting into"release".Why
When WhatsApp dispatch enqueues into the debouncer and returns
"deferred", the message is sitting in the merge window — the turn is not adopted yet. But with the default"hold"occupancy, the core drain keeps owning the per-conversation lane (laneKey: remoteJid) untilonAdoptedfires after the debounce flush. The start loop then refuses to admit message 2 from the same chat (laneOwnerByKey.get(laneKey)is still active), so message 2 enters a fresh, empty window and waits the fulldebounceMsagain. The debouncer (which merges correctly in isolation) and the per-conversation lane lock are mutually exclusive as wired: the precondition for a merge (≥2 messages inside one window) can never be met.User Impact
Users on WhatsApp with inbound debounce configured get N separate turns spaced
debounceMsapart instead of one merged turn per burst, and the first reply is later than with the debouncer disabled. The lane is released the moment a message defers, so a burst can accumulate in the debounce window and flush as a single turn — matching the Telegram behavior after #101335's fix.Evidence
src/channels/message/ingress-drain.ts:501-506— withdeferredLaneOccupancy === "release",onDeferreddeletes the lane owner and clearsoccupiesLane, freeing the conversation lane while the claim stays held for debounce adoption. WhatsApp'screateWhatsAppIngressMonitor(extensions/whatsapp/src/inbound/durable-receive.ts) passed nodeferredLaneOccupancy, so?? "hold"applied.extensions/whatsapp/src/inbound/durable-receive.tsnow passesdeferredLaneOccupancy: "release"in the monitor'sdrainoptions — the identical opt-in Telegram uses (extensions/telegram/src/telegram-ingress-drain.ts:391).extensions/whatsapp/src/inbound/durable-receive.test.ts— the previous test asserted the buggy behavior ("keeps a second same-lane message pending until the first turn adopts"); it now asserts both same-lane messages reach the dispatcher while the first is deferred (expect(dispatched).toEqual(["msg-4a", "msg-4b"])), proving a burst can land inside one debounce window. Run:npx vitest run extensions/whatsapp/src/inbound/durable-receive.test.ts→ 9/9 passed.Production delta: +5 lines (one option + explanatory comment), 0 cross-module changes.
[AI-assisted]
Local verification
extensions/whatsapp/src/inbound/durable-receive.test.tsto assert both same-lane messages reach the dispatch queue underdeferredLaneOccupancy: "release"(matches the Telegram opt-in from Telegram: per-chat lane serialization (isolated ingress) starves messages.queue.collect — same-chat bursts never coalesce #101335's fix).