Repository navigation
fix(engine): probe header limit, retries with progress, keep chunk-0 200 - #16
Merged
Merged
Conversation
added 3 commits
October 19, 2026 10:57
Inspect used client.Do with no limit: a server that accepted the probe
and never answered held a new download at the start until it was paused.
The probe now gets the same header limit as a transfer (DefaultHeaderTimeout,
or the download's headerTimeout), and a timeout is reported as a stall
("no response from the server within ..."). On resume the probe stays
non-fatal, so a hung check lets the resume go on as before.
✨ Generated with Claude Code (claude.ai/claude-code) 2.1.303 (claude-opus-5-5)
fetchWithRetry counted every failed attempt against MaxRetries, so a connection that brought some bytes and then stalled, again and again, failed after 8 stalls although each one moved the chunk forward: the same hole #7 closed for short bodies, on the stall path. An attempt that stored bytes now restarts the count and the backoff; attempts with no progress still run out (TestStallsWithoutProgressRunOut). ✨ Generated with Claude Code (claude.ai/claude-code) 2.1.303 (claude-opus-5-5)
When the chunk that starts at byte 0 got the whole file as a 200, its body was dropped (errIgnoredRange), the pass stopped, and the remainder was asked for again on one connection, though that body was already at the right offset. takeWholeFile now makes that chunk the only one, running to the end of the file on this connection. The other chunks are retired: their connections stop at their next write (the plan changes) or their next request. If another connection put the download on one connection first, this one stops as before. TestChunkZeroWholeFileIsKept: one transfer request instead of two. TestSubrangeOKFallsBackToOneConnection now expects that single request. ✨ Generated with Claude Code (claude.ai/claude-code) 2.1.303 (claude-opus-5-5)
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.
Three follow-ups left open after the engine PRs (#1, #7, #10), before 0.5.0.
Changes
6dad126):Inspecthad no limit, so a server that accepted the probe and never answered held a new download at the start until it was paused. The probe now uses the same header limit as a transfer (5 min, or the download'sheaderTimeout), and the error says "no response from the server within …". On resume the probe stays non-fatal.4508d9c):fetchWithRetrycounted every failed attempt, so a connection that brought some bytes and then stalled, again and again, failed after 8 stalls even though each one moved the chunk. An attempt that stored bytes now resets the count and the backoff. Attempts with no progress still run out. This is the same hole fix(engine): retry when a connection closes early #7 closed for short bodies, on the stall path.200, its body is already at the right offset. It is kept and runs to the end on one connection (takeWholeFile), instead of being dropped and the remainder asked for again. Other chunks are retired; their workers stop at their next write or request.Test plan
go test ./...,go test -race ./internal/engine, and the affected tests ×5 with-raceTestProbeHeaderTimeout: fails (stuck until the test deadline) with an unbounded probe.TestResumeProbeHangDoesNotBlock: a hung resume probe does not block the resume.TestStallsWithProgressDoNotRunOut: more stalls thanMaxRetries, each after 4 KiB, completes. Fails without the reset.TestStallsWithoutProgressRunOut: exactlyMaxRetriestransfers, then an error.TestChunkZeroWholeFileIsKept: one transfer request. Fails (2 requests) withouttakeWholeFile.TestTakeWholeFileRetiresTheRest, andTestSubrangeOKFallsBackToOneConnectionupdated to expect the single request.✨ Generated with Claude Code (claude.ai/claude-code) 2.1.303 (claude-opus-5-5)