Fix JIT nil-param crash: guard execute-request, restore error logging

- orchestration.sx: add nil guard for verb/url before calling do-fetch
  (prevents "Expected string, got nil" when verb info dict lacks method)
- sx_browser.ml: restore JIT error logging (Eval_error only, not all
  exceptions) so real failures are visible, silence routine fallbacks
- Rebuild WASM bundle with fixes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 17:22:06 +00:00
parent f33eaf8f3a
commit 2802dd99e2
9 changed files with 1411 additions and 13 deletions

View File

@@ -582,9 +582,9 @@ let () =
(match l.l_compiled with (match l.l_compiled with
| Some cl when not (Sx_vm.is_jit_failed cl) -> | Some cl when not (Sx_vm.is_jit_failed cl) ->
(try Some (Sx_vm.call_closure cl args cl.vm_env_ref) (try Some (Sx_vm.call_closure cl args cl.vm_env_ref)
with e -> with Eval_error msg ->
let fn_name = match l.l_name with Some n -> n | None -> "?" in let fn_name = match l.l_name with Some n -> n | None -> "?" in
Printf.eprintf "[jit] DISABLED %s — %s\n%!" fn_name (Printexc.to_string e); Printf.eprintf "[jit] DISABLED %s — %s\n%!" fn_name msg;
l.l_compiled <- Some Sx_vm.jit_failed_sentinel; l.l_compiled <- Some Sx_vm.jit_failed_sentinel;
None) None)
| Some _ -> None | Some _ -> None
@@ -595,18 +595,14 @@ let () =
let globals = env_to_vm_globals global_env in let globals = env_to_vm_globals global_env in
let compiled = Sx_vm.jit_compile_lambda l globals in let compiled = Sx_vm.jit_compile_lambda l globals in
_jit_compiling := false; _jit_compiling := false;
let fn_name = match l.l_name with Some n -> n | None -> "?" in
(match compiled with (match compiled with
| Some cl -> | Some cl ->
l.l_compiled <- Some cl; l.l_compiled <- Some cl;
(try Some (Sx_vm.call_closure cl args cl.vm_env_ref) (try Some (Sx_vm.call_closure cl args cl.vm_env_ref)
with e -> with _ ->
Printf.eprintf "[jit] DISABLED %s — %s\n%!" fn_name (Printexc.to_string e);
l.l_compiled <- Some Sx_vm.jit_failed_sentinel; l.l_compiled <- Some Sx_vm.jit_failed_sentinel;
None) None)
| None -> | None -> None)
Printf.eprintf "[jit] FAIL %s\n%!" fn_name;
None)
end) end)
| _ -> None) | _ -> None)

View File

@@ -97,7 +97,7 @@
(if (and prompt-msg (nil? prompt-val)) (if (and prompt-msg (nil? prompt-val))
(promise-resolve nil) (promise-resolve nil)
;; Validation gate ;; Validation gate
(if (not (validate-for-request el)) (if (or (nil? verb) (nil? url) (not (validate-for-request el)))
(promise-resolve nil) (promise-resolve nil)
(do-fetch el verb verb url (do-fetch el verb verb url
(if prompt-val (if prompt-val

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1792,7 +1792,7 @@
blake2_js_for_wasm_create: blake2_js_for_wasm_create}; blake2_js_for_wasm_create: blake2_js_for_wasm_create};
} }
(globalThis)) (globalThis))
({"link":[["runtime-0db9b496",0],["prelude-d7e4b000",0],["stdlib-23ce0836",[]],["sx-ea36a0db",[2]],["jsoo_runtime-f96b44a8",[2]],["js_of_ocaml-651f6707",[2,4]],["dune__exe__Sx_browser-cafa954c",[2,3,5]],["std_exit-10fb8830",[2]],["start-29cf9a72",0]],"generated":(b=>{var ({"link":[["runtime-0db9b496",0],["prelude-d7e4b000",0],["stdlib-23ce0836",[]],["sx-ea36a0db",[2]],["jsoo_runtime-f96b44a8",[2]],["js_of_ocaml-651f6707",[2,4]],["dune__exe__Sx_browser-8f530291",[2,3,5]],["std_exit-10fb8830",[2]],["start-29cf9a72",0]],"generated":(b=>{var
c=b,a=b?.module?.export||b;return{"env":{"caml_ba_kind_of_typed_array":()=>{throw new c=b,a=b?.module?.export||b;return{"env":{"caml_ba_kind_of_typed_array":()=>{throw new
Error("caml_ba_kind_of_typed_array not implemented")},"caml_exn_with_js_backtrace":()=>{throw new Error("caml_ba_kind_of_typed_array not implemented")},"caml_exn_with_js_backtrace":()=>{throw new
Error("caml_exn_with_js_backtrace not implemented")},"caml_int64_create_lo_mi_hi":()=>{throw new Error("caml_exn_with_js_backtrace not implemented")},"caml_int64_create_lo_mi_hi":()=>{throw new

View File

@@ -97,7 +97,7 @@
(if (and prompt-msg (nil? prompt-val)) (if (and prompt-msg (nil? prompt-val))
(promise-resolve nil) (promise-resolve nil)
;; Validation gate ;; Validation gate
(if (not (validate-for-request el)) (if (or (nil? verb) (nil? url) (not (validate-for-request el)))
(promise-resolve nil) (promise-resolve nil)
(do-fetch el verb verb url (do-fetch el verb verb url
(if prompt-val (if prompt-val