Stream: git-wasmtime

Topic: wasmtime / PR #14916 [DO NOT REVIEW] Support named import...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:19):

jrandolf opened PR #14916 from jrandolf:wasi-io-named-imports to bytecodealliance:main:

This builds on #14875, so only the last commit is new here.

wasmtime_wasi::p2::add_named_to_linker_async didn't handle labelled imports of wasi:io/{error,poll,streams}, so components importing them under a label, such as composed components whose dependencies are isolated from each other, failed to link. This adds them. wasi:io has no state besides the resource table, so each method looks up the table for the import's context and calls wasmtime-wasi-io.

wasi:clocks/timezone is still not covered, since wasmtime-wasi doesn't implement it at all.

Part of #14858

<details>
<summary>LLM summary of the changes</summary>

Bindings (wasi/src/p2/bindings.rs)

wasi:io/{error,poll,streams} are added to the named_imports of the async bindings. They get the same async/trappable/tracing rules as in wasmtime-wasi-io. Without labels these interfaces are aliased to wasmtime-wasi-io with with, so the rules only affect the named bindings. The resource types are the same as for unlabelled imports.

Linking (wasi/src/p2/mod.rs)

Interface gets IoError, IoPoll and IoStreams, and add_named_to_linker_with_options_async adds the three interfaces through a new HasIoNamed data type.

Implementation (wasi/src/p2/host/io.rs)

Each method of error, poll and streams looks up ctx(id).table and calls the corresponding wasmtime-wasi-io method, including convert_stream_error, which needs the id from #14875. As documented for named WASI contexts, a stream created through one label and used through another only works if their contexts share a ResourceTable.

Test (wasi/tests/all/p2)

A component imports wasi:cli/stdout and the wasi:io interfaces it uses under labels, and checks that output goes to the labelled context's stdout. It's written in WAT because a labelled wasi:cli/stdout using types from labelled wasi:io imports can't be written in WIT.

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:20):

jrandolf has marked PR #14916 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:20):

jrandolf removed the review request for wasmtime-wasi-reviewers from PR #14916.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:20):

jrandolf requested rvolosatovs for a review on PR #14916.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:20):

jrandolf requested wasmtime-wasi-reviewers for a review on PR #14916.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:20):

jrandolf requested pchickey for a review on PR #14916.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:20):

jrandolf removed the review request for wasmtime-core-reviewers from PR #14916.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:20):

jrandolf requested wasmtime-core-reviewers for a review on PR #14916.


Last updated: Oct 31 2026 at 23:03 UTC