From 856f11f129f7d6a4bc8f23e8d13c786ecb871f52 Mon Sep 17 00:00:00 2001 From: Muhammed Mukhthar CM Date: Thu, 12 Mar 2026 13:58:55 +0000 Subject: [PATCH] Mattermost: close reply delivery review gaps for openclaw#44021 thanks @LyleLiu666 --- .../mattermost/src/mattermost/monitor.ts | 1 + .../src/mattermost/reply-delivery.test.ts | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/extensions/mattermost/src/mattermost/monitor.ts b/extensions/mattermost/src/mattermost/monitor.ts index 6a8ca362177..16e3bd6434a 100644 --- a/extensions/mattermost/src/mattermost/monitor.ts +++ b/extensions/mattermost/src/mattermost/monitor.ts @@ -1002,6 +1002,7 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {} replyToId: trimmedPayload.replyToId, }), textLimit, + // The picker path already converts and trims text before capture/delivery. tableMode: "off", sendMessage: sendMessageMattermost, }); diff --git a/extensions/mattermost/src/mattermost/reply-delivery.test.ts b/extensions/mattermost/src/mattermost/reply-delivery.test.ts index 758c6dce4a6..7d48e5fcfc0 100644 --- a/extensions/mattermost/src/mattermost/reply-delivery.test.ts +++ b/extensions/mattermost/src/mattermost/reply-delivery.test.ts @@ -60,4 +60,36 @@ describe("deliverMattermostReplyPayload", () => { await fs.rm(stateDir, { recursive: true, force: true }); } }); + + it("forwards replyToId for text-only chunked replies", async () => { + const sendMessage = vi.fn(async () => undefined); + const core = { + channel: { + text: { + convertMarkdownTables: vi.fn((text: string) => text), + resolveChunkMode: vi.fn(() => "length"), + chunkMarkdownTextWithMode: vi.fn(() => ["hello"]), + }, + }, + } as any; + + await deliverMattermostReplyPayload({ + core, + cfg: {} satisfies OpenClawConfig, + payload: { text: "hello" }, + to: "channel:town-square", + accountId: "default", + agentId: "agent-1", + replyToId: "root-post", + textLimit: 4000, + tableMode: "off", + sendMessage, + }); + + expect(sendMessage).toHaveBeenCalledTimes(1); + expect(sendMessage).toHaveBeenCalledWith("channel:town-square", "hello", { + accountId: "default", + replyToId: "root-post", + }); + }); });