Skip to content

Retry version check on transient proxy failures#195

Open
jojinkb wants to merge 1 commit into
bootdotdev:mainfrom
jojinkb:fix/version-check-retry
Open

Retry version check on transient proxy failures#195
jojinkb wants to merge 1 commit into
bootdotdev:mainfrom
jojinkb:fix/version-check-retry

Conversation

@jojinkb

@jojinkb jojinkb commented Jun 15, 2026

Copy link
Copy Markdown

Fixes #196

Problem

bootdev status — and the background update check that runs on every command via version.FetchUpdateInfo — intermittently fails with:

Unable to check version status
Error: failed to fetch latest version

The failure is transient (reproduces ~1 in 4 runs on my network). Instrumenting getLatestVersion shows the real cause is a dropped connection to the Go module proxy:

Get "https://proxy.golang.org/github.com/bootdotdev/bootdev/@latest": read tcp ...:443: read: connection reset by peer

getLatestVersion has no resilience to this:

  • No retry — a single connection reset fails the whole check.
  • No effective fallback — the proxy list is [proxy.golang.org, direct], but direct is (correctly) skipped since @latest can't be fetched from it over HTTP, so proxy.golang.org is effectively the only source.
  • No timeout on http.Get, so a stalled connection can hang.
  • The underlying error is swallowed and the HTTP status is never checked, so a non-200 body (or a 200 without a Version field) is indistinguishable from a real failure, and the user only ever sees the generic message.

Fix

  • Retry each proxy up to 3 times with a short backoff before giving up — directly addresses the transient connection resets.
  • Use an http.Client with a 10s timeout instead of bare http.Get.
  • Check for HTTP 200 and reject empty-version responses.
  • Wrap the underlying error into the returned one so bootdev status surfaces the real cause instead of an opaque message.

No change in behavior on the happy path; the version string returned is identical.

Tests

Added version/version_test.go (httptest-based, no network) covering:

  • fetchLatestFromProxy: success, non-200, invalid JSON, empty version
  • fetchLatestWithRetry: recovery after a transient dropped connection

go test ./... passes locally.

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.

bootdev status intermittently fails: "failed to fetch latest version"

1 participant