Skip to content

fix(voice): detect & self-heal a corrupt on-device STT model (6.8.12)#28

Merged
leinss merged 2 commits into
mainfrom
feature/stt-selfheal
Jul 14, 2026
Merged

fix(voice): detect & self-heal a corrupt on-device STT model (6.8.12)#28
leinss merged 2 commits into
mainfrom
feature/stt-selfheal

Conversation

@leinss

@leinss leinss commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Why

On-device dictation fails because the sherpa recognizer never constructs — the Parakeet model on disk is corrupt or predates SHA pinning. ModelStorage.isReady only 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 OfflineRecognizer at startup + every attempt).

What

  • ModelStorage.findCorruptFiles() — verifies each file against its pinned size + SHA-256 (size first, cheap reject for truncated downloads).
  • On init failure, LocalSherpaEngine verifies 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.
  • Recognizer init exception type+message now logged on the message line so it survives the in-app log export (was collapsed to [details omitted]).
  • Bump to 6.8.12.

Test plan

  • make check — 361 unit tests / 0 failures / 7 skipped, lint clean
  • Device (Play internal): dictation → if model was corrupt, it self-invalidates → re-download → dictation works
  • If it still fails, the log now shows the exact exception (corrupt vs intact verdict)

leinss added 2 commits July 14, 2026 23:31
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.
@leinss
leinss merged commit 47d86b8 into main Jul 14, 2026
@leinss
leinss deleted the feature/stt-selfheal branch July 14, 2026 21:32
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