cotabby icon indicating copy to clipboard operation
cotabby copied to clipboard

Add model download cancellation and integrity validation

Open FuJacob opened this issue 7 months ago • 1 comments

Problem

Model downloads are large, and a failed or interrupted download can leave users confused or leave partial files behind. Tabby should make download lifecycle states explicit and validate model files before trying to load them.

Goal

Add cancellation, retry, partial-file cleanup, and integrity validation for downloadable GGUF models.

Proposed Scope

  • Add a cancel action while a model download is in progress.
  • Clean up temporary or partial files when a download is cancelled or fails.
  • Keep retry behavior clear after a failed download.
  • Add expected file size and/or checksum metadata to downloadable model definitions.
  • Validate downloaded files before marking them installed.
  • Prevent the runtime from trying to load known-bad or incomplete models.
  • Surface validation failures in onboarding and Settings.

Acceptance Criteria

  • Users can cancel an active model download.
  • Cancelled downloads do not leave broken installed-model state behind.
  • Failed downloads can be retried from the same UI.
  • Downloaded files are validated before being marked installed.
  • Corrupt or incomplete files show a clear error and are not selected by the runtime.
  • Validation works for all curated downloadable models.

Open Questions

  • Should validation use checksum, expected byte size, or both?
  • Should custom user-provided GGUF files be validated or only curated downloads?
  • Should partial files be resumable later or always deleted?

FuJacob avatar Apr 21 '26 19:04 FuJacob

Closing — this is implemented. The codebase now has:

  • ModelFileValidator with size and SHA-256 validation
  • expectedSizeBytes and sha256 metadata on every DownloadableRuntimeModel
  • DownloadFileRescuer for partial/corrupt file recovery
  • Download state machine with cancel, retry, and failure handling
  • Tests covering validation and rescue paths (ModelFileValidatorTests, DownloadFileRescuerTests, DownloadOutcomeClassifierTests)

FuJacob avatar May 21 '26 06:05 FuJacob