Skip to content

fix(send_message): pass media_files to _send_feishu in _send_to_platform#14494

Open
batmanhz wants to merge 1 commit into
NousResearch:mainfrom
batmanhz:fix/feishu-send-message-media
Open

fix(send_message): pass media_files to _send_feishu in _send_to_platform#14494
batmanhz wants to merge 1 commit into
NousResearch:mainfrom
batmanhz:fix/feishu-send-message-media

Conversation

@batmanhz

Copy link
Copy Markdown

Problem

The send_message tool silently drops media attachments when targeting Feishu/Lark.

When _send_to_platform() routes to Feishu, it calls _send_feishu() without passing the media_files parameter:

# Before (line 538-539)
elif platform == Platform.FEISHU:
    result = await _send_feishu(pconfig, chat_id, chunk, thread_id=thread_id)
    # ↑ media_files not passed — media silently dropped

This affects all other platforms (Telegram, Discord, Matrix, Weixin) correctly pass media_files in their respective branches.

Fix

Pass media_files to _send_feishu(), following the same pattern as Telegram/Discord/Matrix — media is only attached to the final chunk when a message is split:

# After
elif platform == Platform.FEISHU:
    is_last = (chunk is chunks[-1])
    result = await _send_feishu(
        pconfig, chat_id, chunk,
        media_files=media_files if is_last else [],
        thread_id=thread_id,
    )

Notes

  • The _send_feishu() function already fully supports media (images, video, voice, documents) via the FeishuAdapter methods — it just wasn't being called with the parameter.
  • Normal agent responses using MEDIA: syntax were unaffected because they go through BasePlatformAdapter.extract_media() in the gateway main loop, bypassing _send_to_platform() entirely.
  • Lint check passed (syntax ok, no issues).

@batmanhz batmanhz force-pushed the fix/feishu-send-message-media branch from 65aa87c to 97cdb2e Compare April 23, 2026 09:44
_send_to_platform() was omitting media attachments when routing to
Feishu/Lark targets via the send_message tool.

Add a dedicated media-handling block for Feishu (matching the pattern
used by Telegram, Discord, and Matrix) that:
- Enumerates message chunks correctly
- Passes media_files only on the final chunk
- Returns early after processing, bypassing the generic fallback

Note: _send_feishu() already supports media via FeishuAdapter methods
(send_image_file, send_video, send_voice, send_document) — it just
wasn't being called with the media_files parameter. Normal agent
responses using MEDIA: syntax were unaffected since they go through
BasePlatformAdapter.extract_media() in the gateway main loop.
@batmanhz batmanhz force-pushed the fix/feishu-send-message-media branch from 97cdb2e to 72b0d86 Compare April 23, 2026 09:52
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter comp/tools Tool registry, model_tools, toolsets labels Apr 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #14365 — same root cause: _send_to_platform() Feishu branch missing media_files param. Also related to #10392.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants