Revert cek_run import patch — caused infinite CEK loop on server
The cek_run import handling (resume after hook loads library) caused cek_step_loop to infinite-loop during aser page rendering. Root cause not yet identified — the resumed CEK state never reaches terminal. Reverted to original cek_run that throws "IO suspension in non-IO context". The 4 server startup errors are harmless (files load partially, all needed symbols available via other paths). Import hook re-entry guard and debug logging retained for future work. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -794,16 +794,28 @@ let () =
|
||||
Hashtbl.replace _shared_vm_globals name v)
|
||||
|
||||
(* Import hook — resolves (import ...) suspensions inside eval_expr/cek_run.
|
||||
Loads the .sx file for the library, registers it, and returns true. *)
|
||||
Loads the .sx file for the library, registers it, and returns true.
|
||||
Re-entry guard prevents infinite loops from circular or failing imports. *)
|
||||
let _loading_libs : (string, bool) Hashtbl.t = Hashtbl.create 8
|
||||
let () =
|
||||
Sx_types._import_hook := Some (fun lib_spec ->
|
||||
if Sx_types.sx_truthy (Sx_ref.library_loaded_p lib_spec) then true
|
||||
else match resolve_library_path lib_spec with
|
||||
else
|
||||
let key = Sx_types.inspect lib_spec in
|
||||
if Hashtbl.mem _loading_libs key then false (* already loading — break cycle *)
|
||||
else begin
|
||||
Hashtbl.replace _loading_libs key true;
|
||||
let result = match resolve_library_path lib_spec with
|
||||
| Some path ->
|
||||
(try load_library_file path;
|
||||
true
|
||||
with _ -> false)
|
||||
| None -> false)
|
||||
(try load_library_file path; true
|
||||
with e ->
|
||||
Printf.eprintf "[import-hook] FAIL %s from %s: %s\n%!"
|
||||
key path (Printexc.to_string e);
|
||||
false)
|
||||
| None -> false in
|
||||
(* Don't remove — keep as "attempted" guard to prevent retries *)
|
||||
result
|
||||
end)
|
||||
|
||||
let make_server_env () =
|
||||
let env = make_env () in
|
||||
|
||||
Reference in New Issue
Block a user