WIP: bytecode when/do/perform — host-callback _driveAsync fix + debugging
Root cause identified: nested cek_call_or_suspend calls on same VM overwrite pending_cek. First call suspends (thunk's hs-wait), second call from synchronous dom-listen callback overwrites before resume. sandbox host-callback: removed _driveAsync call to prevent duplicate resume chains. Still 3/6 in Node.js test — issue is in OCaml call stack nesting, not JS async. Next: prevent pending_cek overwrite in nested CEK→VM→CEK→VM chains. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1391,9 +1391,10 @@ 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() {
|
||||
const r = K.callFn(fn, Array.from(arguments));
|
||||
window._driveAsync(r);
|
||||
return r;
|
||||
// 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));
|
||||
};
|
||||
}
|
||||
return function() {};
|
||||
|
||||
Reference in New Issue
Block a user