Skip to content

fix(send_message): route media attachments through Feishu adapter#14892

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

fix(send_message): route media attachments through Feishu adapter#14892
lzythebset wants to merge 1 commit into
NousResearch:mainfrom
lzythebset:fix/feishu-send-message-media

Conversation

@lzythebset

Copy link
Copy Markdown

Summary

_send_feishu() in tools/send_message_tool.py already supports media_files — it routes PDFs/docs to adapter.send_document(), images to send_image_file(), and audio/video to send_voice()/send_video(), mirroring how Telegram is wired.

However, _send_to_platform() never gave Feishu a dedicated branch. Feishu messages fell into the generic "Non-media platforms" loop at L566, which calls _send_feishu(pconfig, chat_id, chunk, thread_id=...) without passing media_files. Any MEDIA:/path/... tag emitted by the model (or media supplied by the caller) triggered the warning at L542:

MEDIA attachments were omitted for feishu; native send_message media delivery is currently only supported for telegram, discord, matrix, weixin, and signal

…and only text was delivered, even though the adapter had full file-upload support.

Change

  • Add a Platform.FEISHU branch next to the existing Signal/Matrix/Discord/Telegram branches that passes media_files to _send_feishu() on the last chunk.
  • Update the omitted-media warning and the text-less media error string to list Feishu alongside the other supported platforms.

No new dependencies; reuses _send_feishu()'s existing media path. Non-Feishu platforms are unaffected.

Repro before the fix

Any Hermes agent running on Feishu that tries send_message with MEDIA:/some/file.pdf in the text — the file is dropped and the delivery result includes the "MEDIA attachments were omitted" warning.

Test plan

  • python3 -c "import ast; ast.parse(open('tools/send_message_tool.py').read())" passes.
  • Verified locally (patched install) that crypto Feishu agent can deliver a PDF via MEDIA:/root/.hermes/profiles/crypto/cache/documents/onsite_report.pdf — before the patch only the text was sent with an omitted-media warning; after the patch the PDF is uploaded and attached to the chat as a document.
  • Maintainers: please run the existing tests/gateway/test_feishu.py suite to confirm no regression; the patch only adds a dispatch branch and does not touch adapter behavior.

_send_feishu() already supports media_files via send_document /
send_image_file / send_voice / send_video, mirroring the Telegram path,
but _send_to_platform() omitted a dedicated Feishu branch. Media was
dropped into the "Non-media platforms" fallback and stripped before
reaching the adapter, so MEDIA: paths on Feishu produced a
"MEDIA attachments were omitted" warning and delivered text only.

Add a FEISHU branch parallel to Signal/Discord/Telegram that passes
media_files to _send_feishu on the last chunk, and extend the warning
and error strings to advertise Feishu alongside the other supported
platforms.
@lzythebset

Copy link
Copy Markdown
Author

Quick data point: we applied this patch (identical diff, send_message_tool.py only) to a live Hermes install driving a Feishu-facing agent, restarted the gateway, and confirmed end-to-end:

  • Before patch: an agent response containing MEDIA:/path/to/report.pdf delivered the text to Feishu and the send_message result came back with warning: "MEDIA attachments were omitted for feishu; native send_message media delivery is currently only supported for telegram, discord, matrix, weixin, and signal". The PDF was silently dropped even though the file existed on disk.
  • After patch: same agent, same MEDIA: tag — PDF is uploaded via FeishuAdapter.send_document() and lands in the chat as a file attachment, exactly how the Telegram/Discord paths already behave. send_message returns {"success": true, "platform": "feishu", ...} with no omitted-media warning.

The change only adds a dispatch branch; _send_feishu()'s media handling (image / video / voice / document by extension) was already present and unchanged. Non-Feishu platforms are untouched by this PR.

Happy to add a unit test under tests/tools/ if you'd like one before merge — let me know the style you prefer (existing tests/gateway/test_feishu.py mocks at the adapter level; tests/tools/ would mean mocking _send_feishu at the dispatcher level).

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter duplicate This issue or pull request already exists labels Apr 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #10392 — same fix: add Platform.FEISHU branch to _send_to_platform() with media_files passthrough. Also duplicates #14365, #14049, #8607, #14494.

@tipani86

Copy link
Copy Markdown

Tested the same fix path locally in a Feishu DM: routing MEDIA: attachments through _send_feishu(..., media_files=...) successfully delivered Markdown files as native Feishu attachments. +1 for getting this merged.

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

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists 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.

3 participants