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

推荐订阅源

美团技术团队
J
Java Code Geeks
有赞技术团队
有赞技术团队
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
IT之家
IT之家
G
Google Developers Blog
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
腾讯CDC
V
Visual Studio Blog
博客园 - 【当耐特】
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
L
LangChain Blog

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
test: dedupe whatsapp delivery mock calls · openclaw/open...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -122,7 +122,7 @@ function mockFirstReplyFailureWithWrappedError(msg: WebInboundMsg, message: stri

122122

}

123123124124

function expectFirstSendMediaPayload(msg: WebInboundMsg) {

125-

const payload = vi.mocked(msg.sendMedia).mock.calls[0]?.[0];

125+

const payload = mockCallArg(msg.sendMedia, 0, 0, "sendMedia");

126126

if (!payload) {

127127

throw new Error("expected first WhatsApp sendMedia payload");

128128

}

@@ -141,13 +141,17 @@ function mockCallArg(mock: unknown, callIndex: number, argIndex: number, label:

141141

if (!Array.isArray(calls)) {

142142

throw new Error(`expected ${label} mock calls`);

143143

}

144-

const call = calls[callIndex];

144+

const call = calls.at(callIndex);

145145

if (!call) {

146146

throw new Error(`expected ${label} call ${callIndex + 1}`);

147147

}

148148

return call[argIndex];

149149

}

150150151+

function replyText(msg: WebInboundMsg, callIndex = 0): string {

152+

return String(mockCallArg(msg.reply, callIndex, 0, "reply"));

153+

}

154+151155

function findLoggerContext(mock: unknown, message: string, label: string) {

152156

const calls = (mock as { mock?: { calls?: unknown[][] } }).mock?.calls;

153157

if (!Array.isArray(calls)) {

@@ -301,7 +305,7 @@ describe("deliverWebReply", () => {

301305

});

302306303307

expect(msg.reply).toHaveBeenCalledTimes(1);

304-

const sentText = vi.mocked(msg.reply).mock.calls[0]?.[0];

308+

const sentText = replyText(msg);

305309

expect(sentText).not.toContain("function_calls");

306310

expect(sentText).not.toContain("invoke");

307311

expect(sentText).toContain("Before");

@@ -331,7 +335,7 @@ describe("deliverWebReply", () => {

331335

});

332336333337

expect(msg.reply).toHaveBeenCalledTimes(1);

334-

expect(vi.mocked(msg.reply).mock.calls[0]?.[0]).toBe("Before\n\nAfter\n");

338+

expect(replyText(msg)).toBe("Before\n\nAfter\n");

335339

});

336340337341

it("strips legacy uppercase TOOL_CALL text before WhatsApp text delivery", async () => {

@@ -353,7 +357,7 @@ describe("deliverWebReply", () => {

353357

});

354358355359

expect(msg.reply).toHaveBeenCalledTimes(1);

356-

expect(vi.mocked(msg.reply).mock.calls[0]?.[0]).toBe("Before\n\nAfter");

360+

expect(replyText(msg)).toBe("Before\n\nAfter");

357361

});

358362359363

it("keeps quote threading on every text chunk for a threaded reply", async () => {

@@ -558,12 +562,8 @@ describe("deliverWebReply", () => {

558562

});

559563560564

expect(msg.reply).toHaveBeenCalledTimes(1);

561-

expect(

562-

String((msg.reply as unknown as { mock: { calls: unknown[][] } }).mock.calls[0]?.[0]),

563-

).toContain("⚠️ Media failed");

564-

expect(

565-

String((msg.reply as unknown as { mock: { calls: unknown[][] } }).mock.calls[0]?.[0]),

566-

).not.toContain("boom");

565+

expect(replyText(msg)).toContain("⚠️ Media failed");

566+

expect(replyText(msg)).not.toContain("boom");

567567

const warnContext = findLoggerContext(

568568

replyLogger.warn,

569569

"failed to send web media reply",

@@ -626,12 +626,8 @@ describe("deliverWebReply", () => {

626626

expect(secondPayload.mimetype).toBe("application/pdf");

627627

expect(mockCallArg(msg.sendMedia, 1, 1, "sendMedia")).toBeUndefined();

628628

expect(msg.reply).toHaveBeenCalledTimes(1);

629-

expect(

630-

String((msg.reply as unknown as { mock: { calls: unknown[][] } }).mock.calls[0]?.[0]),

631-

).toContain("⚠️ Media failed");

632-

expect(

633-

String((msg.reply as unknown as { mock: { calls: unknown[][] } }).mock.calls[0]?.[0]),

634-

).not.toContain("boom");

629+

expect(replyText(msg)).toContain("⚠️ Media failed");

630+

expect(replyText(msg)).not.toContain("boom");

635631

});

636632637633

it("sanitizes XML tool-call blocks for outbound sendPayload delivery", async () => {

@@ -651,7 +647,7 @@ describe("deliverWebReply", () => {

651647

});

652648653649

expect(sendWhatsApp).toHaveBeenCalledTimes(1);

654-

const sentText = sendWhatsApp.mock.calls[0]?.[1];

650+

const sentText = mockCallArg(sendWhatsApp, 0, 1, "sendWhatsApp");

655651

expect(sentText).not.toContain("function_calls");

656652

expect(sentText).not.toContain("invoke");

657653

expect(sentText).toContain("Before");