← Back to PRs

#23148: fix: forward mediaLocalRoots in whatsapp plugin sendMedia

by MunemHashmi open 2026-02-22 02:28 View on GitHub →
channel: whatsapp-web size: S
Fixes #23140 ## Root cause `extensions/whatsapp/src/channel.ts` `sendMedia` was not destructuring or forwarding `mediaLocalRoots` from the outbound context, so the media validation function received `undefined` roots and fell back to defaults that excluded the agent workspace — throwing `LocalMediaAccessError`. ## Fix Add `mediaLocalRoots` to the parameter destructure and forward it to `sendMessageWhatsApp`, matching the correct implementation in `src/channels/plugins/outbound/whatsapp.ts`. ## Tests Added `extensions/whatsapp/src/channel.outbound.test.ts` with a regression test verifying `mediaLocalRoots` is forwarded on the `sendMedia` adapter path. <!-- greptile_comment --> <h3>Greptile Summary</h3> Fixed `extensions/whatsapp/src/channel.ts` `sendMedia` to forward `mediaLocalRoots` parameter to `sendMessageWhatsApp`, matching the correct implementation in `src/channels/plugins/outbound/whatsapp.ts`. Without this parameter, the media validation function received `undefined` roots and fell back to defaults that excluded the agent workspace, throwing `LocalMediaAccessError`. Added regression test to verify the parameter is properly forwarded. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The fix is a straightforward parameter forwarding issue with clear root cause analysis. The change correctly adds the missing `mediaLocalRoots` parameter to both the destructure and the forwarding call, matching the reference implementation. The regression test thoroughly validates the fix by checking both cases (with and without `mediaLocalRoots`). The code follows existing patterns and is type-safe. - No files require special attention <sub>Last reviewed commit: 34143a0</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs