Repository navigation
fix(wasmtime): correctly handle input-stream - #1568
Merged
Merged
Conversation
rvolosatovs
force-pushed
the
fix/wasi-input-stream
branch
2 times, most recently
from
October 23, 2026 11:09
a3f3f9e to
56067c5
Compare
Data received after the end of a pending future or stream value is a protocol violation by the peer rather than a closed pipe. Assisted-by: claude:claude-opus-5-5
`copy_io_error` and `receiver_closed` are not specific to framing and are used by the value codec as well, while `encode_ready_bytes_header` is shared by the value codec and the packer. Prefix the error constructors with `error_` to make their purpose apparent at call sites. Assisted-by: claude:claude-opus-5-5
Report the outcome of receiving a pending `stream<u8>` decoded by `StreamDecoderRead` to the reader once all chunks are read, so that e.g. a truncated stream, or one whose receiving future was dropped, is no longer observed as a clean end of stream. The outcome is sent on a dedicated channel, so reporting it never waits for the reader. Assisted-by: claude:claude-opus-5-5
Add a `MAX_READY` const generic parameter (`usize::MAX` by default) limiting the number of bytes read from the stream when encoding, any remaining bytes are then transmitted asynchronously. Make `READ_CHUNK_SIZE` public. Assisted-by: claude:claude-opus-5-5
rvolosatovs
force-pushed
the
fix/wasi-input-stream
branch
3 times, most recently
from
October 23, 2026 11:29
406f786 to
1216f05
Compare
rvolosatovs
enabled auto-merge
October 23, 2026 11:30
`wasi:io/input-stream` resources are transmitted as `stream<u8>`, which
is encoded as `variant { pending, ready(list<u8>) }`, but the codec
neither wrote nor read the status byte.
Since the Rust encoder inlines streams that are already finished as
`ready`, the decoder read nothing from the async sub-stream and left the
inlined bytes unprocessed, e.g. the `streams-io` example counted 0 bytes.
The encoder omitted the `pending` byte, so other implementations failed
to decode `input-stream` results.
Encode `input-stream`s via `wrpc-transport`'s `StreamEncoderRead`, which
inlines at most `READ_CHUNK_SIZE` bytes of finished streams as `ready`,
and back decoded `ready` streams by a `MemoryInputPipe`.
Assisted-by: claude:claude-opus-5-5
A pending `input-stream` whose sub-stream ended before the empty end-of-stream chunk was reported to the guest as a cleanly closed stream, silently truncating the data, and data received after the end-of-stream chunk was silently dropped. Fail the read in both cases, matching the `wrpc-transport` stream decoders. Decode the chunks with `CoreVecDecoderBytes` and `StreamReader`, avoiding a copy per chunk and the `futures` compat layer. Assisted-by: claude:claude-opus-5-5
Compute the async paths of polyfilled function results, so that pending `input-stream`s and other asynchronous values returned by the remote are received. Assisted-by: claude:claude-opus-5-5
Byte streams were read in chunks of 8096 bytes, likely a typo of 8192, which is the chunk size used by `wrpc-transport`. Export it as `ReadChunkSize` and use it in the runtime and generated bindings. Assisted-by: claude:claude-opus-5-5
`go run` executes the built server as a child process, so killing it left the server running and holding the test's stdout and stderr open, which made `cargo test` hang when its output was piped. Build the servers into a temporary directory instead, accounting for the platform executable suffix. Assisted-by: claude:claude-opus-5-5
rvolosatovs
force-pushed
the
fix/wasi-input-stream
branch
from
October 23, 2026 11:39
1216f05 to
5eba7f4
Compare
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.
No description provided.