Files
openclaw/extensions/irc/src/channel.test.ts
Masato Hoshino ddedf13190 fix(irc): sanitize internal tool-trace lines from outbound text (#97214)
* fix(irc): sanitize internal tool-trace lines from outbound text

* fix(irc): sanitize internal tool-trace lines from outbound text

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-06-27 08:34:38 -07:00

36 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Irc tests cover channel plugin behavior.
import { afterEach, describe, expect, it } from "vitest";
import { ircOutboundBaseAdapter } from "./outbound-base.js";
import { clearIrcRuntime } from "./runtime.js";
describe("irc outbound chunking", () => {
afterEach(() => {
clearIrcRuntime();
});
it("chunks outbound text without requiring IRC runtime initialization", () => {
expect(ircOutboundBaseAdapter.chunker("alpha beta", 5)).toEqual(["alpha", "beta"]);
expect(ircOutboundBaseAdapter.deliveryMode).toBe("direct");
expect(ircOutboundBaseAdapter.chunkerMode).toBe("markdown");
expect(ircOutboundBaseAdapter.textChunkLimit).toBe(350);
});
});
describe("irc outbound sanitizeText", () => {
afterEach(() => {
clearIrcRuntime();
});
it("strips internal tool-trace banners before outbound delivery", () => {
const text = "Done.\n⚠ 🛠️ `search repos (agent)` failed";
expect(ircOutboundBaseAdapter.sanitizeText({ text })).toBe("Done.");
});
it("preserves ordinary assistant prose while sanitizing", () => {
const text = "The pipeline has 3 open deals.";
expect(ircOutboundBaseAdapter.sanitizeText({ text })).toBe(text);
});
});