Skip to content

[Bug]: Hermes Agent seems can't read attached file in Slack Connect channel #11095

@kunlabs

Description

@kunlabs

Bug Description

Hermes Agent can not read attached file in a channel with Slack Connect, as slack connect have a special file payload

https://docs.slack.dev/reference/objects/file-object/#slack_connect_files

Steps to Reproduce

  1. Setup Hermes agent with Slack
  2. In a channel with Slack Connect used, invite hermes and sent a message with file attached
  3. hermes says it does not see the file

Expected Behavior

Hermes can read/process the attached file

Actual Behavior

Hermes says it does not see the file

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Slack

Debug Report

Report     https://paste.rs/3FU7k
agent.log  https://paste.rs/qBXye

Operating System

Ubuntu 24.04

Python Version

3.11.15

Hermes Version

v0.9.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

file uploaded in Slack Connect channel have a special payload, you can see the detail in following

https://docs.slack.dev/reference/objects/file-object/#slack_connect_files

Proposed Fix (optional)

diff --git a/gateway/platforms/slack.py b/gateway/platforms/slack.py
index ba444c53..cff76c1f 100644
--- a/gateway/platforms/slack.py
+++ b/gateway/platforms/slack.py
@@ -1094,6 +1094,29 @@ class SlackAdapter(BasePlatformAdapter):
         media_types = []
         files = event.get("files", [])
         for f in files:
+            # Slack Connect channels return stub file objects with
+            # "file_access": "check_file_info" and no URL. We must call
+            # files.info to get the full object (including url_private_download).
+            if f.get("file_access") == "check_file_info":
+                file_id = f.get("id")
+                if not file_id:
+                    continue
+                try:
+                    _client = self._get_client(channel_id)
+                    _info_resp = await _client.files_info(file=file_id)
+                    if _info_resp.get("ok"):
+                        f = _info_resp["file"]
+                        logger.debug("[Slack] Resolved check_file_info stub via files.info: %s", file_id)
+                    else:
+                        logger.warning(
+                            "[Slack] files.info failed for %s: %s",
+                            file_id, _info_resp.get("error"),
+                        )
+                        continue
+                except Exception as _e:
+                    logger.warning("[Slack] files.info error for %s: %s", file_id, _e)
+                    continue
+
             mimetype = f.get("mimetype", "unknown")
             url = f.get("url_private_download") or f.get("url_private", "")
             if mimetype.startswith("image/") and url:

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

    type/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