code wiki / _hdl_build / nx_hostctl_keepbackoff_gate.nx
nx_hostctl_keepbackoff_gate.nx
buildroot/runtime/_hdl_build/nx_hostctl_keepbackoff_gate.nx
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
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
structs
| none |
consts
| 26 | const KB_SRC: *u8 = "runtime/_hdl_build/nx_hostctl.nx" |
| 27 | const KB_LOG: *u8 = "knowledge/status/hostctl_keepbackoff_gate.log" |
| 28 | const KB_CAP: i64 = 2097152 |
| 29 | const KB_MODE: i64 = 420 |
functions
| 31 | func kb_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 32 | func kb_w(fd: i64, s: *u8) -> i64 { let n: i64 = kb_len(s); sys_write(fd, s, n); return 0 } |
| 33 | func kb_p(s: *u8) -> i64 { return kb_w(1, s) } |
| 34 | func kb_pn(v: i64) -> i64 |
| 47 | func kb_ck(name: *u8, c: i64) -> i64 |
| 54 | func kb_delay(fastfails: i64, shortfails: i64) -> i64 called by 1: main |
| 61 | func kb_delay_old(fastfails: i64) -> i64 called by 1: main |
| 66 | func kb_read(path: *u8, buf: *u8) -> i64 |
| 84 | func kb_find(buf: *u8, n: i64, pat: *u8) -> i64 |
| 98 | func main() -> i64 |