fix(image): retry oras-go pull on transient ghcr stream drops - #12
Merged
Conversation
The native oras-go pull (unlike the CI's pull_image) had no retry, so pulling a multi-GB tahoe/sequoia base from ghcr fails outright on the intermittent 'stream error ... PROTOCOL_ERROR received from peer' HTTP/2 drop. Retry the fetch+import up to 3x with backoff (mid-stream can't resume, so re-fetch).
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.
Why
cocoon-macos image pull <ghcr ref>failed pulling the 35Gtahoe:26with:ghcr intermittently resets the HTTP/2 stream on multi-GB blobs. The native oras-go path (#5) had no retry — the CI's
pull_imagegot one in #10, but the shipped binary's pull didn't. So a single transient drop aborts the whole pull.Fix
Wrap the fetch+import in a 3-attempt retry with linear backoff (10s, 20s), ctx-cancellable. Mid-stream failures can't resume, so each attempt re-fetches from the start (cloudimg's temp uses last-writer-wins, so a partial temp from a failed attempt is safe to overwrite).
Validation
gofumpt clean; build + golangci-lint (darwin & linux) 0 issues;
go test -race ./cmd/image/...green. Re-pull of tahoe:26 on 79 with the rebuilt binary follows.🤖 Generated with Claude Code