Skip to content

Add Guest Task Affinity - #739

Merged
lukewagner merged 3 commits into
WebAssembly:mainfrom
adamrk:abk/guest-task-affinity
Oct 15, 2026
Merged

lukewagner merged 3 commits into
WebAssembly:mainfrom
adamrk:abk/guest-task-affinity

Conversation

@adamrk

@adamrk adamrk commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Add a section describing that guest language async tasks must maintain an affinity with Component Model tasks.

Add a section describing that guest language async tasks must maintain
an affinity with Component Model tasks.
@adamrk
adamrk marked this pull request as draft October 8, 2026 13:21
Comment thread design/mvp/Concurrency.md Outdated
components. Consequently, when a guest language has its own async/await
constructs, multiple guest tasks spawned by different Component Model tasks may
be running within a single instance. In these situations, guest-language
runtimes are required to maintain *guest task affinity*: a runtime must ensure

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed in the SIG-Component-Model meeting, I'd prefer to use "should" rather than "must" here, both because it's something that's impossible for a host runtime to verify or enforce, and because most applications (i.e. those that don't involve tasks communicating with each other via e.g. global channels) will have correct attribution regardless. And among those apps which do include inter-task communication, the notion of "correct attribution" gets a lot fuzzier anyway (e.g. did task A send a URL to task B so the latter could make a request on the former's behalf? In that case, attributing the request to A seems reasonable even if B is the one that made it).

To be clear, I think updating guest toolchains to adhere to this is a good thing and we should do it; I just don't think it needs to be mandatory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've modified it to use "should" everywhere.

@adamrk
adamrk marked this pull request as ready for review October 12, 2026 17:18
@adamrk
adamrk requested a review from dicej October 12, 2026 17:18

@lukewagner lukewagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me too; thanks!

Comment thread design/mvp/Concurrency.md Outdated
Co-authored-by: Luke Wagner <mail@lukewagner.name>
@lukewagner
lukewagner merged commit 0220da8 into WebAssembly:main Oct 15, 2026
1 check passed
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.

3 participants