Conversation
Assisted-by: Codex (unspecified) Signed-off-by: Evan Lezar <elezar@nvidia.com>
| if (writtenToSink) | ||
| curl_easy_setopt(req, CURLOPT_RESUME_FROM_LARGE, writtenToSink); | ||
| resumeOffset = writtenToSink; | ||
| if (resumeOffset) |
There was a problem hiding this comment.
I haven't written a lot of cpp since university and some small envoy PRs, but I remember having the if () {} curly braces being heavily encouraged for even one-line statements. though now I'm cross-referencing against the google style guide and they're okay with it, caltech's guide is against it. as long as it lints against nix's style guide ¯_(ツ)_/¯
(it feels weird to be giving a nit: comment on code style these days, almost nostalgic)
matthewgrossman
approved these changes
Oct 2, 2026
matthewgrossman
left a comment
There was a problem hiding this comment.
makes sense to me, as you saw in the openshell PR it seems like a semi-common issue around the community so I'm almost surprised we were hitting it
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.
Personal-fork draft for sharing and human review. This is not an upstream submission.
An interrupted streaming download can deliver the entire payload and still report a transport error. Nix then resumes at the payload length, receives HTTP 416, and fails the download even though all bytes have already arrived.
This change accepts a resumed GET's 416 as completion only when libcurl reports success,
Content-Range: bytes */Nexactly matches the resume offset and streamed byte count, the response has no non-identity content encoding, and any ETags supplied on both the streamed response and the 416 agree. Missing or inconsistent length evidence still fails. Existing downstream hash validation remains in place; the change does not restart or replay bytes into the streaming sink.The regression fixture sends a chunked response without the final chunk, records the actual Range request, and supplies an expected SHA-256 hash to nix-prefetch-url. It is wired into the existing filetransfer-retry-backoff integration derivation.
Validation:
The full upstream unit/functional suites and the Hydra integration derivation have not been run.
Context: the investigation started with cache.nixos.org failures in NVIDIA/OpenShell PR 4066. The CI logs show Nix 2.35.2 retrying at offsets equal to narinfo FileSize, followed by HTTP 416. The synthetic test uses a different transport error and does not establish the cause of those original failures. Related cache report: NixOS/infra#1106.
AI assistance: Codex assisted with investigation, implementation, tests, and this description. Human review and human-authored contribution text are still required before any upstream submission under Nix's contribution policy.