Skip to content

fix(download): recover stale partial files after HTTP 416 - #2278

Open
RezaGolriz wants to merge 1 commit into
exo-explore:mainfrom
RezaGolriz:codex/recover-http-416-resume
Open

fix(download): recover stale partial files after HTTP 416#2278
RezaGolriz wants to merge 1 commit into
exo-explore:mainfrom
RezaGolriz:codex/recover-http-416-resume

Conversation

@RezaGolriz

Copy link
Copy Markdown

Summary

  • detect stale or oversized .partial files when a resumed HTTP request returns 416
  • retry once from byte zero with reset progress accounting
  • handle servers that ignore Range and return a full 200 response
  • preserve existing size/hash verification and keep recovery strictly bounded

Fixes #1914.

Why this approach

A partial file can outlive a changed mirror object or contain more bytes than the current remote file. Retrying the same unsatisfiable range cannot recover. One clean retry repairs that local state while avoiding unbounded retry loops; the completed artifact is still accepted only after the existing integrity checks pass.

Validation

  • uv run pytest -q src/exo/download/tests/test_download_verification.py — 7 focused recovery tests passed
  • uv run pytest -q src/exo/download/tests — 75 passed
  • uv run basedpyright src/exo/download/download_utils.py src/exo/download/tests/test_download_verification.py
  • uv run ruff check src/exo/download/download_utils.py src/exo/download/tests/test_download_verification.py

The tests cover 416 recovery, oversized partials, a server ignoring Range with 200, progress reset, bounded failure after the clean retry, and integrity mismatch behavior.

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.

[BUG] download model failed - http 416 when accessing slightly different models from hf mirror (China)

1 participant