Repository navigation
fix(device): time out stalled artifact downloads - #240
Merged
Merged
Conversation
Each artifact download now aborts after 30s with no data, or after 10 minutes in total, and is retried once. A file that still fails goes in the failed list with the reason, so the command exits 2 instead of hanging forever on a stalled CDN stream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tQfgpTsA9UhcopKoDezUA
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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.
Bug
dcd device artifacts <id>could hang forever. One download (a 4.5 MBdevice.logfrom the CDN) stalled at about 4 KB/s for more than 5 minutes. The downloads had no timeout, so the command never finished. The same URL worked in about 1.5 s when tried again.Fix
In
src/utils/device-artifacts.ts, each download now has two limits, enforced with anAbortController:A failed or timed-out file is tried once more, because the CDN usually serves it fine on a second request. If it still fails, it goes in the existing
failedlist with a clear reason, such astimed out: no data for 30s (after 2 tries). Any half-written file is deleted. The command still exits 2, as it does for other failed files. Concurrency stays at 4.The timeouts and the number of tries can be passed in through a new optional
optionsargument todownloadArtifactFiles, so tests can use short values.Tests
New cases in
test/unit/device-artifacts.test.ts, all using a fakefetch(no network):I also checked it by hand against a local HTTP server that stalls mid-body, using real
fetch. It aborted at the idle limit and the retry succeeded.pnpm lint,pnpm typecheck,pnpm test:unit(404 passing, exits 0) andpnpm buildall pass.🤖 Generated with Claude Code
https://claude.ai/code/session_018tQfgpTsA9UhcopKoDezUA