fix(mattermost): set message type to DOCUMENT when post has file attachments

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.
This commit is contained in:
Neri Cervin
2026-04-06 16:32:56 -03:00
committed by Teknium
parent 0f9aa57069
commit 3282b7066c

View File

@@ -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).