fix(whatsapp): deliver tool replies that include media#60968
fix(whatsapp): deliver tool replies that include media#60968mcaxtr merged 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes WhatsApp outbound delivery so that The suppression fix itself (
Confidence Score: 3/5Safe to merge with a small fix — the suppression change is correct but the visibility-check gap means tool-only-media turns report false to callers despite delivering media. The core one-line fix is right and tests confirm the deliver callback is reached for tool+media payloads. However, didQueueVisibleReply (line 317) still ignores counts.tool, so dispatchWhatsAppBufferedReply returns false for a turn whose only payload is a tool+media reply — the exact scenario this PR targets. That discrepancy in the return value is a logical gap introduced by this change and warrants addressing before landing. extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts — specifically the didQueueVisibleReply check at line 317.
|
3ec54ac to
8d8d58b
Compare
b3b8ce0 to
e1559a5
Compare
e1559a5 to
2670402
Compare
|
Merged via squash.
Thanks @adaclaw! |
Problem
WhatsApp outbound delivery suppressed every
kind === "tool"payload inshouldSuppressWhatsAppPayload, so tool results that only carried media (e.g. generated image paths) never reached WhatsApp.Solution
For tool lifecycle payloads, suppress only when
resolveSendableOutboundReplyParts(payload).hasMediais false. Text-only tool chatter stays suppressed; tool payloads with media are delivered like other media replies.Tests
inbound-dispatch.test.ts: mock deriveshasMediafrommediaUrls/mediaUrl; assert tool+media callsdeliverReply.Note on the Pi /
tool_execution_endscheduling changeWe also investigated removing
{ detach: true }fromtool_execution_endscheduling. That ordering interacts with deferredafter_tool_call/ microtask work and can race withlastToolErrorclearing (seesubscribeEmbeddedPiSessionmutating-failure test). Shipping that safely likely needs awaiting or restructuring those hooks—not included here.Verification
pnpm exec vitest run extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts(17 passed).Made with Cursor