transport: add auto-resuming transport implementation #127
+1,772
−0
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.
This PR adds an auto-resuming
net/http.RoundTripper
implementation that wraps an underlyingnet/http.RoundTripper
and provides automatic / transparent request resumption in the case that the network is interrupted (which we run a higher risk of when downloading large GGUF blobs). The implementation is fairly conservative, only operating onGET
requests that meet certain criteria (but this includes those we use for pulls). We also support the case where the initial request is aRange
-based request, meaning that we can layer this under a future parallel pulls implementation.Note that we still need "application-layer" resumable requests, where we stage / cache partially downloaded blobs for later resumption. This PR only handles network "hiccups", not full network disconnection.
This code was almost entirely generated by GPT-5, although significant review and iteration went into it. I've also tested this with Docker Desktop pulls, though in that case I've only be able to test the happy path. However, there is an extensive test harness that validates the non-happy-path cases.
This PR doesn't "wire up" the resumable transport, that will need to happen in
main.go
indocker/model-runner
and in the Docker Desktop backend service.