Skip to content

fix: surface model download progress and failures - #117

Merged
karansinghgit merged 2 commits into
mainfrom
fix/model-download-feedback
Aug 18, 2026
Merged

fix: surface model download progress and failures#117
karansinghgit merged 2 commits into
mainfrom
fix/model-download-feedback

Conversation

@karansinghgit

Copy link
Copy Markdown
Owner

The bug

A user on a fresh install reported being unable to download the model recommended to them.

The RECOMMENDED FOR YOU hero is the only place the recommended model can be downloaded — AIModelsView.swift deliberately filters it out of the list below to avoid duplication. But heroAction only handled three states (installed+active, installed, everything else → a plain "Download" button), so:

  • While downloading, the hero still showed "Download". A ~2 GB Parakeet download gave zero feedback for minutes, and a second click hits the guard isDownloading[variant] != true in ModelDownloadService and silently no-ops.
  • On failure, it silently reverted to "Download". downloadError was written by the service but read by no view in the app — a Hugging Face rate limit, a dropped connection, or a full disk was completely invisible.

A third defect compounded it: Parakeet install detection was "cache dir exists and is non-empty", so a half-finished download reported as installed — the Download button disappeared for a model that could never load.

The fix

  • AIModelsView — hero carries the full state machine: live progress bar + percentage + spinner, a Cancel button, and on failure the actual reason with a "Try again" button.
  • ModelRow — download failures render as an error note on the card; the button reads "Try again".
  • ModelDownloadService
    • Parakeet detection now asks FluidAudio AsrModels.modelsExist(at:version:) whether every required file is present.
    • New userFacingMessage(for:) maps failures to actionable text (no connection / timed out / HF rate-limiting / out of disk space).
    • refreshDownloadedModels() no longer does downloadProgress.removeAll() — the screen refreshes on every appearance, which reset an in-flight download's bar to 0%. New pure mergedProgress(...) rebuilds the map in one assignment and preserves running downloads.

Testing

8 new unit tests in ModelDownloadServiceTests covering the two new pure helpers (progress merge vs. in-flight downloads, and the failure-message mapping).

Note: this was authored on a machine without Xcode, so local xcodebuild could not run — all files pass swiftc -parse and CI is the build/test gate here.

Caveat on expectations: if the original download was failing for an environmental reason (HF rate limit, flaky network, disk space), this does not make it succeed — it makes the reason visible and offers a retry that resumes from files already fetched.

The "RECOMMENDED FOR YOU" hero is the only place the recommended model can
be downloaded from — it is deliberately filtered out of the list below — but
heroAction only rendered three states, falling back to a bare "Download"
button for everything else. So a download that was already running showed no
progress at all (a second click hits the isDownloading guard and no-ops), and
a download that had failed silently reverted to "Download": downloadError was
written by the service but read by no view in the app, so a rate limit, a
dropped connection or a full disk was invisible.

- Hero now carries the full state machine: progress bar + percentage, Cancel,
  and on failure the reason plus a "Try again" button.
- ModelRow shows download failures too, and its button reads "Try again".
- Map failures to actionable text (offline / timeout / HF rate limit / out of
  disk space) instead of a raw localizedDescription.
- Detect installed Parakeet models with AsrModels.modelsExist instead of "the
  cache dir is non-empty", so a half-finished download no longer reports as
  installed and hides the Download button for a model that cannot load.
- refreshDownloadedModels() no longer wipes downloadProgress: the screen
  refreshes on every appearance, which reset a running download's bar to 0%.
@karansinghgit
karansinghgit merged commit 479445c into main Aug 18, 2026
2 checks passed
@karansinghgit
karansinghgit deleted the fix/model-download-feedback branch August 18, 2026 18:49
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