Repository navigation
Conversation
🦋 Changeset detectedLatest commit: bcf2f52 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
ben-reitz
force-pushed
the
browser/exec-metadata
branch
from
November 3, 2026 10:14
b3129d3 to
075b4bd
Compare
ben-reitz
marked this pull request as ready for review
November 3, 2026 10:15
ben-reitz
force-pushed
the
browser/exec-metadata
branch
from
November 3, 2026 11:31
075b4bd to
98e2b2e
Compare
ben-reitz
force-pushed
the
browser/exec-metadata
branch
from
November 3, 2026 11:50
98e2b2e to
ae9e6d7
Compare
aron-cf
force-pushed
the
browser/exec-metadata
branch
from
November 3, 2026 14:17
ae9e6d7 to
5205a37
Compare
A host module sometimes needs to know who a run is for, such as the conversation that started it, so it can keep separate state for each. The run's `env` and `input` can't carry that: the run's code reads both, and a model writing that code could change them. `runtime.exec()` now takes `metadata`, a record of strings. The JavaScript backend validates it like `env` and caps it at 16 KiB of keys and values. Host module calls read it as `context.execution.metadata`, and the run's code never sees it. Host code reads it as `WorkspaceExecutionMetadata`, whose values may be `undefined`, since a run may have been started without it. The Workspace stub and the client pass it through, and backends without host modules ignore it. A replayable run saves its metadata with the rest of its start, so it keeps it when it resumes. The field is optional in the saved start: a run saved by an earlier version resumes with empty metadata, so `JOURNAL_VERSION` stays as it was. `runtime.pending()` and `onWait` list each waiting call with its run's metadata, read from the run in memory, or from its saved start for one that isn't.
ben-reitz
force-pushed
the
browser/exec-metadata
branch
3 times, most recently
from
November 4, 2026 11:39
5205a37 to
bcf2f52
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.
A host module sometimes needs to know who a run is for, such as the conversation that started it, so it can keep separate state for each. The run's
envandinputcan't carry that: the run's code reads both, and a model writing that code could change them.runtime.exec()now takesmetadata, a record of strings, and host module calls read it ascontext.execution.metadata. The run's code never sees it. Host code reads it asWorkspaceExecutionMetadata, whose values may beundefined, since a run may have been started without metadata, by other code, or before metadata existed.WorkerJavaScriptBackendvalidates it likeenvand caps it at a fixed 16 KiB, which is plenty for identifiers; it can become an option if someone needs more. The Workspace stub and the client pass it through, and backends without host modules ignore it.A replayable run saves its metadata with the rest of its start, so it keeps it when it resumes. The field is optional in the saved start, and a run saved by an earlier version resumes with empty metadata, so
JOURNAL_VERSIONstays the same and runs in flight during a deploy still resume.runtime.pending()andonWaitlist each waiting call with its run's metadata, which lets an app that queues work per conversation see that a paused run holds a conversation's place.Unit tests cover validation, the byte cap, resuming with and without saved metadata, and
pending(). Workerd tests check that host modules see the metadata, that the run's code can't find it inprocess.envor its input, that it reaches the backend through the stub, and that it survives a restart while a run waits.docs/05_runtime_interface.mdanddocs/17_isolate_javascript.mddescribe the option.