Skip to content

chore: sync workerd upstream c5730a83eb1b - #9

Merged
airyland merged 115 commits into
vrtfrom
sync/upstream-20261123
Nov 23, 2026
Merged

airyland merged 115 commits into
vrtfrom
sync/upstream-20261123

Conversation

@github-actions

Copy link
Copy Markdown

Weekly merge of cloudflare/workerd@c5730a83eb1bb1405312cbc5ccdc8cd4f19d2d15 into vrt.

Opened by the scheduled vrt-sync-upstream workflow. Merge only after the VRT build
check for this PR is green; merging publishes nothing on its own (releases are tagged
builds, see FORK.md).

danlapid and others added 30 commits November 18, 2026 10:50
"wrappables are charged as external memory while they live" builds
its boxes in a 10,000-iteration loop, which V8 may optimize on a
background thread. A compile job still pending when the test
collects them keeps every box alive, and the test sees nothing
released (1120000 bytes remaining). The job usually finishes first,
so this failed only now and then, on release, RBE and ASan builds.

With --concurrent-recompilation-delay=300, which keeps the job
pending, the test failed 10 runs out of 10. A heap snapshot taken
after the failed check found every box collectable: its GC aborts
concurrent optimization first.

Call v8::Isolate::ClearCachesForTesting() before the GCs. It aborts
the pending Turbofan and Maglev jobs and waits for them. With the
delay flag, the test then passed 10 runs out of 10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
node:fs errors from workerd never had `errno`, since the error object built in Rust set only `code`, `syscall`, `path` and `dest`. Several calls reported only the last path component as `path` (`unlinkSync('/tmp/a/missing')` gave `'missing'`, and so did `rmdir`, `mkdir` and `mkdtemp`), and others left it out (`writeFile` with `wx`, `readFile` and `writeFile` on a directory, `mkdir` under a file). Two-path calls (`rename`, `copyFile`, `link`, `symlink`) never set `dest`. Refs cloudflare#4313.

In this patch every UV error sets a negative `errno`, and its default message ends with ` -> 'dest'` when there is a dest, as in Node. readAll, writeAll, unlink, rm, mkdir, link and renameOrCopy pass the full normalized path, and the two-path calls pass `path` (source or link target) and `dest` (new name) the way Node does. The `COPYFILE_EXCL` EEXIST now reports the source as `path` and the destination as `dest`. The unlink and link errors that restated the default text (`File not found`, `File already exists`, ...) now use the default message, so it names the path like Node's. The path strings are built only when an error is thrown.

Compat: besides adding `errno` and `dest`, this changes existing values: `path` goes from the last component to the full path, the `COPYFILE_EXCL` EEXIST `path` goes from the destination to the source, and messages change. Each one moves to what Node reports, and code that branches on these errors checks `code`, which is unchanged, so we accept the change without a compat flag.

The new fs-errors-test checks code, errno, syscall, path and dest for ENOENT, EEXIST, ENOTDIR, EISDIR and ENOTEMPTY across the sync, callback and promises APIs, plus the unlink, rename and link messages, and fails without the fix.
zstdDecompressSync and zstdDecompress threw "unexpected end of file" for
a valid frame whose decompressed size exactly filled the sync output
buffer: 40960 bytes, and 81920 and 163840 as the buffer doubles (cloudflare#7923).
A full output buffer makes the sync loop call ZSTD_decompressStream once
more after all input is consumed. For that call zstd returns the header
size of the next frame, and the decoder took any non-zero result as a
frame still in progress, because its guard checked input_.size, which
is the whole input, not what is left of it.

In this patch the decoder marks a frame as in progress only when the
call consumed input, and as finished when zstd returns 0. Truncated
input is still reported.
zstdDecompressSyncOutputFillsBufferTest decodes frames of 1x to 4x the
40 KiB first sync buffer size, plus and minus one byte, through
zstdDecompressSync and zstdDecompress. It fails with "unexpected end of
file" without the previous commit.
The `/snapshot` quick action now returns PDFs, links, scraped elements, and
AI-extracted JSON alongside HTML, screenshots, Markdown, and the accessibility
tree. Add the four formats to `BrowserRunSnapshotFormat` and the options each
one uses to `BrowserRunSnapshotOptions`, reusing the per-action option types so
the shapes cannot drift from the standalone actions.

`BrowserRunSnapshotSuccessResponse` gains `pdf`, `links`, `scrape`, and `json`.
Regenerate `generated-snapshot/` and cover the new formats and the internal
`crawl` format in the type tests.
V8 drops an unreachable droppable wrapper in a minor GC only if the
object still has its constructor's initial map (see
JSObject::IsUnmodifiedApiObject()). attachOpaqueWrapper() gave every
opaque wrapper a null prototype, which changes its map, so none of
them could die young. That covers every value a jsg::Promise carries,
every promise continuation's callbacks and every AsyncContextFrame.
Each one, and everything its C++ value traces, was a scavenge root
until the next full GC.

