Range retry can publish duplicated model bytes after a short read
Describe the bug
ReqwestTransport::get_range retries a truncated 206 response using the same AsyncWrite sink. The sink cursor is already advanced, so the second response is appended; the transport then counts only the second response and reports success. The executor can consequently publish a model containing duplicated or shifted bytes.
To Reproduce
- Serve a requested 8-byte range as 3 bytes on the first GET.
- Serve the full 8 bytes on the second GET.
- Call get_range with retries set to 1 and a Vec sink.
- Run the regression short_read_is_not_retried_into_the_same_sink.
Current main logs a 3 / 8 short read, retries, returns Ok, and leaves 11 bytes in the sink. The test fails at unwrap_err because the corrupted write is reported as success.
Expected behavior
After bytes have reached a non-seekable sink, a short read should be surfaced as an error so the executor can reopen and seek to the chunk start. get_range must never append a retry response to an advanced sink.
Screenshots
Not applicable; this is reproducible with the model-free WireMock integration test.
Desktop (please complete the following information):
- OS: Windows 11 ARM64
- Browser: N/A
- Version: upstream main 90df1dc2; Rust 1.98.0 GNU
Smartphone (please complete the following information):
- Device: N/A
- OS: N/A
- Browser: N/A
- Version: N/A
Additional context
The same transport is used by Hugging Face, ModelScope, Docker Hub, and AI Hub range downloads, so a successful corrupted write can affect every remote model source.
Source: qualcomm/GenieX