Skip to content

Commit 370326f

Browse files
committed
fix(tlon): strip internal tool-trace banners from outbound text
Part of #90684 Wire sanitizeAssistantVisibleText into the tlon outbound adapter's sanitizeText hook, matching the merged sibling channel fixes (Feishu #98705, Mattermost #98693, Slack, Signal, Matrix, IRC). Without the hook, shared delivery passes internal tool-call/reasoning scaffolding verbatim to Tlon end users.
1 parent fc05a81 commit 370326f

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

extensions/tlon/src/channel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
createComputedAccountStatusAdapter,
1212
createDefaultChannelRuntimeState,
1313
} from "openclaw/plugin-sdk/status-helpers";
14+
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
1415
import { tlonChannelConfigSchema } from "./config-schema.js";
1516
import { tlonDoctor } from "./doctor.js";
1617
import { resolveTlonOutboundSessionRoute } from "./session-route.js";
@@ -64,6 +65,7 @@ const tlonConfigAdapter = createHybridChannelConfigAdapter({
6465
const tlonChannelOutbound: ChannelOutboundAdapter = {
6566
deliveryMode: "direct",
6667
textChunkLimit: 10000,
68+
sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text),
6769
resolveTarget: ({ to }) => resolveTlonOutboundTarget(to),
6870
deliveryCapabilities: {
6971
durableFinal: {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Tlon outbound must strip assistant internal tool-trace scaffolding, matching
2+
// the sibling channel fixes tracked under #90684 (Feishu / Mattermost / Slack /
3+
// Signal / Matrix / Telegram / Google Chat / QQBot / IRC / SMS).
4+
// sanitizeAssistantVisibleText keeps ordinary markdown prose intact for Tlon
5+
// chat rendering.
6+
import { describe, expect, it } from "vitest";
7+
import { tlonPlugin } from "./channel.js";
8+
9+
describe("tlon outbound sanitizeText", () => {
10+
it("strips internal tool-trace banners before outbound delivery", () => {
11+
const text = "Done.\n⚠️ 🛠️ `search repos (agent)` failed";
12+
13+
expect(tlonPlugin.outbound?.sanitizeText?.({ text, payload: { text } })).toBe("Done.");
14+
});
15+
16+
it("preserves ordinary assistant prose while sanitizing", () => {
17+
const text = "The pipeline has 3 open deals.";
18+
19+
expect(tlonPlugin.outbound?.sanitizeText?.({ text, payload: { text } })).toBe(text);
20+
});
21+
});

0 commit comments

Comments
 (0)