From 52165f6a2a781c2a73ba5b3dd996cbbac6ba1d1e Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 8 Apr 2026 21:40:17 +0000 Subject: [PATCH] Restore _driveAsync in sandbox host-callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the pending_cek snapshot fix, _driveAsync no longer causes duplicate resume chains. Needed for event-triggered suspensions (btn.click → handler → perform) where the suspension propagates through addEventListener, invisible to the outer eval. Sandbox bytecode test: 6/6 io-sleep suspensions confirmed. Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/playwright/sx-inspect.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/playwright/sx-inspect.js b/tests/playwright/sx-inspect.js index ea5c0866..2159b291 100644 --- a/tests/playwright/sx-inspect.js +++ b/tests/playwright/sx-inspect.js @@ -1391,10 +1391,9 @@ async function modeSandbox(page, expr, files, setup, stack, bytecode) { if (typeof fn === 'function' && fn.__sx_handle === undefined) return fn; if (fn && fn.__sx_handle !== undefined) { return function() { - // Do NOT call _driveAsync here — the suspension propagates through - // the normal CEK/VM return path. The outer callFn handles it. - // Calling _driveAsync would create a duplicate resume chain. - return K.callFn(fn, Array.from(arguments)); + const r = K.callFn(fn, Array.from(arguments)); + window._driveAsync(r); + return r; }; } return function() {};