fix(voice): detect & self-heal a corrupt on-device STT model (6.8.12)#28
Merged
Conversation
The on-device recognizer fails to construct when the Parakeet model on disk is corrupt or predates SHA pinning, and isReady only checks file presence + size>0, so a broken model looks "Ready" and every transcription fails to load with no recovery path. - ModelStorage.findCorruptFiles() verifies each file against its pinned size and SHA-256 (size checked first as a cheap reject for truncated downloads). - On an init failure, LocalSherpaEngine now verifies the model: a corrupt one is deleted and marked NotDownloaded so the UI forces a fresh download (self-heal); an intact-but-unloadable model is kept and logged as a genuine incompatibility that re-downloading won't fix. - Log the recognizer init exception type + message on the message line so it survives the in-app log export (which collapses stack traces). Adds pure integrity-check unit tests.
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.
Why
On-device dictation fails because the sherpa recognizer never constructs — the Parakeet model on disk is corrupt or predates SHA pinning.
ModelStorage.isReadyonly checks file presence + size>0, so a broken model shows as "Ready" and every attempt fails to load with no recovery path (confirmed via the in-app log:Failed to initialise OfflineRecognizerat startup + every attempt).What
ModelStorage.findCorruptFiles()— verifies each file against its pinned size + SHA-256 (size first, cheap reject for truncated downloads).LocalSherpaEngineverifies the model: corrupt → delete + mark NotDownloaded (UI forces a fresh download, self-heal); intact but unloadable → keep + log as a genuine model/runtime incompatibility that re-downloading can't fix.[details omitted]).Test plan
make check— 361 unit tests / 0 failures / 7 skipped, lint clean