Skip to content

fix(speech): final after a held replay is flagged replay even without an original final - #299

Merged
akirilyuk merged 4 commits into
mainfrom
fix/hold-release-live-final-replay
Oct 4, 2026
Merged

akirilyuk merged 4 commits into
mainfrom
fix/hold-release-live-final-replay

Conversation

@akirilyuk

@akirilyuk akirilyuk commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Symptom

A host starts an STT hold while the user is speaking, swaps the STT, then calls releaseSttHold({ replay: true }). The final that followed was sometimes a plain user_speech_final without replay: true, so hosts treated it as a new utterance and waited on a language decision.

Cause

Only the vendor-final path honoured the pending replay context. Two other places that emit the utterance final ignored it: the last-partial fallback (finalize without a vendor final) and the forced utterance close (finalize timeout).

Change

  • One helper, emit_utterance_final, is used by all three finalize paths: vendor final, last-partial fallback, forced close. If a replay context is pending, the final is emitted with replay: true (replacesUtteranceId only when an original final existed); otherwise it is a plain final.
  • The live utterance id is cleared after the final on the fallback and forced-close paths, and for a replay final with no original.
  • The replay context is optional-id, so a release with no original final still flags replay.
  • Docs: replay field comment, STT hold section of VOICE-API.md, CHANGELOG.

Tests

stt_hold_test: held_replay_final_via_last_partial_fallback_is_flagged_replay, held_replay_final_via_forced_close_is_flagged_replay (both fail without the helper), release_replay_after_original_final_keeps_replaces_id. The replay_last_utterance path stays covered by replay_last_utterance_re_emits_final_on_new_stt_provider.

Verified locally and via CI; no extra manual steps.

🤖 Generated with Claude Code

akirilyuk and others added 4 commits October 4, 2026 20:43
… an original final

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@akirilyuk
akirilyuk merged commit 3f8a251 into main Oct 4, 2026
8 checks passed
@akirilyuk
akirilyuk deleted the fix/hold-release-live-final-replay branch October 4, 2026 14:52
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