#19171: fix(feishu): pass mediaLocalRoots to sendMediaFeishu for agent-scoped workspaces
channel: feishu
size: XS
Cluster:
Media Handling Improvements
## Problem
The Feishu outbound adapter's `sendMedia` handler does not pass `mediaLocalRoots` from the `ChannelOutboundContext` to `sendMediaFeishu`. This causes `loadWebMedia` to use default allowed roots, which explicitly block `workspace-*` directories (a security hardening added in the media path validator).
As a result, non-default agents (e.g., agent `zxx` with workspace at `~/.openclaw/workspace-zxx/`) cannot send files via Feishu — the upload fails with:
```
Local media path is not under an allowed directory: /home/weitian/.openclaw/workspace-zxx/file.xlsx
```
Other built-in channels (Telegram, Discord, Slack, Signal, iMessage) correctly pass `mediaLocalRoots` through their outbound adapters.
## Fix
- **`outbound.ts`**: Destructure `mediaLocalRoots` from the outbound context and pass it to `sendMediaFeishu`.
- **`media.ts`**: Accept `mediaLocalRoots` in `sendMediaFeishu` params and forward it as `localRoots` to `loadWebMedia`.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR fixes the Feishu outbound adapter to correctly pass `mediaLocalRoots` from the `ChannelOutboundContext` through to `sendMediaFeishu` and then to `loadWebMedia`. Without this fix, agent-scoped workspaces (e.g., `workspace-zxx`) could not send files via Feishu because the media path validator's default allowlist explicitly blocks `workspace-*` directories.
- `outbound.ts`: Destructures `mediaLocalRoots` from the context and passes it to `sendMediaFeishu`
- `media.ts`: Accepts `mediaLocalRoots` in `sendMediaFeishu` params and forwards it as `localRoots` to `loadWebMedia`
- The change is minimal, well-scoped, and consistent with how all other built-in channels (Telegram, Discord, Slack, Signal, iMessage) handle `mediaLocalRoots`
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge — it's a minimal, well-understood bug fix that aligns Feishu with all other channel adapters.
- The change is a 2-file, ~6-line fix that threads an existing parameter (`mediaLocalRoots`) through the Feishu adapter, matching the exact same pattern used by Telegram, Discord, Slack, Signal, and iMessage. The types are correct (`readonly string[]` matches the context and `WebMediaOptions`), no new security surface is introduced, and no existing behavior changes for the default workspace.
- No files require special attention
<sub>Last reviewed commit: 1a8b9a2</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
85.6%
#20294: fix(message): thread mediaLocalRoots through channel plugin dispatch
by odrobnik · 2026-02-18
84.1%
#20186: fix(discord): thread mediaLocalRoots through reply delivery path
by pvoo · 2026-02-18
82.8%
#20488: fix(discord): pass mediaLocalRoots to sendMessageDiscord
by olyashok · 2026-02-19
80.8%
#23148: fix: forward mediaLocalRoots in whatsapp plugin sendMedia
by MunemHashmi · 2026-02-22
80.2%
#19325: feat: support messages.mediaLocalRoots for custom media directories
by deggertsen · 2026-02-17
78.5%
#22957: fix(feishu): download media from quoted messages in group chats (#2...
by echoVic · 2026-02-21
77.1%
#9817: fix(media): resolve relative paths before reading local files (#8759)
by lailoo · 2026-02-05
76.8%
#22401: fix: resolve relative media paths against workspace and fix /tmp on...
by derrickburns · 2026-02-21
76.6%
#18811: fix(media): require file extension for ambiguous MEDIA: path detection
by aldoeliacim · 2026-02-17
75.1%