fix(voice): keep on-device transcription alive across transient window-hide#26
Merged
Conversation
…w-hide A completed local (sherpa-onnx) transcription was being discarded before it committed: the lifecycle cancel path (onWindowHidden / onFinishInputView -> cancelVoiceRecordingIfCapturing) aborted the in-flight decode, so pressing the accept button closed the overlay and inserted nothing, with no error shown. - Spare an on-device transcription from the lifecycle-driven cancel so it can finish and commit (it is fast and offline). Live recording and cloud uploads still cancel on keyboard dismissal, preserving the no-stale-insert behaviour. Explicit cancel (X button) and onDestroy still abort unconditionally. - Surface a native recognizer init failure as a typed LocalModelLoadException so the user gets an actionable "re-download the model" message instead of a generic "Transcription failed"; guard the pre-warm worker against it. - Always-log a cancelled in-flight transcription so field failures are diagnosable from a release build. - Settings: the On-device models row icon rendered black in dark theme because a raster icon bypasses IconOrImage's vector-only tint path; use a tintable vector so it matches the other rows. Adds a pure unit test for the lifecycle-cancel decision and an STT case for the load-failure message mapping.
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.
What
On-device (sherpa-onnx / Parakeet) dictation showed "Recording", but pressing accept closed the overlay and inserted nothing — no error, every time, with the model marked Ready.
Root cause: the lifecycle cancel path (
onWindowHidden/onFinishInputView→cancelVoiceRecordingIfCapturing) aborted the in-flight local decode before it could commit. That abort reachedfinishTranscriptionwith no result and no error, so the overlay closed silently.Changes
VoiceInputManager.cancelForLifecycle(): a lifecycle-driven cancel no longer aborts an in-progress on-device transcription — it finishes and commits. Live recording and cloud uploads still cancel on dismiss (no stale-field insert). The X button andonDestroystill hard-cancel.LocalSherpaEngine: a native recognizer-init failure now throws a typedLocalModelLoadException(mapped to the actionable "re-download the model" message) instead of being swallowed into a generic error; the pre-warm worker is guarded against it.IconOrImage's vector-only tint); replaced with a tintable vector.Test plan
make check— 355 unit tests / 0 failures / 7 skipped, lint clean