Skip to content

Commit 3f1bf56

Browse files
committed
fix(signal): sanitize internal tool-trace lines from outbound text
Wrap the signal outbound sanitizeText hook with sanitizeAssistantVisibleText so assistant internal tool-trace scaffolding is stripped before delivery, matching the sibling channel fixes under #90684 (Telegram #95774, Google Chat #95084, IRC #97214).
1 parent 07b9349 commit 3f1bf56

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

extensions/signal/src/channel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
createDefaultChannelRuntimeState,
2323
} from "openclaw/plugin-sdk/status-helpers";
2424
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
25+
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
2526
import { resolveSignalAccount, type ResolvedSignalAccount } from "./accounts.js";
2627
import {
2728
shouldSuppressLocalSignalExecApprovalPrompt,
@@ -461,6 +462,7 @@ export const signalPlugin: ChannelPlugin<ResolvedSignalAccount, SignalProbe> =
461462
chunker: chunkText,
462463
chunkerMode: "text",
463464
textChunkLimit: 4000,
465+
sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text),
464466
shouldSuppressLocalPayloadPrompt: ({ cfg, accountId, payload, hint }) =>
465467
shouldSuppressLocalSignalExecApprovalPrompt({
466468
cfg,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Signal outbound must strip assistant internal tool-trace scaffolding, matching
2+
// the sibling channel fixes tracked under #90684 (Telegram #95774 / Google Chat
3+
// #95084 / IRC #97214). Signal is plaintext-only, so leaked traces are verbatim.
4+
import { describe, expect, it } from "vitest";
5+
import { signalPlugin } from "./channel.js";
6+
7+
describe("signal outbound sanitizeText", () => {
8+
it("strips internal tool-trace banners before outbound delivery", () => {
9+
const text = "Done.\n⚠️ 🛠️ `search repos (agent)` failed";
10+
11+
expect(signalPlugin.outbound?.sanitizeText?.({ text, payload: { text } })).toBe("Done.");
12+
});
13+
14+
it("preserves ordinary assistant prose while sanitizing", () => {
15+
const text = "The pipeline has 3 open deals.";
16+
17+
expect(signalPlugin.outbound?.sanitizeText?.({ text, payload: { text } })).toBe(text);
18+
});
19+
});

0 commit comments

Comments
 (0)