[Bug]: CosyVoice callback errors turn partial audio into successful completion
Reproduction
On main c0a5762, instantiate the CosyVoice callback from _make_cosyvoice_callback_class(), call on_data(b"PCMPCM"), then on_error("synthesis failed") followed by on_close(). Collect get_audio_chunks() or call get_audio_response(block=True).
Actual behavior
The callback logs the error but returns the partial audio as a successful final result. With no preceding audio, the streaming path yields a normal empty final response. The caller cannot distinguish provider failure from successful completion.
Expected behavior
Retain and surface the callback error to both audio consumers, even when partial audio was received or on_close follows on_error. Clear the error when the callback is reset or reopened for a new utterance.
I can provide an offline callback regression and a focused fix. This concerns the CosyVoice WebSocket callback, separate from the previously fixed MultiModalConversation HTTP response handling. Codex-assisted investigation.
Source: agentscope-ai/agentscope