Skip to content

fix(serve): prevent echo-trigger loops that break demo TTS#133

Merged
crrow merged 1 commit intomainfrom
codex/fix-demo-tts-echo-loop
Apr 9, 2026
Merged

fix(serve): prevent echo-trigger loops that break demo TTS#133
crrow merged 1 commit intomainfrom
codex/fix-demo-tts-echo-loop

Conversation

@crrow
Copy link
Copy Markdown
Contributor

@crrow crrow commented Apr 9, 2026

Summary

  • fix demo regressions where speech-recognition echo/noise could repeatedly spawn new turns and close /ws/tts before streaming started
  • replace immediate onspeechstart hard interrupt with final-text-confirmed interruption
  • add assistant-echo guards to reject recognized fragments that mirror assistant output
  • gate recognition auto-restart with an explicit run flag to avoid stop -> onend -> restart races while entering THINKING

mlx-live Comparison

mlx-live uses backend VAD-triggered interrupt and explicit interrupt events to stop playback, instead of immediate browser-side speechstart interruption:

  • interrupt_active_response in main.py
  • frontend handles {"type":"interrupt"} by clearing playback in web/index.html

This PR aligns our demo behavior with that intent by making interruption confirmation stricter and less echo-prone.

Validation

  • cargo test serve::tests -- --nocapture
  • Playwright deep baseline (deep-3477.js): binary=1 decoded=1 played=1
  • Playwright barge-in + think filter (barge-think-3477-v2.js):
    • LLM_CALLS=2
    • THINK_IN_WS_SEND=false
    • final status returns to listening…

Align the browser-side interaction model with mlx-live's interruption intent: avoid immediate cut-off on speechstart and confirm interruption on final recognition text with echo guards.\n\nThis fixes a regression where echo/noise could repeatedly trigger new turns, close TTS sockets before establishment, and make demo playback appear broken.\n\nAlso gate recognition auto-restart with an explicit run flag to avoid stop->onend restart races while transitioning into THINKING.
@crrow crrow merged commit 4efb6b5 into main Apr 9, 2026
0 of 5 checks passed
@crrow crrow deleted the codex/fix-demo-tts-echo-loop branch April 9, 2026 06:38
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.

1 participant