Skip to content

fix(tts): surface post-cold-start streaming_call failures instead of dropping the delta - #3621

Merged
qbc2016 merged 2 commits into
agentscope-ai:mainfrom
konlue:fix/cosyvoice-post-cold-start-raise
Nov 2, 2026
Merged

qbc2016 merged 2 commits into
agentscope-ai:mainfrom
konlue:fix/cosyvoice-post-cold-start-raise

Conversation

@konlue

@konlue konlue commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

AgentScope Version

2.0.12dev (main @ 4acacb9)

Description

CosyVoiceModel.push() (realtime mode) silently drops the current text delta when streaming_call raises after the cold-start latch is set (src/agentscope/tts/_dashscope/_cosyvoice_model.py:286-291): the except branch returns TTSResponse(content=None) based on a recovery promise ("keep the cold-start buffer and flag intact so the next push retries it") that only holds during the cold-start phase. Once the latch is set the buffer is empty, so the failed delta exists only in _accumulated_text and is never sent — the synthesized speech silently misses words, with no error or log (#3620).

The surrounding code consistently chooses otherwise: the not self._connected guard right above raises, and _synthesize_realtime retries and eventually raises. #3535 built the cold-start failure handling this comment refers to — the post-cold-start path is its remaining gap.

Changes — the except branch now distinguishes the two phases:

  • cold-start flush failure (not self._cold_start_done): unchanged — keep the buffer and flag intact so the next push retries the whole buffered text (fix(tts): keep CosyVoice cold-start buffer when the send fails #3535 behavior preserved);
  • post-cold-start failure: raise, consistent with the _connected guard above — the caller still holds the text and can retry, instead of the delta vanishing from the synthesized speech.

How to test

New case in the existing CosyVoicePushTest (tests/tts_dashscope_test.py):

  • test_push_after_cold_start_raises_on_send_failure — fails on main (the push returns TTSResponse(content=None) and the delta vanishes), passes with this fix;
  • the existing cold-start failure test (test_push_keeps_cold_start_buffer_on_send_failure) is untouched and still passes, pinning the fix(tts): keep CosyVoice cold-start buffer when the send fails #3535 behavior.
python -m pytest tests/tts_dashscope_test.py
# 73 passed.

Fixes #3620

Checklist

  • An issue has been created for this PR
  • I have read the CONTRIBUTING.md
  • Docstrings are in Google style
  • Related documentation has been updated (e.g. links, examples, etc.) in documentation repository
  • Code is ready for review

@github-actions github-actions Bot added the pr/awaiting-review Waiting for maintainers to review this PR label Oct 31, 2026

@qbc2016 qbc2016 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions Bot removed the pr/awaiting-review Waiting for maintainers to review this PR label Nov 2, 2026
@qbc2016
qbc2016 merged commit e7f38d5 into agentscope-ai:main Nov 2, 2026
9 checks passed
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.

[Bug]: CosyVoice TTS push() silently drops the current text delta when streaming_call fails after cold start

2 participants