惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
V
Visual Studio Blog
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MongoDB | Blog
MongoDB | Blog
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Engineering at Meta
Engineering at Meta
L
LangChain Blog
Martin Fowler
Martin Fowler
GbyAI
GbyAI
博客园 - 司徒正美

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(whatsapp): sanitize tool XML and hide configured erro...
rubencu · 2026-04-29 · via Recent Commits to openclaw:main

@@ -6,6 +6,7 @@ type CapturedReplyPayload = {

66

text?: string;

77

isReasoning?: boolean;

88

isCompactionNotice?: boolean;

9+

isError?: boolean;

910

mediaUrl?: string;

1011

mediaUrls?: string[];

1112

};

@@ -434,6 +435,39 @@ describe("whatsapp inbound dispatch", () => {

434435

expect(rememberSentText).toHaveBeenCalledTimes(4);

435436

});

436437438+

it("normalizes WhatsApp payload text before delivery and echo bookkeeping", async () => {

439+

const deliverReply = vi.fn(async () => undefined);

440+

const rememberSentText = vi.fn();

441+442+

await dispatchBufferedReply({

443+

deliverReply,

444+

rememberSentText,

445+

});

446+447+

const deliver = getCapturedDeliver();

448+

expect(deliver).toBeTypeOf("function");

449+450+

await deliver?.(

451+

{

452+

text: 'Before\n<function_calls><invoke name="web_search"><parameter name="query">x</parameter></invoke></function_calls>\nAfter',

453+

},

454+

{ kind: "final" },

455+

);

456+457+

expect(deliverReply).toHaveBeenCalledWith(

458+

expect.objectContaining({

459+

replyResult: expect.objectContaining({ text: "Before\n\nAfter" }),

460+

}),

461+

);

462+

expect(rememberSentText).toHaveBeenCalledWith(

463+

"Before\n\nAfter",

464+

expect.objectContaining({

465+

combinedBody: "hi",

466+

combinedBodySessionKey: "agent:main:whatsapp:direct:+1000",

467+

}),

468+

);

469+

});

470+437471

it("suppresses reasoning and compaction payloads before WhatsApp delivery", async () => {

438472

const deliverReply = vi.fn(async () => undefined);

439473

const rememberSentText = vi.fn();

@@ -455,6 +489,76 @@ describe("whatsapp inbound dispatch", () => {

455489

expect(rememberSentText).not.toHaveBeenCalled();

456490

});

457491492+

it("suppresses payloads that normalize to no visible WhatsApp content", async () => {

493+

const deliverReply = vi.fn(async () => undefined);

494+

const rememberSentText = vi.fn();

495+496+

await dispatchBufferedReply({

497+

deliverReply,

498+

rememberSentText,

499+

});

500+501+

const deliver = getCapturedDeliver();

502+

expect(deliver).toBeTypeOf("function");

503+504+

await deliver?.(

505+

{

506+

text: '<function_calls><invoke name="web_search"><parameter name="query">x</parameter></invoke></function_calls>',

507+

},

508+

{ kind: "final" },

509+

);

510+511+

expect(deliverReply).not.toHaveBeenCalled();

512+

expect(rememberSentText).not.toHaveBeenCalled();

513+

});

514+515+

it("suppresses error payload text when exposeErrorText is false", async () => {

516+

const deliverReply = vi.fn(async () => undefined);

517+

const rememberSentText = vi.fn();

518+519+

await dispatchBufferedReply({

520+

cfg: { channels: { whatsapp: { exposeErrorText: false } } } as never,

521+

deliverReply,

522+

rememberSentText,

523+

});

524+525+

const deliver = getCapturedDeliver();

526+

expect(deliver).toBeTypeOf("function");

527+528+

await deliver?.({ text: "provider exploded", isError: true }, { kind: "final" });

529+530+

expect(deliverReply).not.toHaveBeenCalled();

531+

expect(rememberSentText).not.toHaveBeenCalled();

532+

});

533+534+

it("honors account-level exposeErrorText overrides for error payloads", async () => {

535+

const deliverReply = vi.fn(async () => undefined);

536+

const rememberSentText = vi.fn();

537+538+

await dispatchBufferedReply({

539+

cfg: {

540+

channels: {

541+

whatsapp: {

542+

accounts: {

543+

work: { exposeErrorText: false },

544+

},

545+

},

546+

},

547+

} as never,

548+

deliverReply,

549+

rememberSentText,

550+

route: makeRoute({ accountId: "work" }),

551+

});

552+553+

const deliver = getCapturedDeliver();

554+

expect(deliver).toBeTypeOf("function");

555+556+

await deliver?.({ text: "provider exploded", isError: true }, { kind: "final" });

557+558+

expect(deliverReply).not.toHaveBeenCalled();

559+

expect(rememberSentText).not.toHaveBeenCalled();

560+

});

561+458562

it("maps WhatsApp blockStreaming=true to disableBlockStreaming=false", async () => {

459563

await dispatchBufferedReply();

460564