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.
This commit is contained in:
teconomix 2026-03-20 10:38:24 +00:00
parent dff71545a6
commit f49c6a402c

View File

@ -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;
}