Skip to content

[Bug]: Hermes can send attachment (media file) when replying in thread, but not as a direct message in channel or DM #17261

@hhuang91

Description

@hhuang91

Bug Description

When asked to send a file (e.g. a markdown file) as attachment, if Hermes replies in thread, everything works.

But, if you ask Hermes to send the file as a separate DM, or send to another channel, it will reply: MEDIA attachments were omitted for slack; native send_message media delivery is currently only supported for telegram, discord, matrix, weixin, and signal

Steps to Reproduce

  1. ask Hermes to generate a random markdown file
  2. ask Hermes to send the file to you as an attachment
  3. Hermes should reply in thread with attached file
  4. ask Hermes to send the file as attachment to another channel

Expected Behavior

Since Hermes is clearly able to send attachment through Slack, it should send attachment to another channel

Actual Behavior

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

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Slack

Debug Report

N/A
Should be easy to replicate. Will provide if requested

Operating System

Ubuntu 24.04

Python Version

3.11.15

Hermes Version

0.11.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

In-thread replies use the adapter's full media pipeline.
When the user DMs Hermes and Hermes replies inline, the gateway runs BasePlatformAdapter._process_message_background (gateway/platforms/base.py:2415-2549). That code:

  1. Calls self.extract_media(response) to find MEDIA: tags.
  2. For each file, dispatches by extension to the adapter's own send_voice / send_video / send_image_file / send_document methods.

The SlackAdapter implements all of these (gateway/platforms/slack.py:1024-1247), and they all funnel into _upload_file (slack.py:744), which calls files_upload_v2. So media uploads work in this path.

The cross-channel send_message tool uses a parallel, hand-rolled REST helper.
tools/send_message_tool.py:_send_to_platform does NOT use the adapter at all for Slack. It has explicit if platform == TELEGRAM/DISCORD/MATRIX/SIGNAL/WEIXIN branches (lines 487-557) that do call adapter media methods, but Slack falls all the way through to the generic "Non-media platforms" block at line 559. There:

  • Line 568 emits the "MEDIA attachments were omitted for slack" warning.
  • Line 577 calls _send_slack, which only POSTs to chat.postMessage (send_message_tool.py:976-986) — a JSON-only endpoint that ignores attachments by design.

Proposed Fix (optional)

A if platform == Platform.SLACK and media_files: block right after the Discord block (around line 524), that routes through the adapter's send_image_file / send_voice / send_video / send_document methods — same shape as the
Matrix/Feishu adapter-helper pattern at _send_matrix_via_adapter (line 1232) and _send_feishu (line 1421).

The Slack adapter is mostly stateless for uploads (files_upload_v2 just needs a bot token + chat_id + file path), so a thin _send_slack_via_adapter helper that does SlackAdapter.new(SlackAdapter) (mirroring how format_message is
invoked at line 462) plus a minimal client setup should be sufficient.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/slackSlack app adaptertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions