#23148: fix: forward mediaLocalRoots in whatsapp plugin sendMedia
channel: whatsapp-web
size: S
Cluster:
Media Handling Improvements
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
#23627: fix(telegram,feishu): pass mediaLocalRoots through channel action a...
by rockkoca · 2026-02-22
82.7%
#23272: fix(whatsapp): forward mediaLocalRoots in extension plugin sendMedi...
by SidQin-cyber · 2026-02-22
82.6%
#20294: fix(message): thread mediaLocalRoots through channel plugin dispatch
by odrobnik · 2026-02-18
81.9%
#20186: fix(discord): thread mediaLocalRoots through reply delivery path
by pvoo · 2026-02-18
81.2%
#19171: fix(feishu): pass mediaLocalRoots to sendMediaFeishu for agent-scop...
by whiskyboy · 2026-02-17
80.2%
#9606: fix: pass fileName to WhatsApp document messages
by AytuncYildizli · 2026-02-05
79.8%
#4390: fix(whatsapp): allow media from allowlisted groups without groupAllow…
by Sarang19114 · 2026-01-30
78.7%
#20488: fix(discord): pass mediaLocalRoots to sendMessageDiscord
by olyashok · 2026-02-19
78.0%
#14795: fix: skip disabled channel plugins in cross-context messaging checks
by explainanalyze · 2026-02-12
77.5%
#22290: Fix WhatsApp reply quoted-media audio transcription resolution
by apollo-ex · 2026-02-21
77.3%