fix(mattermost): read replyTo param in plugin handleAction send

The Mattermost plugin's handleAction reads params.replyToId for the
send action, but the message tool passes the reply target as
params.replyTo. The core handleSendAction (message-action-runner.ts)
extracts params.replyTo into a local variable and passes it to
executeSendAction, but never writes it back onto the params object
as replyToId. Since the plugin intercepts before executeSendAction
runs, it always sees replyToId as undefined.

This causes message(replyTo=<id>) to create top-level Mattermost
posts with root_id="" instead of threaded replies.

Fix: check both params.replyToId and params.replyTo in the plugin's
send handler.

Fixes #40924
This commit is contained in:
Daniel Hnyk
2026-03-09 16:20:33 +01:00
committed by Muhammed Mukhthar CM
parent 3495563cfe
commit 2f5d68d5f5

View File

@@ -157,7 +157,15 @@ const mattermostMessageActions: ChannelMessageActionAdapter = {
}
const message = typeof params.message === "string" ? params.message : "";
const replyToId = typeof params.replyToId === "string" ? params.replyToId : undefined;
// The message tool passes the reply target as "replyTo", not "replyToId".
// handleSendAction reads params.replyTo into a local var but never writes
// it back, so the plugin handler must check both property names.
const replyToId =
typeof params.replyToId === "string"
? params.replyToId
: typeof params.replyTo === "string"
? params.replyTo
: undefined;
const resolvedAccountId = accountId || undefined;
const mediaUrl =