code wiki / _hdl_build / nx_wd_core.nx
nx_wd_core.nx
buildroot/runtime/_hdl_build/nx_wd_core.nx
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
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
| 33 | const WD_MAGIC_1048576: i64 = 1048576 |
| 34 | const WD_MAGIC_1048575: i64 = 1048575 |
| 35 | const WD_MAGIC_4096: i64 = 4096 |
| 36 | const WD_MAGIC_4095: i64 = 4095 |
| 38 | const WD_DEADLINE_DEFAULT: i64 = 600000 // ms; overridden by work_dispatcher.conf exec_deadline_ms= |
| 39 | const WD_EXECCAP: i64 = 64 |
| 120 | const WD_SPECCAP: i64 = 192 |
functions
| 44 | func wd_newwcx(qp: *u8, respath: *u8, lane: *u8, rec: *u8, ab: *u8, dl: i64) -> *i64 |
| 56 | func 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 } |
| 61 | func wd_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 63 | func wd_both(wcx: *i64, s: *u8) -> i64 |
| 70 | func wd_bothn(wcx: *i64, v: i64) -> i64 |
| 78 | func wd_at(buf: *u8, n: i64, i: i64, pat: *u8, pl: i64) -> i64 |
| 87 | func wd_exec_name(gate: *u8, out: *u8) -> i64 |
| 126 | func wd_spec_name(gate: *u8, out: *u8) -> i64 |
| 169 | func wd_covered(cx: *i64, r: i64) -> i64 |
| 180 | func wd_flip_status(qp: *u8, id: *u8, newst: *u8) -> i64 called by 3: sr_applywd_attemptwd_beat calls 7: sys_mmapsys_openat_rdsys_readsys_closewd_atsys_openat_wr+1 |
| 254 | func wd_pick_covered(cx: *i64) -> i64 |
| 280 | func wd_spawn2(wcx: *i64, elf: *u8, a1: *u8) -> i64 |
| 293 | func wd_result(wcx: *i64, id: *u8, route: *u8, verdict: *u8, rc: i64) -> i64 |
| 313 | func wd_attempt(wcx: *i64, id: *u8, elf: *u8, a1: *u8, route: *u8) -> i64 |
| 353 | func wd_route_attempt(wcx: *i64, cx: *i64, r: i64) -> i64 |
| 372 | func wd_beat(wcx: *i64) -> i64 called by 4: alg_beats_aalg_beats_balg_beats_cmain calls 13: an_newcxan_loadwd_wsys_openat_appendan_pickwd_result+7 |
| 407 | func wd_conf_deadline(path: *u8) -> i64 |