Under load on a bare hello-world Worker, this kept 80-95% of new
space alive through each scavenge, after which V8 pretenured and ran
only full GCs.

Shadow `then` with a read-only undefined property on the opaque
template's prototype instead. It still ends the thenable lookup in
v8::Promise::Resolver::Resolve() before it reaches Object.prototype,
which the null prototype was added for, and instances keep their
initial map.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The zstd decoder called ZSTD_decompressStream once per write. When a
frame ended with input left and output space free, the sync loop
stopped, so zstdDecompressSync and zstdDecompress returned only the
first frame. A leading skippable frame, as pzstd writes before every
frame, also ends with a 0 result, so the real frame after it was
dropped and the output was empty. In a stream, the unread bytes after
the first frame were lost, and the next write failed with "Unknown
frame descriptor" when the second frame started partway into the
previous write. With maxOutputLength equal to the first frame's size,
the first frame came back with no error.

In this patch the decoder works like Node's: it keeps decoding while a
frame has just ended and input is left. The first 4
bytes after a frame are checked against the zstd and skippable frame
magic numbers, across writes, and input that is neither is ignored as
trailing junk. "unexpected end of file" still reports a frame that was
cut short, and an empty input still decodes to an empty buffer. Input
that is ignored after a frame doesn't count against maxOutputLength, so a
frame that exactly fills it still decodes.
The new tests cover two and three frames back to back, skippable frames
before, between and after real ones, a second frame split across two
stream writes at offsets 1 to 8, trailing junk, a truncated second
frame, maxOutputLength across frames and a frame that fills
maxOutputLength before ignored input, through zstdDecompressSync,
zstdDecompress and createZstdDecompress. The trailing junk, empty input
and filled maxOutputLength cases check that existing behaviour stays the
same; the others fail without the previous commit. The same tests pass
in Node 26.12 except for empty input, where Node throws.
An oidc_tokens binding issues OpenID Connect tokens for the Worker's own
identity, for the audience set in its config. Its getToken() returns a newly
signed JWT, valid for 5 minutes, with a new jti on each call.

The generated snapshots were updated by hand: Bazel couldn't fetch its
registry here, so CI's snapshot check verifies them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: André Cruz <andre@cabine.org>
There's no reason for this to be included
Hopefully the comment will encourage people to not add files to io that don't
need to be there
This fixes an implicit dependency of api/crypto/endianness.c++ on V8 since it
depends on a recent API level for some functions it uses. rules_cc expects us to
pass the full /D argument instead of just the value.
Update capnp-cpp from be8fbe7 to 7d3db37.
)

A cluster node keeps its lease on a thread of its own, so a turn of
its event loop of any length keeps it. A loop that is stuck for good
(a deadlock, native code that does not return, a turn that never
ends) therefore kept the lease, and its Durable Objects unreachable,
for as long as the process lived.

Once the node serves, the lease thread now watches the loop. A loop
that makes no progress fences the node through the same path and
fatal line as a lease that cannot be kept:

