fix: recover resumable downloads after HTTP 416 - #265
Open
NgoQuocViet2001 wants to merge 1 commit into
Open
Conversation
NgoQuocViet2001
force-pushed
the
fix/resume-download-http-416
branch
from
July 23, 2026 06:54
63c1c6a to
7deedb9
Compare
Contributor
Author
|
Rebased this onto the current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.partfile triggers HTTP 416.Content-Rangebefore appending to a partial download.Why
Hugging Face/Xet can return HTTP 416 when a saved range starts at or beyond the current end of the object. Previously that left the model download stuck until the partial artifacts were removed manually.
The old downloader also appended any HTTP 206 response without validating that it belonged to the same remote object. This change records a strong ETag beside the partial and only resumes when both the validator and returned range match.
Safety properties
Validation
Rebased onto current
mainon 2026-07-23, then reran:node --test tests/localInferenceDownload.test.js— 11/11 passednode --check electron/lib/localInferenceDownload.jsnode --check electron/lib/localInference.jsnpm run build:packagesnpm run build— production Next.js build passedThe tests use local HTTP servers and real files to cover matching resume, Xet-style 416 recovery, redirects/retry exhaustion, ETag/range mismatches, interrupted replacements, output-stream failures, and response cleanup.