fix: fix tencent tts block cpu issue#2115
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| self.ten_env.log_warn( | ||
| "Not restarting TTS client due to authentication error" | ||
| ) | ||
| return |
There was a problem hiding this comment.
Auth error causes permanent hang in synthesize_audio
High Severity
When stop() returns early due to an auth error, close() clears conn_ready_event but no restart is scheduled, so the event is never set again. Any subsequent synthesize_audio() call will hang forever at await self.conn_ready_event.wait(), and the auth_error check on the very next line is unreachable. The auth error guard was clearly intended to surface an exception to callers, but it can never execute.
Additional Locations (1)
| self.ten_env.log_warn( | ||
| "Not restarting TTS client due to authentication error" | ||
| ) | ||
| return |
There was a problem hiding this comment.
Fire-and-forget restart silently hangs on new exceptions
Medium Severity
start() now raises TimeoutError and RuntimeError where it previously never raised (old wait_ready always returned without exception). However, stop() calls start() via fire-and-forget asyncio.create_task, silently swallowing these new exceptions. When a reconnect attempt fails (e.g., transient network timeout), the exception is lost, self.synthesizer stays None, and conn_ready_event is never set — causing all subsequent synthesize_audio() calls to hang forever with no recovery or error signal.


Note
Medium Risk
Changes startup and restart behavior in the Tencent TTS extension; mistakes could prevent the client from coming up or alter reconnect behavior under failure/auth-error conditions.
Overview
Prevents
TencentTTSClient.start()from blocking the asyncio event loop by offloadingsynthesizer.wait_ready()to a worker thread, and fails fast with clearer errors when startup times out or the server rejects the request.Updates the WebSocket synthesizer to set
ready_eventon synthesis failure (so callers don’t wait the full timeout), and changesstop()to skip auto-restart when an authentication error was observed. Adds regression tests covering non-blocking startup on failure and no-restart-on-auth-error, and bumps the extension version to0.4.4.Written by Cursor Bugbot for commit ff91b12. This will update automatically on new commits. Configure here.