[Bug]: nonpositive read_stream chunk sizes silently drop file contents
Author: twei43846-afkCreated Sep 30, 2026Updated Sep 30, 2026
Labelstriage/confirmed
Reproduction
On main c0a5762, write b"abcdef" to a temporary file and collect LocalBackend.read_stream(path, chunk_size=0): it silently yields nothing. Passing -1 instead reads the entire file at once. The BackendBase fallback yields nothing for -1 and raises the unrelated range() arg 3 must not be zero for 0.
Expected
Reject nonpositive chunk_size with a consistent ValueError before file I/O. A stream configuration error should not turn a nonempty file into a successful empty download or bypass the local streaming memory bound.
I can add positive-size validation in the default and local implementations, with regressions for empty/nonempty files and tests preserving ordinary chunk boundaries. Codex-assisted investigation.
Source: agentscope-ai/agentscope