Skip to content

fix: fix tencent tts block cpu issue#2115

Merged
wangyoucao577 merged 1 commit into
mainfrom
dev/tencent_tts_fix
Mar 18, 2026
Merged

fix: fix tencent tts block cpu issue#2115
wangyoucao577 merged 1 commit into
mainfrom
dev/tencent_tts_fix

Conversation

@YiminW

@YiminW YiminW commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

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 offloading synthesizer.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_event on synthesis failure (so callers don’t wait the full timeout), and changes stop() 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 to 0.4.4.

Written by Cursor Bugbot for commit ff91b12. This will update automatically on new commits. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

self.ten_env.log_warn(
"Not restarting TTS client due to authentication error"
)
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Additional Locations (1)
Fix in Cursor Fix in Web

@wangyoucao577
wangyoucao577 merged commit dd48c0b into main Mar 18, 2026
36 of 37 checks passed
@wangyoucao577
wangyoucao577 deleted the dev/tencent_tts_fix branch March 18, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants