From 3ce5ac922e921d5ee8bb1008068e3ff74532a115 Mon Sep 17 00:00:00 2001 From: "chenglun.hu" Date: Thu, 29 Jan 2026 09:46:24 +0800 Subject: [PATCH] fix(voice-call): log TTS errors instead of swallowing silently Fixes #2820 The `speak()` method returns `{ success: false, error }` instead of throwing on failure. Two call sites were not checking this return value, causing TTS errors to be silently swallowed: 1. `handleInboundResponse()` in webhook.ts - callers never received AI response audio 2. `continueCall()` in manager.ts - continued to "listening" state even when TTS failed Changes: - webhook.ts: Check `speak()` return value and log errors - manager.ts: Check `speak()` return value in `continueCall()` and return early on failure Co-Authored-By: Claude Opus 4.5 --- extensions/voice-call/src/manager.ts | 5 ++++- extensions/voice-call/src/webhook.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/extensions/voice-call/src/manager.ts b/extensions/voice-call/src/manager.ts index 2e2e4661b..82ed71a1a 100644 --- a/extensions/voice-call/src/manager.ts +++ b/extensions/voice-call/src/manager.ts @@ -386,7 +386,10 @@ export class CallManager { } try { - await this.speak(callId, prompt); + const speakResult = await this.speak(callId, prompt); + if (!speakResult.success) { + return { success: false, error: speakResult.error || "Failed to speak prompt" }; + } call.state = "listening"; this.persistCallRecord(call); diff --git a/extensions/voice-call/src/webhook.ts b/extensions/voice-call/src/webhook.ts index 09e96ffed..2f6e2c6df 100644 --- a/extensions/voice-call/src/webhook.ts +++ b/extensions/voice-call/src/webhook.ts @@ -352,7 +352,10 @@ export class VoiceCallWebhookServer { if (result.text) { console.log(`[voice-call] AI response: "${result.text}"`); - await this.manager.speak(callId, result.text); + const speakResult = await this.manager.speak(callId, result.text); + if (!speakResult.success) { + console.error(`[voice-call] Failed to speak: ${speakResult.error}`); + } } } catch (err) { console.error(`[voice-call] Auto-response error:`, err);