Skip to content

fix(native): let slow uv downloads finish; report every source failure - #66

Merged
RockChinQ merged 1 commit into
mainfrom
fix/uv-download-stall-timeout
Nov 20, 2026
Merged

RockChinQ merged 1 commit into
mainfrom
fix/uv-download-stall-timeout

Conversation

@RockChinQ

Copy link
Copy Markdown
Member

Problem

In the 24h to 2026-11-20 (stability patrol LANG-612), 5 of 17 real Windows installs on v0.6.0 failed at download_uv:

  • 3 recorded as interrupted with context deadline exceeded (Client.Timeout … while reading body).
  • 2 recorded as server with a GitHub wsarecv timeout. In both of these the mirror had been tried first (region=cn).

The network diagnostics show download.langbot.app/tools/uv/... answering 200 in 0.8–2.8s for most of them. The ~20 MB archive simply did not finish within http.Client{Timeout: 3 * time.Minute}, which is a whole-request deadline. Then:

  • the GitHub fallback timed out as well;
  • its error overwrote the mirror's, so the log never said why the mirror failed;
  • the deadline is a context.DeadlineExceeded, so nativeMutationError labelled a network timeout as a user "interrupted".

Fix

  • New deploy.FetchWithStallTimeout: it aborts only when no bytes arrive for stall. That covers connect, headers and body; every received chunk resets the timer.
  • EnsureUV uses it with a 60s stall and a 15-minute cap per source.
  • Errors from every source are joined, and each names its URL.
  • A stall now surfaces as a server error rather than interrupted.
  • Sources and timeouts are package vars so the tests can point them at local servers.

Tests

  • TestFetchWithStallTimeoutFinishesSlowSteadyDownload: a trickling server. A whole-request deadline (the old behaviour) cuts it off; the stall timeout of the same size completes.
  • TestFetchWithStallTimeoutAbortsStalledDownload: a server that stops sending after the headers fails fast, with an error naming the source.
  • TestEnsureUVCompletesSlowMirrorDownload: region=cn with a slow mirror and GitHub returning 502 installs uv.
  • TestEnsureUVReportsEverySourceFailure: when the mirror stalls and GitHub returns 502, the error names both URLs.
  • go test ./... -count=1 all green; go vet is clean; cross-builds for windows and darwin pass.

🤖 Generated with Claude Code

Windows installs on v0.6.0 failed at download_uv: the mirror answered 200
in ~1-3s but the ~20 MB archive did not finish inside the 3-minute
whole-request client timeout, then the GitHub fallback timed out too and its
error replaced the mirror's. The deadline also surfaced as
context.DeadlineExceeded, so telemetry counted these as user "interrupted".

Download uv with a 60s stall timeout (any received bytes reset it) under a
15-minute per-source cap, and join the errors from all sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RockChinQ
RockChinQ merged commit 3b60c4f into main Nov 20, 2026
11 checks passed
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