* `kj_rs_tokio::watch_progress()` gives a count that the loop advances
  while it makes progress, readable from any thread. A busy KJ loop
  polls its port only once its run queue is empty, so between its
  turns no tokio task runs, no KJ timer fires (`TimerImpl` fires only
  after the port's `wait()` or `poll()`) and no `kj::Executor` ping is
  taken in (drained only after the port wakes). The count's busy half
  is therefore a KJ event, the port's progress probe: it counts and
  re-arms itself breadth-first, so it fires once per pass through the
  run queue, and leaves the queue once nothing but itself is left, so
  that the loop still sleeps and runs its `evalLast()` events. The
  port re-arms it after every `wait()`, and after a `poll()` that
  leaves events to turn. While the loop sleeps, a task on its
  `LocalSet` counts once a beat.
* The count stands still while one event holds the thread, and also
  through three kinds of busy stretch that begin while the probe is
  out of the queue:
  * one that an `evalLast()` / `yieldUntilQueueEmpty()` event starts:
    `armLast()` queues each in front of the ones before, so the probe
    cannot follow them;
  * one that a `yieldUntilWouldSleep()` waiter starts: KJ arms the
    waiter after the port's `poll()` returns, and only if that poll
    left no event;
  * one that a cross-thread event starts when KJ takes it in after
    the port's `poll()` rather than its `wait()`. Arming the probe for
    the wake would let a stale wake, whose event KJ cancelled without
    consuming it, keep `WaitScope::poll()` from returning and starve
    would-sleep waiters.
  Such a stretch is counted again once the run queue empties. Only
  work that is ready without the port keeps it from emptying, and one
  that lasts a whole `stall_ms` fences the node. Closing all three
  needs a per-turn hook in KJ's `EventLoop::turn()`.
* `cluster_logic::watchdog` decides: a count that stands still for
  `Timing::stall_ms` fences the node. The keeper reads it once a
  round, after the round's lease step, so that a process stopped as a
  whole reports its lapsed lease. Its reason ends the rounds as a
  lapsed lease does, through `Armed::fence`, while the lease holds.
* The watching starts with `ClusterNode::serving`, which sends the
  count to the lease thread (`Cluster::watch`). Linking, after `join`,
  runs in turns as long as itself, and the lease thread keeps the
  lease through it as before. A loop that cannot be watched
  (`watch_progress()` answers why) serves on unwatched, with a
  warning that says so.
* `stall_ms` is three leases, 60 s, divided by `unsafeTimeDivisor` as
  the other times are. That is twice the turn of one and a half
  leases that the long-turn test rides out. The beat is the renewal
  interval.
* The fatal line now reads "leaving the cluster: {reason}", where a
  lease's reasons begin "its lease cannot be kept: " and the
  watchdog's reads "its event loop made no progress for N ms".

The probe costs a KJ turn per pass through a busy run queue and one
per wake of the loop, in cluster mode only. A chain of events that
arm each other depth-first runs ahead of it, as it runs ahead of
every other event, and counts as one event until it ends.

The cluster test's Worker gains a `/wedge` endpoint that loops
forever, and a test that its node exits with status 1 and the reason
on stderr, under a `shortLease` config with a tenth of the default
times. The long-turn test now aims at one and a half leases, at most
four times its last guess, rather than doubling past a lease.
* [build] Break JSG dependency on kj-http

There's no reason for this to be included

* [build] Split files off from io target

Hopefully the comment will encourage people to not add files to io that don't
need to be there

* [build] Factor out more io sources

* [build] Consistently define Windows API level

This fixes an implicit dependency of api/crypto/endianness.c++ on V8 since it
depends on a recent API level for some functions it uses. rules_cc expects us to
pass the full /D argument instead of just the value.
An actor's IoContext hands out the IoChannelFactory of its newest
IncomingRequest. After that request returns, it stays the newest
while the actor waits for background work, so a request that
returned long ago keeps governing the calls that other, still-running
requests make.

An embedder can stamp each outgoing call with its request's
metadata, such as a loop-depth TTL. A callback into the actor arrives
with a lower TTL than the request that caused it, becomes the newest
request, and stays so after it returns. The next calls of a
longer-lived request then spend the callback's lower TTL, and each
further round of callbacks lowers it again, until calls fail with
"Subrequest depth limit exceeded". This happens, for example, when an
actor runs code in a Dynamic Worker whose tail worker reports back to
the actor, or when a client session drives Dynamic Workers that call
back into the actor.

Under the new IO_CHANNELS_FROM_RUNNING_REQUEST autogate,
getIoChannelFactory() returns the factory of the newest request that
has not returned, or of the newest request if every request has
returned.

Limitations:

- Work that a request leaves running after it returns isn't tied to
  the request that started it, so it uses the newest running
  request, whose TTL may differ from its starter's. Propagating the
  request through async context would fix this fully.
- A request counts as running until its call ends, and a JS RPC call
  ends only once its caller releases it, after the caller has the
  result. Calls that the actor makes while a callback is running,
  including just after it has replied, spend the callback's lower
  TTL. Once the callback ends, calls spend the running request's TTL
  again, so the TTL drops further only if each round's calls are made
  while the previous round's callback is still running.
- Spans and metrics are still attributed to the newest request.
- Timers also come from the selected factory. All requests to an
  actor share its clock, so they are unaffected.
…-20-node-zstd-multiframe

Decode every frame of concatenated zstd input
`readable-streams/tee.any.js` was disabled as a whole in the TS streams config because two of its subtests hang: they compare the AggregateError cancel reason to an array inside the cancel callback, so the test promise never settles. That also hid the other 29 subtests.

In this patch only the two hanging subtests are disabled. Six more are expected to fail for the shared-queue tee model: five count pulls the way the spec's per-branch clone model does, and one expects a source error to drop chunks the other branch has already queued. The other 23 now run and pass.
Both tests were disabled when the websockets suite was first imported.
`Send-0byte-data.any.js` was said to hang because an empty message
arrived as 0, and `referrer.any.js` because referrer behaviour differs
in workers. Both now pass.

In this patch both are enabled. `//src/wpt:websockets@` and
`//src/wpt:websockets@all-autogates` each passed 100 of 100 runs with
`--runs_per_test=100`.
Most jsg-test resources counted their drops in a Drop impl of their own,
and many of them hold a jsg::Rc or a TracedGlobal. A resource that holds
GC references is about to lose its Drop impl, so the counting has to
live somewhere else.

In this patch crate::DropCounter, a #[jsg_traced] field that adds one to
its static counter when it is dropped, takes over from each of those
impls, and from the two private copies of the same type in function_new
and promise. cpp_interop's Host keeps a per-thread count through a
HostDropCounter field, and gc's DisposeGate waits at its barrier from a
WaitOnDrop field. The tests count the same drops as before.
…plements Drop

Drop has &mut self, so a resource's Drop can move a jsg::Rc or a
TracedGlobal out of a field that the garbage collector made weak.
Nothing makes the moved reference strong again on its own: an Rc keeps
the dropped resource as its parent, which its next owner's trace asserts
against, and a TracedGlobal loses its value once nothing else holds it.
Rust JSG has handled this at run time, by detaching every reference
before such a resource drops. No resource outside the tests needs a Drop
impl while holding GC references.

In this patch #[jsg_resource] emits a const assert that fails when the
resource implements Drop and a field's type isn't HoldsNoGcReferences.
It asks the new hidden jsg::DropCheck<T>, whose inherent consts answer
when their bound holds and fall back to false otherwise. A resource
whose fields hold no GC references, like MemoryCache, may still
implement Drop, and so may a field's type. #[jsg_struct] and
the fields out. Compile tests cover all three, and the README's rule 2
says so. The runtime tests for a Drop that moves a reference out go,
since their resources no longer compile.

A hand-written type that holds GC references can still implement Drop,
because Rust has no negative bounds. That stays a rule for reviewers.
A resource that holds GC references can't implement Drop any more, so
nothing moves a reference out of a dropping resource's fields. The
machinery that made a dropping resource's references strong and
parentless first, for its own Drop (cloudflare#8403), a field type's Drop (cloudflare#8466)
and its TracedGlobals (cloudflare#8600), has nothing left to do.

In this patch VisitMode::DetachForDrop, GcVisitor::detach_for_drop,
GarbageCollected::detach_before_drop, Traced::needs_drop_detach and its
forwarding impls, and the macro's Drop probes go away.
wrappable_invoke_drop drops the resource without visiting it first, and
GC and detaching visits no longer check for a drop visit.
TracedGlobal::let_go_of_traced stays, since GC and detaching visits use
it. TracedGlobal::is_empty and try_as_local (cloudflare#8659) go too: they were
for a handle that a resource's Drop moved out, which can't happen any
more.
There was no benchmark for `transcode()`, so changes to its conversion paths couldn't be measured.

In this patch `//src/bench/buffer:transcode` times `transcode()` for 14 encoding pairs, covering every conversion path, on ASCII and non-ASCII text of 64 bytes, 1 KiB and 64 KiB.
Every `transcode()` pair with ASCII or Latin-1 on either side, apart from widening into UTF-16LE, decodes and re-encodes one character at a time, about 3.7 ns per byte. That holds even for ASCII text, which is the same bytes in every encoding `transcode()` supports.

In this patch Latin-1 to UTF-8 uses simdutf's `utf8_length_from_latin1` and `convert_latin1_to_utf8`, and Latin-1 to Latin-1 is a copy. For the other pairs into ASCII or Latin-1, and ASCII to UTF-8, simdutf's `validate_ascii_with_errors` finds where the leading ASCII bytes end. An all-ASCII source is copied, and otherwise the ASCII prefix is copied and only the rest goes through the per-character loop, so text with non-ASCII bytes is no slower. The output doesn't change.

Median time per call, `//src/bench/buffer:transcode`, optimized build on an Apple M5 Pro:

| case | before | after | speedup |
|---|---:|---:|---:|
| ascii->utf8, ASCII, 1 KiB | 3.92 µs | 279 ns | 14.0x |
| ascii->utf8, ASCII, 64 KiB | 237.5 µs | 1.91 µs | 124x |
| utf8->latin1, ASCII, 64 KiB | 252.6 µs | 1.94 µs | 130x |
| latin1->ascii, ASCII, 64 KiB | 238.2 µs | 1.89 µs | 126x |
| latin1->utf8, ASCII, 64 KiB | 239.9 µs | 3.66 µs | 65.5x |
| latin1->utf8, é, 64 B | 325 ns | 271 ns | 1.20x |
| latin1->utf8, é, 64 KiB | 117.4 µs | 10.5 µs | 11.2x |
littledivy and others added 27 commits November 21, 2026 16:36
…-21-fix-alarm-elsewhere-kj-exception

Return KjException from AlarmOwnedElsewhere's unimplemented events
connect() with secureTransport 'starttls' offers whoever serves the
CONNECT a slot to fill in with the socket's startTls() callback. The
slot was heap-allocated and owned by the Socket's ConnectionData,
while kj::HttpConnectSettings carried only a reference to it. The
ConnectionData is an IoOwn, so it went away with the caller's
IoContext. The connection can outlive that: the Socket's readable
and writable hold their own references to it, and a response body
keeps reading from it after the request has ended.

For a connection into another Worker, kj's HttpClientAdapter
forwards the settings to the target's connect() and attaches the
pending call to the connection. When that call is served late, as by
a Durable Object still in blockConcurrencyWhile(), the target's
ServiceWorkerGlobalScope::connect() read the freed slot, and
setupInternalTlsRendezvous() wrote a kj::Function into it. If the
freed memory had been reallocated with an engaged value, the target
moved it into its own Socket, whose teardown then called through it.

The slot is now refcounted, and connectImpl() attaches a reference
to it to the connection, so it lives as long as the connection, and
with it the pending call that can fill it in. The Socket holds
another reference, as before.

connect-handler-starttls-lifetime-test has a Worker open a starttls
tunnel to a blocked Durable Object, return the socket's readable as
its response, and end its request before the Durable Object serves
the tunnel. Without the fix, AddressSanitizer reports a
heap-use-after-free in ServiceWorkerGlobalScope::connect() on every
run (5 of 5), and a build without it crashes with a segmentation
fault (5 of 5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aque-wrappers

Let V8 drop opaque wrappers in a scavenge
…ot-lifetime

Keep a CONNECT's startTls slot alive with its connection
extra_rustc_flag can pass rustc a flag that names a file, such as
-Cprofile-use=<profile>, but nothing adds that file to the Rustc
action's inputs, so rustc can't read it in a sandbox or on a remote
executor. The extra_rustc_inputs label flag adds its files to every
target-configuration Rustc action, as extra_rustc_flag adds its
flags, and ${extra_rustc_inputs} in an extra flag stands for the
path of its file, so the flag needn't hardcode where Bazel puts it.
The PGO build uses it to give rustc the profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests only do what `workerd test` does: start a Worker and hand it
a few events. A profile trained on them alone wouldn't see the HTTP
server, or a Worker handling one request after another. This test runs
`workerd serve` of a few Workers, a sync and an async hello world and
one that uses a mix of the APIs real Workers use, and sends each many
requests from concurrent clients, checking every response so that a
broken Worker fails the test rather than training the profile on error
paths. It starts workerd through WorkerdServerHarness, which gains
options to leave out the inspector and --verbose, as production
does.

Normally it sends 50 requests per path. Under the PGO training
wrapper, which sets WORKERD_PGO_TRAINING, it sends 10,000 to 40,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Callers find CapTableReader and CapTableBuilder with dynamic_cast,
and neither had a virtual function defined out of line, so every
library that used them emitted its own copy of their type info. A
dynamically linked test built with ThinLTO keeps its executable's
copy apart from the library's, and frankenvalue-test's dynamic_cast
then failed. Their destructors, now defined in frankenvalue.c++, make
the type info a single definition there. CapTableBuilder's base,
jsg::Serializer::ExternalHandler, gets the virtual destructor that
jsg::Deserializer::ExternalHandler already has, so that
CapTableBuilder's destructor is virtual too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test's getter recurses until the stack runs out, catching the
overflow at each level, so it returns arrays nested about as deep as
the stack allows. Whether structuredClone() can then serialize them
depends on how much stack each level of the serializer takes, which
the PGO build changes: there it throws a RangeError. That isn't the
crash the test guards against, so the test accepts it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
release_linux, which the x64 and arm64 release builds use, now adds
ThinLTO and Clang's instrumentation-based PGO, for the C++ code, V8
included, and the Rust code, which it compiles to bitcode so that the
ThinLTO link optimizes both together. release_linux-without-pgo is the
old release build, for comparisons.

The profile isn't checked in. build/pgo/profile.json names it, an
asset of the pgo-profiles GitHub release, with its hash, and Bazel
downloads it. rustc gets it through rules_rust's extra_rustc_inputs,
which also names its path in -Cprofile-use.

build/pgo/train.sh trains a profile: it builds pgo-instrument, runs
every test that runs the workerd binary under a wrapper that sets
KJ_CLEAN_SHUTDOWN, so that workerd writes its profile, and merges each
test's profiles, then merges them all, weighting the serving
workload's. build/pgo/upload.sh uploads it and updates profile.json.
The pgo-train workflow does both and opens a pull request; it runs
only when someone starts it. release.yml already builds the release
configuration on every push to main, publishing only the first build
of each release version, so a deleted profile or a change that breaks
the PGO build fails the merge that follows it. Its Linux builds now
also run the serving workload on the PGO binary.

The arm64 build uses the profile trained on x64: Clang matches it to
the code in its architecture-independent form, and the arm64-specific
code gets no profile data. macOS and Windows keep their release
builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
.gitlab-ci.yml, cfsetup.yaml and ci/build.yml configured CI for the
internal GitLab copy of workerd that development used from May to
August 2026. The first two syncs back to GitHub left them out, but the
June 24 sync (cloudflare#6844) brought them in, and later syncs kept them.

Nothing here runs them, and they name internal registries, Vault
paths and CI components. The rest of ci/ is used by the dependency
update tooling and stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ab-ci

Remove the internal GitLab CI configuration
…t-external-memory

Abort pending optimizing compiles before collecting kept boxes in tracing-test
…-build

Build the Linux releases with PGO and ThinLTO
…-from-running-request

Make an actor's calls use a running request's I/O channels
The Rust worker::Interface trait predates WorkerInterface::bench() and
never got the method, so a Rust implementation wrapped for C++ answered
UNIMPLEMENTED, and a Rust decorator such as PromisedInterface hid the
bench handler of the worker behind it. As more of the WorkerInterface
chain moves to Rust, bench() has to pass through it like other events.

Interface::bench() takes an encoded BenchParams and returns the encoded
BenchReport.Group. Its default fails as UNIMPLEMENTED, matching C++.
RustWorkerInterface bridges it to C++, a new worker_bench shim lets
CxxWorkerInterface call the wrapped C++ worker, and CxxWorkerInterface
and PromisedInterface forward it. No behavior visible to Workers
changes. New C++ and Rust tests cover the round trip, forwarding, and
the default.
A cursor resets its SQLite statement only when it reaches its last
row or when V8 collects it. An application that stops reading part
way leaves the statement active on the Durable Object's connection,
and while it is, SQLite rejects every DROP TABLE and DROP INDEX with
SQLITE_LOCKED. The only way out was to call one() and ignore its
error, which steps the statement once more: after a step has failed,
that runs the statement again from the start.

close() ends the query without stepping it: it resets the statement,
returns it to the statement cache and keeps rowsRead, rowsWritten and
columnNames. A closed cursor reads as one that has run to its end.
close() is idempotent. Like the cursor's other methods, it throws when
called from a Durable Object other than the one that created the
cursor; under `using`, that error arrives as a SuppressedError that
still carries the original one.

JSG_DISPOSE(close) makes the cursor work with `using`, so that
leaving the block by break, return, throw or a generator's return()
closes it. Both are opt in, so existing code is unaffected.
…cloudflare#8732)

`WorkerInterface::fromException()` makes the worker that stands in for
one that couldn't be had: every event on it fails with the given
exception. As part of moving the `WorkerInterface` implementations that
don't need the isolate to the Rust `worker::Interface` trait, this adds
a Rust version of it in `src/rust/worker/failure.rs`, used instead of
the C++ `ErrorWorkerInterface` when the `RUST_FAILURE_WORKER_INTERFACE`
autogate is enabled.

The Rust worker behaves like the C++ one, except where the C++ behaviour
is incidental: it fails every event with a copy of the exception rather
than moving it out at the first failure, `test()` fails with the
exception rather than returning a null promise, and its failures are
rejected promises rather than thrown from the call. A Worker sees the
same error either way.

Tests run `fromException()` in both variants: the default one exercises
the C++ worker and `@all-autogates` the Rust one.
…close

Add close() and Symbol.dispose to SqlStorageCursor
Add OidcTokenBinding types for oidc_tokens bindings
…flare#8513)

* Add Worker::Script::newContext()

A script's contexts are all created with its module registry and
schema loader, and each caller spelled both out. Create them through
one method instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Compile service worker scripts in their first Worker's context

A service worker script is compiled independent of any context, but
compiling it, reporting its errors and converting its globals need an
entered one, so the Script created a throwaway context to compile in.
That cost every service worker script an extra context, created
before the one its first Worker runs in.

Create the context the first Worker will run in instead, compile in
it, and hand it to that Worker. Later Workers of the same Script still
create their own contexts. A Script whose context no Worker took
disposes of it, like the shared context of a modules script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…-21-derivebits-length

Apply [EnforceRange] to the deriveBits length
…ot-formats

feat(types): add the extended Browser Run snapshot formats
# Conflicts:
#	src/workerd/server/factory/worker-factory-impl.h
@github-actions github-actions Bot added the sync Upstream workerd sync label Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Author

Kicking off VRT build for the merge commit.

@airyland
airyland merged commit d1742f5 into vrt Nov 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sync Upstream workerd sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.