fix(whatsapp): dedupe captioned MEDIA auto-replies#78770
fix(whatsapp): dedupe captioned MEDIA auto-replies#78770mcaxtr merged 2 commits intoopenclaw:mainfrom
Conversation
|
Codex review: needs changes before merge. Summary Reproducibility: yes. source-level. Current main has a clear dispatcher path and an existing test sequence where tool media and later captioned block media with the same URL are delivered separately; the linked issue and PR proof add live WhatsApp logs/screenshots. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep dispatcher-level coalescing, but make dedupe URL-granular so only duplicate media is suppressed while non-overlapping deferred media still sends. Do we have a high-confidence way to reproduce the issue? Yes, source-level. Current main has a clear dispatcher path and an existing test sequence where tool media and later captioned block media with the same URL are delivered separately; the linked issue and PR proof add live WhatsApp logs/screenshots. Is this the best way to solve the issue? No, not yet. The dispatcher is the right seam, but the current implementation suppresses a whole deferred media payload on partial URL overlap; filtering or splitting only duplicate URLs is the safer narrow fix. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c233e813a5fa. |
a88d67d to
9571f1a
Compare
|
Clean fix for the WhatsApp captioned media dedupe issue. The pendingMediaOnlyPayloads buffer with URL overlap detection is an elegant way to avoid the empty media message before the final captioned reply. One small suggestion: consider documenting the overlap behavior in a brief code comment — future readers might wonder why media-only payloads are deferred rather than delivered immediately. Tests cover both the dedupe and the final delivery path well. LGTM. |
9571f1a to
5f520bb
Compare
5f520bb to
543596b
Compare
543596b to
1a5560b
Compare
1a5560b to
8f76756
Compare
8f76756 to
ef11b2f
Compare
ef11b2f to
e56cdd4
Compare
e56cdd4 to
dfde64a
Compare
dfde64a to
1ede151
Compare
|
Verified the duplicate-dispatch root cause independently while investigating #78767. The path does run before the final reply assembler flushes, which creates the two-send window for captioned media. The fix here is the right seam — deduplicate at the dispatch site rather than in the outbound delivery layer. CI green, approach looks solid. |
|
@mcaxtr All CI is green now |
|
Merged via squash.
Thanks @ai-hpc! |
* fix(whatsapp): dedupe captioned MEDIA auto-replies * docs: note whatsapp media directive dedupe --------- Co-authored-by: Marcus Castro <mcaxtr@openclaw.ai>
* fix(whatsapp): dedupe captioned MEDIA auto-replies * docs: note whatsapp media directive dedupe --------- Co-authored-by: Marcus Castro <mcaxtr@openclaw.ai>


Summary
MEDIA:directive twice: first as an empty media-only message, then again as the final captioned media reply.MEDIA:directive.message send --media, and legitimate tool-only/media-only replies are preserved.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
MEDIA:..., while the dispatcher lifecycle can still surface an earlier media-only payload for the same media.Regression Test Plan (if applicable)
extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts/tmp/generated.jpgis not sent when a later block payload contains the same media URL plus caption text.User-visible / Behavior Changes
WhatsApp auto-replies for captioned
MEDIA:directives now send one captioned media message instead of an empty media message followed by the same captioned media message.Diagram (if applicable)
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation: N/ARepro + Verification
Environment
default, linked and healthySteps
media/whatsapp-tests/live-media-directive.png.Sent media replyandauto-reply sent (media).Expected
Actual
Evidence
Redacted failing live log shape:
Validation:
Real behavior proof
MEDIA:directive sent the same image twice, first as empty media and then as the captioned media reply.defaultchannel, loopback Gateway, live WhatsApp direct chat.Inbound message,Sent media reply, andauto-reply sent (media).auto-reply sent (media)line after waiting.Human Verification (required)
rememberSentText.Review Conversations
Compatibility / Migration
Yes)No)No)Risks and Mitigations