code wiki / _hdl_build / nx_hostctl_keepbackoff_gate.nx

nx_hostctl_keepbackoff_gate.nx

buildroot/runtime/_hdl_build/nx_hostctl_keepbackoff_gate.nx

9615 B189 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic hostctl
docsdependenciesstructsconstsfunctions

about

nx_hostctl_keepbackoff_gate.nx -- proves the reader-keeper's respawn CIRCUIT-BREAKER actually engages for the failure mode that really happens. Written because the fix it guards touches a CROWN-JEWEL file (nx_hostctl, the supervisor) and must not ship on "it compiles". THE DEFECT THIS GATE EXISTS FOR (found 2026-07-20 while diagnosing a wedged NAS): cmd_reader_keep counted ONLY fast (<5s) code=1 bind-fails toward its breaker: if sig == 0 { if code == 1 { if life_us < 5000000 { isfast = 1 } } } ...but cmd_reader_keep's OWN header documents the real failure mode as "reliably kills it ~15s later". 15s > 5s, so isfast was never set, fastfails never reached 8, and THE BREAKER WAS DEAD CODE FOR THE ONLY FAILURE THAT ACTUALLY HAPPENS -- an unbounded ~1-per-16s respawn, forever, with no escalation and no give-up. WHY THE POLICY IS MIRRORED HERE RATHER THAN IMPORTED: making nx_hostctl import a new module would leave the supervisor UNBUILDABLE on any host that has not yet received that module -- a deploy trap for a crown-jewel target. So the policy is mirrored, and T7 MECHANICALLY TIES THE MIRROR TO REALITY by reading nx_hostctl.nx and asserting the real thresholds are present. A silent drift between the two therefore FAILS the gate instead of rotting quietly (this is the anti-dup-source discipline). T6 is the liar-killer: it replays the ORIGINAL (fast-only) policy against the observed failure mode and REQUIRES it to fail to escalate. A gate that cannot demonstrate it catches the bug it was written for is decoration. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_artifact_root.nx nx_hostctl_keepbackoff_gate.nx

imports: nx_syscalls.nxnx_artifact_root.nx

imported by: nobody (leaf or entry point)

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

main kb_p kb_w kb_len sys_write kb_delay kb_ck kb_p ↻ kb_delay_old sys_mmap ar_resolve ar_resolve_with ar_exists sys_openat_rd sys_close sys_mmap ↻ ar_read sys_openat_rd ↻ sys_read sys_close ↻ kb_read sys_openat_rd ↻ sys_read ↻ sys_close ↻ kb_pn sys_mmap ↻ sys_write ↻ kb_find kb_len ↻ sys_openat_append kb_w ↻ sys_close ↻ sys_exit

structs

none

consts

26const KB_SRC: *u8 = "runtime/_hdl_build/nx_hostctl.nx"
27const KB_LOG: *u8 = "knowledge/status/hostctl_keepbackoff_gate.log"
28const KB_CAP: i64 = 2097152
29const KB_MODE: i64 = 420

functions

31func kb_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: kb_wkb_find
32func kb_w(fd: i64, s: *u8) -> i64 { let n: i64 = kb_len(s); sys_write(fd, s, n); return 0 }
called by 2: kb_pmain calls 2: kb_lensys_write
33func kb_p(s: *u8) -> i64 { return kb_w(1, s) }
called by 2: kb_ckmain calls 1: kb_w
34func kb_pn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
47func kb_ck(name: *u8, c: i64) -> i64
called by 1: main calls 1: kb_p
54func kb_delay(fastfails: i64, shortfails: i64) -> i64
called by 1: main
61func kb_delay_old(fastfails: i64) -> i64
called by 1: main
66func kb_read(path: *u8, buf: *u8) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
84func kb_find(buf: *u8, n: i64, pat: *u8) -> i64
called by 1: main calls 1: kb_len
98func main() -> i64