Summary
extensions/whatsapp/src/channel.ts line 298: sendMedia does not destructure or forward mediaLocalRoots from the outbound context. This causes assertLocalMediaAllowed to receive undefined roots, falling back to defaults that exclude the agent workspace directory.
Result: Any media file in the agent workspace (e.g. ~/workspace/image.png) fails with LocalMediaAccessError: Local media path is not under an allowed directory when sent via WhatsApp — even though getAgentScopedMediaLocalRoots correctly includes the workspace.
Fix
- sendMedia: async ({ to, text, mediaUrl, accountId, deps, gifPlayback }) => {
+ sendMedia: async ({ to, text, mediaUrl, mediaLocalRoots, accountId, deps, gifPlayback }) => {
const send = deps?.sendWhatsApp ?? getWhatsAppRuntime().channel.whatsapp.sendMessageWhatsApp;
const result = await send(to, text, {
verbose: false,
mediaUrl,
accountId: accountId ?? undefined,
gifPlayback,
+ mediaLocalRoots,
});
The core plugin at src/channels/plugins/outbound/whatsapp.ts already has the correct implementation but is unused — the extension plugin is the actual runtime adapter.
Prior Art
This is the same bug as #23140. Two fix PRs were submitted (#23148, #23272) — both were stale-bot closed without maintainer review.
Summary
extensions/whatsapp/src/channel.tsline 298:sendMediadoes not destructure or forwardmediaLocalRootsfrom the outbound context. This causesassertLocalMediaAllowedto receiveundefinedroots, falling back to defaults that exclude the agent workspace directory.Result: Any media file in the agent workspace (e.g.
~/workspace/image.png) fails withLocalMediaAccessError: Local media path is not under an allowed directorywhen sent via WhatsApp — even thoughgetAgentScopedMediaLocalRootscorrectly includes the workspace.Fix
The core plugin at
src/channels/plugins/outbound/whatsapp.tsalready has the correct implementation but is unused — the extension plugin is the actual runtime adapter.Prior Art
This is the same bug as #23140. Two fix PRs were submitted (#23148, #23272) — both were stale-bot closed without maintainer review.