From 3282b7066c7c49e8be4d8679d0148aef6baf5483 Mon Sep 17 00:00:00 2001 From: Neri Cervin Date: Mon, 6 Apr 2026 16:32:56 -0300 Subject: [PATCH] fix(mattermost): set message type to DOCUMENT when post has file attachments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Mattermost adapter downloads file attachments correctly but never updates msg_type from TEXT to DOCUMENT. This means the document enrichment block in gateway/run.py (which requires MessageType.DOCUMENT) never executes — text files are not inlined, and the agent is never notified about attached files. The user sends a file, the adapter downloads it to the local cache, but the agent sees an empty message and responds with 'I didn't receive any file'. Set msg_type to DOCUMENT when file_ids is non-empty, matching the behavior of the Telegram and Discord adapters. --- gateway/platforms/mattermost.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gateway/platforms/mattermost.py b/gateway/platforms/mattermost.py index 7c9c2d29bac..0e689bed9c5 100644 --- a/gateway/platforms/mattermost.py +++ b/gateway/platforms/mattermost.py @@ -661,6 +661,8 @@ class MattermostAdapter(BasePlatformAdapter): msg_type = MessageType.TEXT if message_text.startswith("/"): msg_type = MessageType.COMMAND + elif file_ids: + msg_type = MessageType.DOCUMENT # Download file attachments immediately (URLs require auth headers # that downstream tools won't have).