Repository navigation
fix(voice): guard piecewise dictation against stale callbacks and hung pieces - #816
Merged
Merged
Conversation
…g pieces Tag the audio thread's posts with a per-session generation so a late post from a finished session cannot end or feed a newer one. Add a per-piece timeout (same length-based formula as the final processing timeout) so a plugin that never ends a piece's session no longer blocks later pieces.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Hardening for the "transcribe while speaking" voice mode added in v4.3.3-beta2.
Motivation & Context
Found while reviewing the beta2 voice changes:
piecewiseActive. A late post from a finished session could end or feed a newer one if a new dictation started before it ran.onSessionEnded. If it never does,pieceInFlightstays set and every later piece waits forever; the 60 s processing timeout only starts after the user stops recording.Changes Made
VoiceInputManager.kt: per-sessionpiecewiseGeneration. The audio thread tags its posts with it, the handlers ignore a mismatch, and starting or cleaning up a session bumps it.processingTimeoutForformula (at least 60 s). It is cancelled when the piece's session ends and incleanupSession. On expiry the dictation stops with the usual "Voice processing timed out" error; text already inserted stays.Verification & Testing
helium314.keyboard.latin.voice.*unit tests pass./gradlew :app:assembleStandardDebug, installed on a device, starts without a crash in logcatGuidelines Checklist