nx_svc_budget_gate.nx
buildroot/runtime/nx_svc_budget_gate.nx
about
nx_svc_budget_gate.nx -- REGRESSION PROOF for the self-retiring-service class (debt seq882, 2026-07-25).
THE DEFECT IT LOCKS OUT: 44 sovereign services run `while served < budget { accept... } sys_exit(0)`. One
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 2026-07-25: the gallery gateway, the wiki/hub/torrent/gen gateways, the main
OPAQUE login (:9091) 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 diagnosed on 2026-07-03 -- fixed there, never
swept. This gate exists so it can never silently return.
WHY IT ASSERTS ON BYTES, NOT INTENT: "we fixed it" is author optimism, not evidence. Each tooth greps the
actual launch-command constant. T8 greps the LIVE DEPLOYED BINARY, not just source -- this session proved
that lie twice (a carve-out banked in memory as "landed in source" was NOT in source; a deployed gallery
thumbnailer predated its own fix by three weeks). Source-GREEN + binary-RED = NOT SHIPPED. T9/T10 are
MUTATION teeth: they fail if the exact bad literal reappears, so a revert cannot pass quietly.
Named _svc_ not _daemon_ deliberately: md_promote_deny substring-blocks "daemon" so real daemons are forced
through the health-checked /api/deploy. This is a one-shot organ, so the honest name is the promotable one.
Run from the nishihost CWD (the tools daemon fork-execs it there). license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.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
| 25 | const SBG_CAP: i64 = 1048576 |
| 26 | const SBG_MIN_BUDGET: i64 = 1000000 |
functions
| 28 | func sbg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 29 | func sbg_puts(s: *u8) -> i64 { sys_write(1, s, sbg_slen(s)); return 0 } |
| 30 | func sbg_putn(v: i64) -> i64 |
| 45 | func sbg_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 58 | func sbg_contains(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 75 | func sbg_tooth(buf: *u8, n: i64, needle: *u8, label: *u8, pass: *i64, ctr: *i64) -> i64 |
| 83 | func sbg_tooth_absent(buf: *u8, n: i64, needle: *u8, label: *u8, pass: *i64, ctr: *i64) -> i64 |
| 91 | func main(argc: i64, argv: *i64) -> i64 |