Skip to content

fix(cli): time out stalled model downloads#2415

Open
miguel-heygen wants to merge 1 commit into
mainfrom
fix/download-timeout
Open

fix(cli): time out stalled model downloads#2415
miguel-heygen wants to merge 1 commit into
mainfrom
fix/download-timeout

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Root cause

The shared model downloader had no inactivity timeout. If a server opened a successful response but stopped delivering bytes, pipeline() waited forever and left a zero-byte .tmp file. This surfaced while Kokoro downloaded kokoro-v1.0.onnx.

Fix

  • apply a 30-second socket inactivity timeout to each download request
  • destroy stalled requests with an actionable timeout error
  • remove partial files consistently on timeout, request error, pipeline failure, and non-200 response
  • drain redirect/error response bodies

The timeout measures inactivity, not total download duration, so slow downloads continue while bytes are arriving.

Regression coverage

Adds a red-first test with a 200 response that never delivers data. It verifies prompt rejection and cleanup of both the partial and destination files.

Validation

  • full repository build
  • CLI suite: 130 files, 1,647 tests passed
  • CLI typecheck
  • focused downloader/TTS/Whisper tests
  • changed-file lint, format, fallow, and pre-commit hooks

Reviewer action

Confirm the 30-second inactivity window is appropriate for model hosts; it does not cap total transfer duration.

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