nx_daemon_budget_gate.nx
buildroot/runtime/nx_daemon_budget_gate.nx
about
nx_daemon_budget_gate.nx -- REGRESSION PROOF for the self-retiring-daemon class (debt seq882, 2026-07-25).
THE DEFECT IT LOCKS OUT: 44 sovereign daemons run `while served < budget { accept... } sys_exit(0)`. A
supervised daemon launched with a SMALL finite budget therefore RETIRES ITSELF -- and nx_hostctl's guard
(nx_hostctl.nx:798) reads the repeated exits as a crash-loop and BACKS OFF, so the surface goes genuinely
DOWN while `status` still prints UP. Measured live: the gallery gateway, the wiki/hub/torrent/gen gateways,
the main OPAQUE login daemon AND the mgmt API itself were all launched with budget=5000. That is the root
cause of the operator-reported "gallery wont let me login" AND of the chronic mgmt/MCP transport flake.
nx_docportal_search_serve.nx:303 documents this same failure being diagnosed on 2026-07-03 -- fixed there
and never swept. This gate exists so it can never silently return.
WHY ASSERT ON BYTES, NOT ON INTENT: an author-optimism check ("we fixed it") is not evidence. Each tooth
greps the actual launch-command constant. T8 greps the LIVE DEPLOYED BINARY, not just source -- this session
proved that class of lie twice (a carve-out banked in memory as "landed in source" was NOT in source, and a
deployed gallery thumbnailer predated its own fix by three weeks). Source-GREEN + binary-RED = NOT SHIPPED.
T9 is the MUTATION tooth: it fails if the exact bad literal ever reappears, so a revert cannot pass quietly.
Run from the nishihost CWD (the tools daemon fork-execs it there). license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 21 | const DBG_CAP: i64 = 1048576 |
| 22 | const DBG_MIN_BUDGET: i64 = 1000000 |
functions
| 24 | func dbg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 25 | func dbg_puts(s: *u8) -> i64 { sys_write(1, s, dbg_slen(s)); return 0 } |
| 26 | func dbg_putn(v: i64) -> i64 |
| 41 | func dbg_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 54 | func dbg_contains(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 69 | func dbg_tooth(buf: *u8, n: i64, needle: *u8, label: *u8, pass: *i64) -> i64 |
| 78 | func dbg_tooth_absent(buf: *u8, n: i64, needle: *u8, label: *u8, pass: *i64) -> i64 |
| 86 | func main(argc: i64, argv: *i64) -> i64 |