Skip to content

fix(chat): keep long dictation and listen through pauses - #461

Open
Mayaskara25 wants to merge 1 commit into
yuga-hashimoto:mainfrom
Mayaskara25:fix/voice-dictation-long-speech
Open

Mayaskara25 wants to merge 1 commit into
yuga-hashimoto:mainfrom
Mayaskara25:fix/voice-dictation-long-speech

Conversation

@Mayaskara25

Copy link
Copy Markdown

Problem. In chat dictation:

  • After about four lines the composer was cleared, and only the last part reached the model.
  • Listening stopped after about three seconds of silence.
  • Text dictated after a pause replaced the text before it.
  • Turning the microphone off and on again replaced the composer's contents.

Cause. This was confirmed with a log of recogniser events on a Samsung phone running Google's on-device recogniser (com.google.android.tts). During long speech, and when speech resumes after a pause, the recogniser keeps the session open, sends an empty partial and starts partials over for the new utterance only. Segments often end with "no match" instead of a final result, so the only record of what was said is the last partial. SpeechTranscriptAccumulator kept only completed final results, so each restart replaced earlier speech.

Fix.

  • SpeechTranscriptAccumulator moves the utterance in progress into the transcript when a partial is empty, when a partial after a pause does not continue the previous one, and when a segment ends without a final result. A final result that repeats the whole segment replaces what was kept instead of being added again.
  • Chat dictation keeps listening through silent segments (VoiceDictationPolicy, up to 8 in a row) until the user stops it. The voice assistant keeps its pause-to-submit behaviour.
  • Dictation is added to the text already in the composer instead of replacing it.

Testing. Tested on a Samsung Galaxy F41 (SM-F415F) with Codex 0.172.0 and Claude Code 2.1.332.

  • SpeechTranscriptAccumulatorTest (12 tests, one replaying the logged event sequence) and VoiceDictationPolicyTest (9 tests) pass.
  • On the device: several sentences with pauses of 3–4 seconds, and stopping and restarting the microphone, all keep the full text.

🤖 Generated with Claude Code

Dictated text was lost after a few lines, after a pause, and when the microphone was restarted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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