mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-08 06:54:24 +00:00
Agent events arrive on multiple threads concurrently. A stale event with shorter accumulated text was falsely triggering 'text diverged', causing the streaming TTS to restart with a new WebSocket — resulting in multiple simultaneous ElevenLabs connections (2-3 voices) and eventual system TTS fallback when hasReceivedAudio was false. Fix: if sentFullText.startsWith(fullText), the event is stale (we already have this text), not diverged. Accept and ignore it.