Summary
Sending local media files via the WhatsApp channel fails with LocalMediaAccessError: Local media path is not under an allowed directory even when the file is inside the agent's workspace directory.
Steps to reproduce
- Place a media file in the agent workspace (e.g. ~/workspace/sticker.webp)
- Use the message tool to send it via WhatsApp
- Observe
LocalMediaAccessError: Local media path is not under an allowed directory
Expected behavior
The file should be sent successfully since it resides within the agent's workspace directory, which is included in getAgentScopedMediaLocalRoots.
Root Cause
The WhatsApp extension plugin's sendMedia handler in extensions/whatsapp/src/channel.ts does not destructure or forward mediaLocalRoots from the outbound context to sendMessageWhatsApp. This causes loadWebMedia -> assertLocalMediaAllowed to receive localRoots as undefined, falling back to the default roots which do not include the agent workspace directory.
The core src/channels/plugins/outbound/whatsapp.ts has the correct implementation (includes mediaLocalRoots), but it is unused, the actual runtime adapter comes from the extension plugin.
OpenClaw version
2026.2.21
Operating system
Ubuntu 25.10
Impact and severity
extensions/whatsapp/src/channel.ts: outbound.sendMedia callback
Summary
Sending local media files via the WhatsApp channel fails with
LocalMediaAccessError: Local media path is not under an allowed directoryeven when the file is inside the agent's workspace directory.Steps to reproduce
LocalMediaAccessError: Local media path is not under an allowed directoryExpected behavior
The file should be sent successfully since it resides within the agent's workspace directory, which is included in getAgentScopedMediaLocalRoots.
Root Cause
The WhatsApp extension plugin's sendMedia handler in
extensions/whatsapp/src/channel.tsdoes not destructure or forwardmediaLocalRootsfrom the outbound context tosendMessageWhatsApp. This causesloadWebMedia->assertLocalMediaAllowedto receivelocalRootsasundefined, falling back to the default roots which do not include the agent workspace directory.The core
src/channels/plugins/outbound/whatsapp.tshas the correct implementation (includes mediaLocalRoots), but it is unused, the actual runtime adapter comes from the extension plugin.OpenClaw version
2026.2.21
Operating system
Ubuntu 25.10
Impact and severity
extensions/whatsapp/src/channel.ts:outbound.sendMediacallback