Skip to content

Add explicit context_id parameter to all hostcalls. - #92

Merged
PiotrSikora merged 8 commits into
proxy-wasm:mainfrom
PiotrSikora:add_context_id
Aug 11, 2026
Merged

Add explicit context_id parameter to all hostcalls.#92
PiotrSikora merged 8 commits into
proxy-wasm:mainfrom
PiotrSikora:add_context_id

Conversation

@PiotrSikora

Copy link
Copy Markdown
Member

While there, add and consistently use UNKNOWN_RESOURCE_ID error
for when resources are accessed using an unknown ID.

While there, add and consistently use `UNKNOWN_RESOURCE_ID` error
for when resources are accessed using an unknown ID.

Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Comment thread abi-versions/vNEXT/README.md Outdated
Comment thread abi-versions/vNEXT/HOST_FEATURES.md Outdated
Comment thread abi-versions/vNEXT/HOST_FEATURES.md Outdated
Comment thread abi-versions/vNEXT/README.md
@PiotrSikora
PiotrSikora marked this pull request as ready for review February 12, 2026 14:44
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Comment thread abi-versions/vNEXT/README.md

@leonm1 leonm1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My understanding now is that the wasm code itself tells the host which context to use via the context_id parameter. Previously, it was implicit based on the last wasm callback the host invoked.

The context id is given to the wasm code during proxy_on_context_create, then is it the responsibility of the SDK to keep track of it, or is it on plugin authors? It would be helpful guidance to explain this in the description. Can you expand the PR description a bit to express what is changing with this spec change?

Comment thread abi-versions/vNEXT/README.md Outdated
Comment thread abi-versions/vNEXT/HOST_FEATURES.md Outdated
Comment thread abi-versions/vNEXT/README.md
@PiotrSikora

Copy link
Copy Markdown
Member Author

My understanding now is that the wasm code itself tells the host which context to use via the context_id parameter. Previously, it was implicit based on the last wasm callback the host invoked.

Correct (ignoring the proxy_set_effective_context hostcall).

The context id is given to the wasm code during proxy_on_context_create, then is it the responsibility of the SDK to keep track of it, or is it on plugin authors? It would be helpful guidance to explain this in the description. Can you expand the PR description a bit to express what is changing with this spec change?

Technically, they don't have to be tracked at all, since all callbacks already include resource ID (context_id, callout_id, kvstore_id, etc.)

Having said that, I assume that SDKs would provide objects that track the resource IDs and won't require users to operate directly on them.

As for the guidance, is a bit tricky, because ABI defines Host<>Wasm interface, and whatever happens on the Wasm side is not part of that contract. The plugin authors may or may not use any SDK at all. We could provide some guidance for the host implementations, but I think anything for the SDK users should be documented in the SDKs, since it may vary from SDK to SDK.

Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Comment thread abi-versions/vNEXT/README.md
@PiotrSikora

Copy link
Copy Markdown
Member Author

@mpwarres @leonm1 I believe all comments and discussion from the meetings have been addressed here (I left the comments open, so please resolve them if you're satisfied with the answers).

@PiotrSikora
PiotrSikora requested review from leonm1 and mpwarres May 21, 2026 13:16
@PiotrSikora PiotrSikora linked an issue May 21, 2026 that may be closed by this pull request

@leonm1 leonm1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved, with a few questions on hostcalls without context_id parameters.

Comment thread abi-versions/vNEXT/README.md
Comment thread abi-versions/vNEXT/README.md
Comment thread abi-versions/vNEXT/README.md
Comment thread abi-versions/vNEXT/README.md
Comment thread abi-versions/vNEXT/README.md
Comment thread abi-versions/vNEXT/README.md
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>

@leonm1 leonm1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM for merging.

@PiotrSikora
PiotrSikora merged commit 1a8cffd into proxy-wasm:main Aug 11, 2026
8 checks passed
@PiotrSikora
PiotrSikora deleted the add_context_id branch August 11, 2026 08:18
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.

Context/resource ID should be always provided in the hostcall

3 participants