Skip to content

Commit 856f11f

Browse files
committed
Mattermost: close reply delivery review gaps for #44021 thanks @LyleLiu666
1 parent ca3df14 commit 856f11f

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

extensions/mattermost/src/mattermost/monitor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,7 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
10021002
replyToId: trimmedPayload.replyToId,
10031003
}),
10041004
textLimit,
1005+
// The picker path already converts and trims text before capture/delivery.
10051006
tableMode: "off",
10061007
sendMessage: sendMessageMattermost,
10071008
});

extensions/mattermost/src/mattermost/reply-delivery.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,36 @@ describe("deliverMattermostReplyPayload", () => {
6060
await fs.rm(stateDir, { recursive: true, force: true });
6161
}
6262
});
63+
64+
it("forwards replyToId for text-only chunked replies", async () => {
65+
const sendMessage = vi.fn(async () => undefined);
66+
const core = {
67+
channel: {
68+
text: {
69+
convertMarkdownTables: vi.fn((text: string) => text),
70+
resolveChunkMode: vi.fn(() => "length"),
71+
chunkMarkdownTextWithMode: vi.fn(() => ["hello"]),
72+
},
73+
},
74+
} as any;
75+
76+
await deliverMattermostReplyPayload({
77+
core,
78+
cfg: {} satisfies OpenClawConfig,
79+
payload: { text: "hello" },
80+
to: "channel:town-square",
81+
accountId: "default",
82+
agentId: "agent-1",
83+
replyToId: "root-post",
84+
textLimit: 4000,
85+
tableMode: "off",
86+
sendMessage,
87+
});
88+
89+
expect(sendMessage).toHaveBeenCalledTimes(1);
90+
expect(sendMessage).toHaveBeenCalledWith("channel:town-square", "hello", {
91+
accountId: "default",
92+
replyToId: "root-post",
93+
});
94+
});
6395
});

0 commit comments

Comments
 (0)