From f49c6a402c9305fd8ce5bc9232823b7e144b6ab2 Mon Sep 17 00:00:00 2001 From: teconomix Date: Fri, 20 Mar 2026 10:38:24 +0000 Subject: [PATCH] fix(mattermost): deliver media attachments after successful final patch (ID=2965023940) After a successful patchMattermostPost in the isFinal branch, the code returned immediately without delivering any media attachments. deliverMattermostReplyPayload is the only path that uploads/sends media, so caption+image/file/audio payloads were silently dropping the attachment whenever streaming was active and the patch succeeded. Fix: after a successful patch, check whether the payload has mediaUrls/mediaUrl. If so, call deliverMattermostReplyPayload with text=undefined to deliver only the media through the normal attachment path. --- .../mattermost/src/mattermost/monitor.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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; }