From 343f859b900c22bb3ef50c3019cf13ca599a7560 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 4 May 2026 23:08:31 +0100 Subject: [PATCH] fix: preserve visible Discord labeled replies --- .../src/monitor/reply-delivery.test.ts | 25 +++++++++++++++++++ .../discord/src/monitor/reply-safety.ts | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/extensions/discord/src/monitor/reply-delivery.test.ts b/extensions/discord/src/monitor/reply-delivery.test.ts index 17fd63f6e39..100d5c46b8a 100644 --- a/extensions/discord/src/monitor/reply-delivery.test.ts +++ b/extensions/discord/src/monitor/reply-delivery.test.ts @@ -249,6 +249,31 @@ describe("deliverDiscordReply", () => { ); }); + it("does not strip ordinary visible labeled lines", async () => { + const text = [ + "Command: restart the gateway", + "Search: check recent Discord logs", + "Open: the channel status page", + "Find: the failing account", + ].join("\n"); + + await deliverDiscordReply({ + replies: [{ text }], + target: "channel:101", + token: "token", + accountId: "default", + runtime, + cfg, + textLimit: 2000, + }); + + expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith( + expect.objectContaining({ + payloads: [{ text }], + }), + ); + }); + it("passes resolved Discord formatting options as explicit delivery options", async () => { const baseCfg = { channels: { diff --git a/extensions/discord/src/monitor/reply-safety.ts b/extensions/discord/src/monitor/reply-safety.ts index 0cb0d6e7610..c4fbd389f8e 100644 --- a/extensions/discord/src/monitor/reply-safety.ts +++ b/extensions/discord/src/monitor/reply-safety.ts @@ -3,7 +3,7 @@ import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-pay import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-runtime"; const DISCORD_INTERNAL_TRACE_LINE_RE = - /^(?:>\s*)?(?:(?:📊|🛠️|📖|📝|🔍|🔎|⚙️)\s*)?(?:Session Status|Exec|Read|Edit|Write|Patch|Search|Open|Click|Find|Screenshot|Update Plan|Tool Call|Tool Result|Function Call|Shell|Command)\s*:/i; + /^(?:>\s*)?(?:📊|🛠️|📖|📝|🔍|🔎|⚙️)\s*(?:Session Status|Exec|Read|Edit|Write|Patch|Search|Open|Click|Find|Screenshot|Update Plan|Tool Call|Tool Result|Function Call|Shell|Command)\s*:/i; const DISCORD_INTERNAL_CHANNEL_LINE_RE = /^(?:>\s*)?(?:analysis|commentary|tool[-_ ]?call|tool[-_ ]?result|function[-_ ]?call|thinking|reasoning)\s*[:=]/i;