From 2f5d68d5f5d6100b67e0cb7d96e9d9b23c4dbf56 Mon Sep 17 00:00:00 2001 From: Daniel Hnyk Date: Mon, 9 Mar 2026 16:20:33 +0100 Subject: [PATCH] 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=) 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 --- extensions/mattermost/src/channel.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extensions/mattermost/src/channel.ts b/extensions/mattermost/src/channel.ts index 8c0504c7a5c..eeabf631893 100644 --- a/extensions/mattermost/src/channel.ts +++ b/extensions/mattermost/src/channel.ts @@ -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 =