code wiki / (root) / nx_substrate_python_spawn_test.nx

nx_substrate_python_spawn_test.nx

buildroot/runtime/nx_substrate_python_spawn_test.nx

4783 B130 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic substrate
docsdependenciesstructsconstsfunctions

about

nx_substrate_python_spawn.nx -- substrate IS a Python supervisor. Cardinal 2026-05-21 ("bits up top down bottom up everything till we own silicon"): this is the bottom-up convergence witness. A NishiLang ELF, compiled by nxc2 and running under qemu/WSL2, becomes the PARENT process of /usr/bin/python3. No bash spawn step. Substrate calls nx_hal_spawn -> sys_fork + sys_execve; child runs Python; parent reaps via nx_hal_wait. What this proves end-to-end: - nx_hal_spawn handles real-world execve (Python interpreter is a much larger / more complex binary than /bin/echo + /bin/true in the prior smoke 10bc9d89) - argv marshalling works for multi-arg invocations (-c "code") - exit-code propagation works for arbitrary 0..255 codes (test specifically requests exit 42 to prove the value reaches the substrate parent and isn't masked to 0/1) - Substrate can supervise a Python lifecycle the same way a container runtime does: spawn + observe + reap Gap left open after this commit: - WSL2 Python (3.12) has NO fastapi/uvicorn/pydantic installed today. Wiring substrate-spawn into the real Elder AI service path requires installing those Python deps in WSL2 OR adding a Windows backend to nxc2 (multi-session) so the substrate ELF runs natively on Windows and spawns Win32 python.exe. - This smoke is the proof-of-concept; production Elder AI services still launch via bash adapter today (commits 4551a0d5 / 5e203032 / 6d43d14e / 18f567d3). genealogy_id: docker_runc_init_2014 + systemd_lifespan_2010 + cardinal_2026-05-21_top_down_bottom_up_dual_mandate lineage_id: substrate_python_supervisor_v0_smoke

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_hal.nx nx_substrate_python_spawn_test

imports: nx_syscalls.nxnx_hal.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap _emit_stdout sys_write nx_hal_spawn nx_hal_active_shim nx_hal_spawn_linux sys_fork sys_execve nx_hal_exit nx_hal_active_shim ↻ nx_hal_exit_linux nx_hal_exit_bare_metal nx_hal_exit_nishi_silicon nx_hal_spawn_bare_metal nx_hal_spawn_nishi_silicon nx_hal_wait nx_hal_active_shim ↻ nx_hal_wait_linux sys_mmap ↻ sys_wait4 wait_exit_code nx_hal_wait_bare_metal nx_hal_wait_nishi_silicon

structs

none

consts

none

functions

38func _emit_stdout(buf: *u8, len: i64) -> i64
called by 1: main calls 1: sys_write
42func main() -> i64