Restore cek_run IO hooks and cek_step_loop error handling lost by bootstrap

bootstrap.py regenerated cek_run as a simple "raise if suspended" without
the _cek_io_resolver and _cek_io_suspend_hook checks. Also lost the
CekPerformRequest catch in cek_step_loop and step_limit checks.

This was the direct cause of "IO suspension in non-IO context" when island
click handlers called perform (via hs-wait). The CEK had no way to propagate
the suspension to the VM/JS boundary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 14:01:14 +00:00
parent aef92cc1f3
commit f276c4a56a
5 changed files with 78 additions and 31 deletions

View File

@@ -89,17 +89,10 @@
window._driveAsync = function driveAsync(result) {
if (!result || !result.suspended) return;
var req = result.request;
// Request can be dict {op, args} or list (op-name arg ...)
var opName, arg;
if (req && req._type === "dict" && req.op) {
opName = req.op;
arg = req.args && req.args.items ? req.args.items[0] : null;
} else {
var items = req && (req.items || req);
var op = items && items[0];
opName = typeof op === "string" ? op : (op && op.name) || String(op);
arg = items && items[1];
}
var items = req && (req.items || req);
var op = items && items[0];
var opName = typeof op === "string" ? op : (op && op.name) || String(op);
var arg = items && items[1];
if (opName === "io-sleep" || opName === "wait") {
setTimeout(function() {
try { driveAsync(result.resume(null)); } catch(e) { console.error("[sx] driveAsync:", e.message); }