Skip to content

Commit c9d172a

Browse files
fix(feishu): strip internal tool-trace banners from outbound text
Part of #90684 Co-authored-by: Cursor <[email protected]>
1 parent d9d6108 commit c9d172a

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

extensions/feishu/src/channel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
3333
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
3434
import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-helpers";
3535
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
36+
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
3637
import type { PluginRuntime } from "../runtime-api.js";
3738
import {
3839
inspectFeishuCredentials,
@@ -1367,6 +1368,7 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
13671368
chunker: chunkTextForOutbound,
13681369
chunkerMode: "markdown",
13691370
textChunkLimit: 4000,
1371+
sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text),
13701372
presentationCapabilities: {
13711373
supported: true,
13721374
buttons: true,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Feishu outbound must strip assistant internal tool-trace scaffolding, matching
2+
// the sibling channel fixes tracked under #90684 (Slack / Signal / Matrix /
3+
// Telegram / Google Chat / QQBot / IRC / SMS). sanitizeAssistantVisibleText
4+
// keeps markdown formatting suitable for Feishu card rendering.
5+
import { describe, expect, it } from "vitest";
6+
import { feishuPlugin } from "./channel.js";
7+
8+
describe("feishu outbound sanitizeText", () => {
9+
it("strips internal tool-trace banners before outbound delivery", () => {
10+
const text = "Done.\n⚠️ 🛠️ `search repos (agent)` failed";
11+
12+
expect(feishuPlugin.outbound?.sanitizeText?.({ text, payload: { text } })).toBe("Done.");
13+
});
14+
15+
it("preserves ordinary assistant prose while sanitizing", () => {
16+
const text = "The pipeline has 3 open deals.";
17+
18+
expect(feishuPlugin.outbound?.sanitizeText?.({ text, payload: { text } })).toBe(text);
19+
});
20+
});

0 commit comments

Comments
 (0)