code wiki / _hdl_build / nx_wd_core.nx

nx_wd_core.nx

buildroot/runtime/_hdl_build/nx_wd_core.nx

16519 B440 linesdepth 3pulls 5 transitivereach 5 importersview sourcekind librarytopic wd
docsdependenciesstructsconstsfunctions

about

nx_wd_core.nx -- DISPATCH-ACT CORE (mainless): the Warden's attempt loop over the assignment queue (X-Q-003 rung 1; spec 2026-06-11-sclass-exceed- backlog.md ADDENDUM Q3). RACI: Warden verb = ATTEMPT/route. This core owns NO priority (PM's w column), NO sequencing policy (an_pick is the Conductor's, imported), NO done-judging (nx_reconcile owns DONE flips on MARK evidence -- this core RUNS reconcile and READS the queue back). THE BEAT (wd_beat), bounded to <=1 raise + <=1 attempt per call: pick = an_pick (highest-w runnable TODO) pick has ||EXEC=<organ> recipe -> ATTEMPT: lane-build+run the organ (deadline-guarded, hang-proof), run nx_reconcile, re-read the queue; row DONE -> ASSIGNRESULT verdict=GREEN row !DONE -> flip row RED (fail-loud, no livelock) + verdict=RED pick has no recipe -> RAISE: flip row TODO->NOVEL (tutor batch picks it up -- "a RAISED-HAND row instead of a silent stall") AND still attempt the best EXEC-covered runnable row so the beat does work. Rung 2 (filed as its own queue row): covered-SHAPE routing via the warden pattern classifier -> emitter lanes; this rung covers the EXEC-recipe class (the X-EX-001 convention) only, and ASSIGNRESULT route= says which. Trust boundary (defensive at boundary law): EXEC basenames come from a hand-curated TSV but are validated anyway -- [a-z0-9_] only, 1..63 chars, so a recipe can never path-escape the lane's source resolution. Queue rewrites change line length (TODO->NOVEL grows, TODO->RED shrinks); sys_openat_wr has no O_TRUNC, so shrink pads trailing '\n' bytes -- an_load and the line-walkers all skip empty lines (verified against their parsers). license_tier: ORIGINAL

dependencies 4 imports · 3 importers

nx_syscalls.nx nx_itoa_lib.nx nx_assign_core.nx nx_guarded_run.nx nx_wd_core.nx _attempt_loop_gate_authored.nx nx_attempt_loop.nx nx_sponsor_core.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_assign_core.nxnx_guarded_run.nx

imported by: _attempt_loop_gate_authored.nxnx_attempt_loop.nxnx_sponsor_core.nx

structs

none

consts

33const WD_MAGIC_1048576: i64 = 1048576
34const WD_MAGIC_1048575: i64 = 1048575
35const WD_MAGIC_4096: i64 = 4096
36const WD_MAGIC_4095: i64 = 4095
38const WD_DEADLINE_DEFAULT: i64 = 600000 // ms; overridden by work_dispatcher.conf exec_deadline_ms=
39const WD_EXECCAP: i64 = 64
120const WD_SPECCAP: i64 = 192

functions

44func wd_newwcx(qp: *u8, respath: *u8, lane: *u8, rec: *u8, ab: *u8, dl: i64) -> *i64
called by 2: mainmain calls 1: sys_mmap
56func wd_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
61func wd_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
63func wd_both(wcx: *i64, s: *u8) -> i64
called by 1: wd_result calls 1: wd_w
70func wd_bothn(wcx: *i64, v: i64) -> i64
called by 1: wd_result calls 1: wd_wn
78func wd_at(buf: *u8, n: i64, i: i64, pat: *u8, pl: i64) -> i64
87func wd_exec_name(gate: *u8, out: *u8) -> i64
called by 2: wd_coveredwd_route_attempt calls 1: wd_at
126func wd_spec_name(gate: *u8, out: *u8) -> i64
called by 2: wd_coveredwd_route_attempt calls 1: wd_at
169func wd_covered(cx: *i64, r: i64) -> i64
180func wd_flip_status(qp: *u8, id: *u8, newst: *u8) -> i64
254func wd_pick_covered(cx: *i64) -> i64
called by 1: wd_beat calls 2: wd_coveredan_deps_done
280func wd_spawn2(wcx: *i64, elf: *u8, a1: *u8) -> i64
called by 1: wd_attempt calls 2: sys_mmapnx_guarded_run
293func wd_result(wcx: *i64, id: *u8, route: *u8, verdict: *u8, rc: i64) -> i64
313func wd_attempt(wcx: *i64, id: *u8, elf: *u8, a1: *u8, route: *u8) -> i64
353func wd_route_attempt(wcx: *i64, cx: *i64, r: i64) -> i64
372func wd_beat(wcx: *i64) -> i64
407func wd_conf_deadline(path: *u8) -> i64