Skip to content

fix: do not persist a deleted speech model as the active selection#468

Open
postoso wants to merge 1 commit into
altic-dev:mainfrom
postoso:fix/delete-speech-model-race
Open

fix: do not persist a deleted speech model as the active selection#468
postoso wants to merge 1 commit into
altic-dev:mainfrom
postoso:fix/delete-speech-model-race

Conversation

@postoso

@postoso postoso commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Deleting a non-active speech model temporarily wrote the deleted model to selectedSpeechModel and restored the real selection through an un-awaited defer { Task { ... } }. If the app quit, crashed, or relaunched for an update during that window, the user was left with a model they never chose.

This routes per-model deletion through the existing ASRService.clearModelCache(for:) primitive, which clears the specific model and never mutates the selection, and drops the now-unneeded suppressSpeechProviderSync / skipNextSpeechModelSync scaffolding. It also calls checkIfModelsExistAsync() after the delete so the model cards refresh for non-active models too (the removed selection bounce had been doing that incidentally).

Adds a regression test that fails if the deleted model is ever persisted as the selection, even transiently.

Refs #467 (a separate path that can leave a user on a model they did not choose).

Deleting a non-active speech model temporarily wrote the deleted model to
selectedSpeechModel and restored the real selection through an un-awaited
defer/Task that was never awaited. If the app quit, crashed, or relaunched
for an update during that window, the user was left with a model they never
chose.

Delete the target model's cache via the existing
ASRService.clearModelCache(for:) primitive, which clears the specific model
and never mutates the selection, and drop the now-unneeded
suppressSpeechProviderSync / skipNextSpeechModelSync scaffolding. Refresh
installed-model state after the delete so the model cards reflect the removal
for non-active models too, matching the onboarding uninstall path. Add a
regression test that fails if the deleted model is ever persisted as the
selection, even transiently.
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