Repository navigation
fix(whatsapp): normalize provider self-echo identity ownership - #117228
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 1:58 AM ET / 05:58 UTC. ClawSweeper reviewWhat this changesNormalizes WhatsApp outbound and inbound conversation identities so provider-rewritten self echoes match the existing outbound-message cache without treating group aliases as direct-chat aliases. Merge readinessKeep this PR open for protected maintainer review. The patch repairs an existing WhatsApp self-echo dedupe boundary with focused provider-normalization coverage; no discrete correctness or security defect was found in the proposed diff. Priority: P1 Review scores
Verification
How this fits togetherThe bundled WhatsApp plugin records gateway-sent message identifiers, then normalizes incoming Baileys message upserts before access control and agent work. This change makes the cache compare provider-equivalent phone and LID identities so a gateway self echo does not become new inbound work. flowchart LR
A[Gateway sends WhatsApp message] --> B[Outbound dedupe cache]
B --> C[Canonical account, identity, and message key]
D[Baileys inbound message upsert] --> E[Inbound identity normalization]
E --> F{Matches recent outbound key?}
C --> F
F -->|Yes| G[Suppress self echo]
F -->|No| H[Access control and agent work]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +164. Total +164 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one canonical dedupe-key builder at the WhatsApp provider boundary and merge after maintainer confirmation that the guarded direct-alias behavior matches the pinned Baileys contract. Do we have a high-confidence way to reproduce the issue? Yes, source inspection establishes the current-main failure shape: outbound cache keys retain raw JIDs while inbound Baileys upserts can use normalized or alternate direct-chat identities. The branch's focused scenarios exercise that boundary, but this read-only review did not run them locally. Is this the best way to solve the issue? Yes, conditionally: normalizing identity at the cache owner is narrower and more maintainable than adding downstream echo guards, and the alternate lookup is explicitly limited to direct conversations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 732c57435c98. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
WhatsApp gateway-originated messages can return as apparent new inbound messages when the provider changes their conversation identity. Device-qualified numbers, legacy
@c.usidentifiers, hosted phone/LID domains, and equivalent direct-message phone/LID aliases previously bypassed the outbound-echo cache and could trigger incorrect pairing, replies, or duplicate work.Why This Change Was Made
The existing private dedupe owner stored destination JIDs verbatim even though pinned
[email protected]normalizes incoming JIDs and exposes direct-chat aliases throughremoteJidAlt. The fix applies the provider's actual canonicalization rules at the owning boundary, narrows decoded hosted users correctly for strict TypeScript, and restricts alternate identity matching to direct conversations.User Impact
Gateway-originated WhatsApp self echoes are suppressed consistently across real provider identity representations. Account and message isolation, ordinary human-authored group commands, group participant aliases, access policy, and the existing cache lifetime remain unchanged.
Evidence
cleanMessageanddecodeMessageNode: six frozen-baseline failures become six passing final-production scenarios, including hosted PN/LID domains and direct phone/LID aliases.autoreview --max-priority P3report zero P0/P1/P2/P3 findings.tbx_01kyxvfbrdt85nfmjysfteyyrywas stopped and verified completed after the successful immutable run: https://github.com/openclaw/openclaw/actions/runs/30685210696.