diff --git a/extensions/mattermost/src/mattermost/monitor.ts b/extensions/mattermost/src/mattermost/monitor.ts index ef629a61f60..bea27a5d27c 100644 --- a/extensions/mattermost/src/mattermost/monitor.ts +++ b/extensions/mattermost/src/mattermost/monitor.ts @@ -1626,6 +1626,26 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {} pendingPatchText = ""; lastSentText = ""; patchSending = false; + // If the payload also has media attachments, deliver them now via the + // normal path. The patch only updates text; deliverMattermostReplyPayload + // is the only code that actually uploads/sends media (ID=2965023940). + if (payload.mediaUrls?.length || payload.mediaUrl) { + await deliverMattermostReplyPayload({ + core, + cfg, + payload: { ...payload, text: undefined }, + to, + accountId: account.accountId, + agentId: route.agentId, + replyToId: resolveMattermostReplyRootId({ + threadRootId: effectiveReplyToId, + replyToId: payload.replyToId, + }), + textLimit, + tableMode, + sendMessage: sendMessageMattermost, + }); + } return; }