Repository navigation
fix(studio): stop showing manifest-less cache entries as downloading (#7858) - #7864
Conversation
The backend caps reported progress at 0.99 until a Studio download manifest verifies the snapshot on disk. Hugging Face cache entries created outside Studio -- or before the manifest system existed -- never have one, so they stay unverified with every byte already present, and the training-start overlay, which labels anything under 100% as Downloading, showed them as an active transfer indefinitely (42.3 MB / 42.3 MB, no worker running). The progress response already distinguishes the two: completed_bytes counts finalized blobs only, so all of them being present means nothing is in flight and the remaining gap is verification, not transfer. Carry that field through and let it settle the cached state. A resumed download, where finalized bytes can approach the total while .incomplete blobs still grow, keeps reporting progress -- which is what the 0.99 cap exists to protect. Moves the state type and coercion into their own module so the rule can be tested without mounting the overlay.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8385041ad
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| total > 0 ? Math.min(100, Math.round(ratio * 100)) : 0; | ||
| setState({ | ||
| downloadedBytes: downloaded, | ||
| completedBytes: prog.completed_bytes ?? 0, |
There was a problem hiding this comment.
Add completed_bytes to the chat progress type
In this polling path prog is typed as DownloadProgressResponse from features/chat/api/chat-api, but that interface still only declares downloaded_bytes, expected_bytes, progress, and cache_path. Since the frontend build runs tsc -b before Vite, this new prog.completed_bytes access fails typechecking whenever the overlay is compiled; add the field to the chat API response type or share the existing hub progress type.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in ccca1ea. The chat-api mirror of /api/models/download-progress was missing the field, so prog.completed_bytes would have failed tsc -b before Vite ran.
The backend has been returning it all along — compute_snapshot_progress puts completed_bytes in every return path (studio/backend/hub/services/snapshot_progress.py), and the hub download-manager's mirror of the same endpoint already declares completed_bytes: number (features/hub/download-manager/api.ts). So this was a stale copy of the response shape rather than a field I invented; I've added it with a note on what separates it from downloaded_bytes.
Worth recording why the fix reads completed_bytes and not the complete_on_disk flag sitting next to it, since that looks like the more direct signal: _snapshot_complete_on_disk returns False whenever read_manifest finds no manifest, and cache entries created outside Studio never have one — that is the 99% in #7858. Finalized bytes are the only field that distinguishes "verification is missing" from "bytes are still arriving".
The chat-api mirror of /api/models/download-progress omitted completed_bytes, so the overlay's new read of it failed tsc -b. The backend has always returned the field (studio/backend/hub/services/snapshot_progress.py), and the hub download-manager mirror of the same endpoint already declares it.
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Fixes #7858.
The problem
snapshot_progress.pyreports1.0only whencomplete_on_disksucceeds, and thatcheck requires a readable Studio download manifest. Cache entries created outside
Studio — or before the manifest system existed — never have one, so they stay
unverified and the reported fraction is capped at
0.99.The training-start overlay labels anything under 100% as Downloading, and its
cached-state coercion bailed out whenever
downloadedBytes > 0 && percent < 100.That is exactly the shape of a fully cached resource, so it sat at
Downloading — 99%forever with no worker running (reproduced withunsloth/alpaca-cleaned: 42.3 MB / 42.3 MB, no active dataset download).The fix
The progress response already carries the field that separates the two cases:
Every expected byte being finalized means nothing is in flight, so the remaining
gap is verification rather than transfer. The overlay now carries
completed_bytesthrough and lets it settle the cached state.
Crucially this keeps the case the
0.99cap exists for: on resume, finalized bytescan approach the total while
.incompleteblobs are still growing, socompletedBytes < totalBytesand the row keeps reporting progress.The state type and coercion move into
download-state.tsso the rule can beexercised without mounting the overlay; the overlay is otherwise unchanged.
Tests
studio/frontend/tests/training-start-cached-progress.test.ts— 5 cases coveringthe cached entry, the resumed download, an ordinary transfer, an uncached resource,
and a cached entry of unknown size.
Verified in both directions: with the previous guard restored the cached-entry case
fails, and the two "still downloading" cases pass either way, so the change does not
weaken the cap.
Not addressed here: #7858 also suggests surfacing "cached but unverified" as a
distinct third state. That is a UX/i18n decision rather than a bug fix, so this PR
only stops the misreport.
🤖 Generated with Claude Code