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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
博客园_首页
博客园 - 【当耐特】
V
Visual Studio Blog
博客园 - 叶小钗
月光博客
月光博客
美团技术团队
J
Java Code Geeks
小众软件
小众软件
Y
Y Combinator Blog
博客园 - Franky
Martin Fowler
Martin Fowler
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 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
fix(openai): wait for realtime voice session readiness · ...
vincentkoc · 2026-05-04 · via Recent Commits to openclaw:main

@@ -328,18 +328,23 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

328328

onReady,

329329

});

330330

const connecting = bridge.connect();

331+

let connectResolved = false;

332+

void connecting.then(() => {

333+

connectResolved = true;

334+

});

331335

const socket = FakeWebSocket.instances[0];

332336

if (!socket) {

333337

throw new Error("expected bridge to create a websocket");

334338

}

335339336340

socket.readyState = FakeWebSocket.OPEN;

337341

socket.emit("open");

338-

await connecting;

342+

await Promise.resolve();

339343340344

bridge.sendAudio(Buffer.from("before-ready"));

341345

socket.emit("message", Buffer.from(JSON.stringify({ type: "session.created" })));

342346347+

expect(connectResolved).toBe(false);

343348

expect(onReady).not.toHaveBeenCalled();

344349

expect(parseSent(socket).map((event) => event.type)).toEqual(["session.update"]);

345350

expect(parseSent(socket)[0]?.session).toMatchObject({

@@ -349,7 +354,9 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

349354

expect(bridge.isConnected()).toBe(false);

350355351356

socket.emit("message", Buffer.from(JSON.stringify({ type: "session.updated" })));

357+

await connecting;

352358359+

expect(connectResolved).toBe(true);

353360

expect(onReady).toHaveBeenCalledTimes(1);

354361

expect(parseSent(socket).map((event) => event.type)).toEqual([

355362

"session.update",

@@ -358,6 +365,35 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

358365

expect(bridge.isConnected()).toBe(true);

359366

});

360367368+

it("rejects connection when session configuration fails before readiness", async () => {

369+

const provider = buildOpenAIRealtimeVoiceProvider();

370+

const bridge = provider.createBridge({

371+

providerConfig: { apiKey: "sk-test" }, // pragma: allowlist secret

372+

onAudio: vi.fn(),

373+

onClearAudio: vi.fn(),

374+

});

375+

const connecting = bridge.connect();

376+

const socket = FakeWebSocket.instances[0];

377+

if (!socket) {

378+

throw new Error("expected bridge to create a websocket");

379+

}

380+381+

socket.readyState = FakeWebSocket.OPEN;

382+

socket.emit("open");

383+

socket.emit(

384+

"message",

385+

Buffer.from(

386+

JSON.stringify({

387+

type: "error",

388+

error: { message: "invalid realtime session" },

389+

}),

390+

),

391+

);

392+393+

await expect(connecting).rejects.toThrow("invalid realtime session");

394+

expect(bridge.isConnected()).toBe(false);

395+

});

396+361397

it("can request PCM16 24 kHz realtime audio for Chrome command-pair bridges", async () => {

362398

const provider = buildOpenAIRealtimeVoiceProvider();

363399

const bridge = provider.createBridge({

@@ -375,6 +411,7 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

375411376412

socket.readyState = FakeWebSocket.OPEN;

377413

socket.emit("open");

414+

socket.emit("message", Buffer.from(JSON.stringify({ type: "session.updated" })));

378415

await connecting;

379416380417

expect(parseSent(socket)[0]?.session).toMatchObject({

@@ -425,8 +462,8 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

425462426463

socket.readyState = FakeWebSocket.OPEN;

427464

socket.emit("open");

428-

await connecting;

429465

socket.emit("message", Buffer.from(JSON.stringify({ type: "session.updated" })));

466+

await connecting;

430467431468

bridge.setMediaTimestamp(1000);

432469

socket.emit(

@@ -476,8 +513,8 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

476513477514

socket.readyState = FakeWebSocket.OPEN;

478515

socket.emit("open");

479-

await connecting;

480516

socket.emit("message", Buffer.from(JSON.stringify({ type: "session.updated" })));

517+

await connecting;

481518482519

const audio = Buffer.from("assistant audio");

483520

socket.emit(

@@ -525,8 +562,8 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

525562526563

socket.readyState = FakeWebSocket.OPEN;

527564

socket.emit("open");

528-

await connecting;

529565

socket.emit("message", Buffer.from(JSON.stringify({ type: "session.updated" })));

566+

await connecting;

530567531568

bridge.triggerGreeting?.("Say exactly: hello from explicit speech.");

532569