Repository navigation
fix(fetch-model): retry completed downloads after a matching 416 - #127
Merged
portdeveloper merged 1 commit intoOct 13, 2026
Merged
Conversation
Retry a matching end-of-file range response with one full request, then validate the replacement bytes before reporting completion. Cover successful reruns and failed retries with offline regressions.
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.
What this changes
Closes #125.
A 416 response with a strictly parsed, safe
Content-Range: bytes */Nmatching a nonempty local file now permits one GET withoutRange. That retry must return 200, replaces the old bytes, and uses the existing size and optional MD5 checks. Other 416 responses still fail. The completion callback runs after verification.How I tested it
npm run buildsucceedsnpm run smokeprintsSMOKE_OKnpm test: 627 passed, no failures or skips. The downloader suite passes all 58 tests, including 31 new regressions; against the original script, 17 of these fail. An independent 44-case check also passes.The real CLI with a 33-byte loopback fixture succeeds on a completed-file rerun, replaces corrupt same-size bytes, and exits 1 without completion on a failed full retry. Tests cover strict range parsing, response-body cancellation, exact request counts and headers, ignored 416 metadata, and fallback status/stream/size/MD5 failures.
npm run smokestops at missingWDK_SEED; it did not printSMOKE_OK. No wallet, RPC or model was used for the downloader verification. The existing policy for absent or zero declared lengths is unchanged.Model / platform tested on: Linux x64, Node 22.22.2; no model is needed for this downloader change. Fork CI passes on Node 22.23.3: Linux 627 passed; Windows 626 passed, with one existing skip for trailing spaces in a policy-file path. Both platforms pass installation and build. The validation branch has identical source and tests; only its CI push trigger differs.
Scope check
Conventions
npmand did not add a globalsodium-nativeoverride..env, seeds, keys, or model weights.