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:
2026-04-08 21:21:08 +00:00
parent 4ca92960c4
commit 7a1af7a80a
2 changed files with 12 additions and 4 deletions

View File

@@ -952,7 +952,14 @@ let () = _vm_suspension_to_dict := (fun exn ->
Hashtbl.replace d "__vm_suspended" (Bool true);
Hashtbl.replace d "request" request;
Hashtbl.replace d "resume" (NativeFn ("vm-resume", fun args ->
match args with [result] -> resume_vm vm result | _ -> Nil));
match args with
| [result] ->
(try resume_vm vm result
with exn2 ->
match !_vm_suspension_to_dict exn2 with
| Some marker -> marker
| None -> raise exn2)
| _ -> Nil));
Some (Dict d)
| _ -> None)
let () = _cek_eval_lambda_ref := (fun f args ->