From 7c08806382b07578d189981d223ed3bac3959975 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Wed, 15 Jul 2026 20:08:44 +0000 Subject: [PATCH 1/2] Fix AsyncLocalStorage context loss in thenables returned from async functions Bump WEBKIT_VERSION to pick up oven-sh/WebKit#295: keep the async context active while settling the async function's promise, so a thenable returned after a suspension runs its then() with the correct context. Fixes #34266 --- scripts/build/deps/webkit.ts | 2 +- .../async-local-storage-thenable.test.ts | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/build/deps/webkit.ts b/scripts/build/deps/webkit.ts index b7ca822369da..015edd831784 100644 --- a/scripts/build/deps/webkit.ts +++ b/scripts/build/deps/webkit.ts @@ -7,7 +7,7 @@ // -lto variants built with ThinLTO (per-module summaries for cross-language // importing), and the Windows ICU data table filtered + per-item zstd // compressed (lazily decompressed via bun_icu_decompress.cpp). -export const WEBKIT_VERSION = "4895f45dfbd0d1226c4d41799887bc0ecb9f341b"; +export const WEBKIT_VERSION = "autobuild-preview-pr-295-ff8154f3"; /** * WebKit (JavaScriptCore) — the JS engine. diff --git a/test/js/node/async_hooks/async-local-storage-thenable.test.ts b/test/js/node/async_hooks/async-local-storage-thenable.test.ts index 2e76aced80a7..eb7d3e7faf38 100644 --- a/test/js/node/async_hooks/async-local-storage-thenable.test.ts +++ b/test/js/node/async_hooks/async-local-storage-thenable.test.ts @@ -72,6 +72,30 @@ test("Returning a thenable in an async function", async done => { }); }); +// https://github.com/oven-sh/bun/issues/34266 +test("Returning a thenable in an async function after an await", async done => { + const { mustCall } = createCallCheckCtx(done); + const then: Function = mustCall(cb => { + assert.strictEqual(store.getStore(), data); + process.nextTick(cb); + }, 1); + + function thenable() { + return { + get then() { + assert.strictEqual(store.getStore(), data); + return then; + }, + }; + } + + await store.run(data, async () => { + await null; + assert.strictEqual(store.getStore(), data); + return thenable(); + }); +}); + test("Resolving a thenable", async done => { const { mustCall } = createCallCheckCtx(done); const then: Function = mustCall(cb => { From cf8c0d4fc729ec76040fb17a3c6cce0f56202055 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Wed, 15 Jul 2026 21:13:29 +0000 Subject: [PATCH 2/2] ci: retrigger