Skip to content

fix(image): retry oras-go pull on transient ghcr stream drops - #12

Merged
CMGS merged 1 commit into
masterfrom
fix/oras-go-pull-retry
Jul 2, 2026
Merged

fix(image): retry oras-go pull on transient ghcr stream drops#12
CMGS merged 1 commit into
masterfrom
fix/oras-go-pull-retry

Conversation

@CMGS

@CMGS CMGS commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Why

cocoon-macos image pull <ghcr ref> failed pulling the 35G tahoe:26 with:

copy to temp: stream error: stream ID 1; PROTOCOL_ERROR; received from peer

ghcr intermittently resets the HTTP/2 stream on multi-GB blobs. The native oras-go path (#5) had no retry — the CI's pull_image got 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

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).
@CMGS
CMGS merged commit 7a859da into master Jul 2, 2026
3 checks passed
@CMGS
CMGS deleted the fix/oras-go-pull-retry branch July 2, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant