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

推荐订阅源

L
LangChain Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
U
Unit 42
腾讯CDC
D
Docker
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
I
InfoQ
Jina AI
Jina AI
爱范儿
爱范儿
宝玉的分享
宝玉的分享
博客园 - Franky
G
Google Developers Blog
P
Proofpoint News Feed

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(transcription): preserve websocket session errors · o...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -224,6 +224,49 @@ describe("createRealtimeTranscriptionWebSocketSession", () => {

224224

}

225225

});

226226
227+

it("preserves connect failures when the error callback throws", async () => {

228+

vi.useFakeTimers();

229+

const previousDebugProxyEnabled = process.env.OPENCLAW_DEBUG_PROXY_ENABLED;

230+

process.env.OPENCLAW_DEBUG_PROXY_ENABLED = "1";

231+

const onError = vi.fn((_error: Error) => {

232+

throw new Error("error observer failed");

233+

});

234+

const session = createRealtimeTranscriptionWebSocketSession({

235+

providerId: "test",

236+

callbacks: { onError },

237+

url: () => new Promise<string>(() => {}),

238+

connectTimeoutMs: 10,

239+

connectTimeoutMessage: "test realtime transcription connection timeout",

240+

readyOnOpen: true,

241+

sendAudio: (audio, transport) => {

242+

transport.sendBinary(audio);

243+

},

244+

});

245+
246+

try {

247+

const connecting = session.connect();

248+

const timeoutAssertion = expect(connecting).rejects.toThrow(

249+

"test realtime transcription connection timeout",

250+

);

251+

await vi.advanceTimersByTimeAsync(10);

252+
253+

await timeoutAssertion;

254+

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

255+

expect(onError).toHaveBeenCalledTimes(1);

256+

const timeoutError = requireFirstMockArg(onError, "connect timeout error");

257+

expect(timeoutError).toBeInstanceOf(Error);

258+

expect(timeoutError.message).toBe("test realtime transcription connection timeout");

259+

} finally {

260+

session.close();

261+

if (previousDebugProxyEnabled === undefined) {

262+

delete process.env.OPENCLAW_DEBUG_PROXY_ENABLED;

263+

} else {

264+

process.env.OPENCLAW_DEBUG_PROXY_ENABLED = previousDebugProxyEnabled;

265+

}

266+

vi.useRealTimers();

267+

}

268+

});

269+
227270

it("does not open a socket when closed while async connection resolves", async () => {

228271

const seenAuthHeaders: Array<string | string[] | undefined> = [];

229272

let resolveUrl!: (url: string) => void;

@@ -309,6 +352,35 @@ describe("createRealtimeTranscriptionWebSocketSession", () => {

309352

session.close();

310353

});

311354
355+

it("keeps error callback failures inside websocket message dispatch", async () => {

356+

const server = await createRealtimeServer({ initialText: "{not json" });

357+

const onError = vi.fn((_error: Error) => {

358+

throw new Error("error observer failed");

359+

});

360+

const session = createRealtimeTranscriptionWebSocketSession({

361+

providerId: "test",

362+

callbacks: { onError },

363+

url: server.url,

364+

readyOnOpen: true,

365+

onMessage: () => {

366+

throw new Error("malformed payload should not reach provider handler");

367+

},

368+

sendAudio: (audio, transport) => {

369+

transport.sendBinary(audio);

370+

},

371+

});

372+
373+

await session.connect();

374+

await vi.waitFor(() => {

375+

expect(onError).toHaveBeenCalledTimes(1);

376+

});

377+

const parseError = requireFirstMockArg(onError, "malformed websocket json error");

378+

expect(parseError).toBeInstanceOf(Error);

379+

expect(parseError.message).toBe("Realtime transcription websocket received malformed JSON.");

380+

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

381+

session.close();

382+

});

383+
312384

it("reports pre-ready closes separately from connection timeouts", async () => {

313385

const server = await createRealtimeServer({ closeOnConnection: true });

314386

const onError = vi.fn();