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

推荐订阅源

月光博客
月光博客
Microsoft Security Blog
Microsoft Security Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿
T
Tailwind CSS Blog
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
WordPress大学
WordPress大学
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
腾讯CDC
V
V2EX
Jina AI
Jina AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
B
Blog
M
MIT News - Artificial intelligence
宝玉的分享
宝玉的分享

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: tighten whatsapp audio preflight assertions · openc...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -200,6 +200,31 @@ function makeRemoveAckAfterReplyParams() {

200200

};

201201

}

202202203+

function firstTranscriptionContext(): Record<string, unknown> {

204+

const call = transcribeFirstAudioMock.mock.calls[0]?.[0] as

205+

| { ctx?: Record<string, unknown> }

206+

| undefined;

207+

if (!call?.ctx) {

208+

throw new Error("expected transcribeFirstAudio ctx");

209+

}

210+

return call.ctx;

211+

}

212+213+

function firstDispatchContext(): Record<string, unknown> {

214+

const calls = vi.mocked(dispatchWhatsAppBufferedReply).mock.calls as unknown[][];

215+

const dispatch = calls[0]?.[0] as { context?: Record<string, unknown> } | undefined;

216+

if (!dispatch?.context) {

217+

throw new Error("expected WhatsApp dispatch context");

218+

}

219+

return dispatch.context;

220+

}

221+222+

function expectContextFields(context: Record<string, unknown>, fields: Record<string, unknown>) {

223+

for (const [key, value] of Object.entries(fields)) {

224+

expect(context[key]).toEqual(value);

225+

}

226+

}

227+203228

describe("processMessage audio preflight transcription", () => {

204229

beforeEach(() => {

205230

transcribeFirstAudioMock.mockReset();

@@ -216,24 +241,20 @@ describe("processMessage audio preflight transcription", () => {

216241

await processMessage(makeParams());

217242218243

expect(transcribeFirstAudioMock).toHaveBeenCalledTimes(1);

219-

expect(transcribeFirstAudioMock).toHaveBeenCalledWith(

220-

expect.objectContaining({

221-

ctx: expect.objectContaining({

222-

AccountId: "default",

223-

From: "+15550000002",

224-

MediaPaths: ["/tmp/voice.ogg"],

225-

MediaTypes: ["audio/ogg; codecs=opus"],

226-

OriginatingChannel: "whatsapp",

227-

OriginatingTo: "+15550000002",

228-

Provider: "whatsapp",

229-

Surface: "whatsapp",

230-

To: "+15550000001",

231-

}),

232-

}),

233-

);

244+

expectContextFields(firstTranscriptionContext(), {

245+

AccountId: "default",

246+

From: "+15550000002",

247+

MediaPaths: ["/tmp/voice.ogg"],

248+

MediaTypes: ["audio/ogg; codecs=opus"],

249+

OriginatingChannel: "whatsapp",

250+

OriginatingTo: "+15550000002",

251+

Provider: "whatsapp",

252+

Surface: "whatsapp",

253+

To: "+15550000001",

254+

});

234255235-

const dispatchCall = vi.mocked(dispatchWhatsAppBufferedReply).mock.calls[0]?.[0];

236-

expect(dispatchCall?.context).toMatchObject({

256+

const context = firstDispatchContext();

257+

expectContextFields(context, {

237258

Body: "okay let's test this voice message",

238259

BodyForAgent: "okay let's test this voice message",

239260

CommandBody: "<media:audio>",

@@ -243,7 +264,7 @@ describe("processMessage audio preflight transcription", () => {

243264

});

244265

// mediaPath and mediaType must be preserved so inboundAudio detection (used by

245266

// features like messages.tts.auto: "inbound") still recognises this as audio.

246-

expect(dispatchCall?.context).toMatchObject({

267+

expectContextFields(context, {

247268

MediaPath: "/tmp/voice.ogg",

248269

MediaType: "audio/ogg; codecs=opus",

249270

});

@@ -256,8 +277,7 @@ describe("processMessage audio preflight transcription", () => {

256277257278

expect(transcribeFirstAudioMock).toHaveBeenCalledTimes(1);

258279259-

const dispatchCall = vi.mocked(dispatchWhatsAppBufferedReply).mock.calls[0]?.[0];

260-

expect(dispatchCall?.context).toMatchObject({

280+

expectContextFields(firstDispatchContext(), {

261281

Body: "<media:audio>",

262282

BodyForAgent: "<media:audio>",

263283

});

@@ -270,8 +290,7 @@ describe("processMessage audio preflight transcription", () => {

270290271291

expect(transcribeFirstAudioMock).toHaveBeenCalledTimes(1);

272292273-

const dispatchCall = vi.mocked(dispatchWhatsAppBufferedReply).mock.calls[0]?.[0];

274-

expect(dispatchCall?.context).toMatchObject({

293+

expectContextFields(firstDispatchContext(), {

275294

Body: "<media:audio>",

276295

BodyForAgent: "<media:audio>",

277296

});

@@ -305,8 +324,7 @@ describe("processMessage audio preflight transcription", () => {

305324

expect(transcribeFirstAudioMock).not.toHaveBeenCalled();

306325307326

// Body passes through as-is without a mediaType to confirm audio

308-

const dispatchCall = vi.mocked(dispatchWhatsAppBufferedReply).mock.calls[0]?.[0];

309-

expect(dispatchCall?.context).toMatchObject({

327+

expectContextFields(firstDispatchContext(), {

310328

Body: "<media:audio>",

311329

});

312330

});

@@ -318,8 +336,7 @@ describe("processMessage audio preflight transcription", () => {

318336319337

expect(shouldComputeCommandBodies).toEqual(["<media:audio>"]);

320338321-

const dispatchCall = vi.mocked(dispatchWhatsAppBufferedReply).mock.calls[0]?.[0];

322-

expect(dispatchCall?.context).toMatchObject({

339+

expectContextFields(firstDispatchContext(), {

323340

Body: "/new start a new session",

324341

BodyForAgent: "/new start a new session",

325342

CommandBody: "<media:audio>",

@@ -339,8 +356,7 @@ describe("processMessage audio preflight transcription", () => {

339356340357

expect(transcribeFirstAudioMock).not.toHaveBeenCalled();

341358342-

const dispatchCall = vi.mocked(dispatchWhatsAppBufferedReply).mock.calls[0]?.[0];

343-

expect(dispatchCall?.context).toMatchObject({

359+

expectContextFields(firstDispatchContext(), {

344360

Body: "pre-computed transcript from fan-out caller",

345361

BodyForAgent: "pre-computed transcript from fan-out caller",

346362

CommandBody: "<media:audio>",

@@ -419,8 +435,7 @@ describe("processMessage audio preflight transcription", () => {

419435

expect(transcribeFirstAudioMock).not.toHaveBeenCalled();

420436421437

// Body falls back to the original <media:audio> placeholder, not retried transcript.

422-

const dispatchCall = vi.mocked(dispatchWhatsAppBufferedReply).mock.calls[0]?.[0];

423-

expect(dispatchCall?.context).toMatchObject({

438+

expectContextFields(firstDispatchContext(), {

424439

Body: "<media:audio>",

425440

});

426441

});