nx_swarm_tend.nx
buildroot/runtime/nx_swarm_tend.nx
about
nx_swarm_tend.nx -- ACTIVE QUEUE TENDER (operator 2026-07-16: "whoever in the nishi RACI is part
of the queue -- use it WELL, not fire-and-forget letting things block and get traffic jams; SOTA").
THE GAP: nx_swarm_queue reaps dead holders PASSIVELY (only when a waiter polls sq_try_grant). If a
holder dies with NO waiters polling, its slot LEAKS forever; starvation + jams are invisible. My own
1.5B job queued 45min and timed out unnoticed -- the fire-and-forget failure. THE FIX: an active
tender the CONDUCTOR (RACI schedule_resources|R = Responsible-for-draining) runs on a loop / on
demand:
* REAP: proactively DONE any HOLD whose pid is DEAD -> slots free even with no waiter polling.
* DETECT: a waiter starved past a jam threshold = JAMMED (the traffic-jam alarm), the oldest
wait-age reported so the PM sees pressure building BEFORE a timeout.
* VERDICT: OK / DRAINING (waiters progressing) / JAMMED (starvation) -- health, not silence.
tend reap + scan + report + verdict-exit (0 OK / 1 DRAINING / 2 JAMMED)
Sovereign store (knowledge/store/swarm_sched) is the SSOT; PURE tend_verdict is gate-testable.
license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_swarm_queue.nx
imported by: nx_swarm_tend_gate.nxnx_tend_t3_probe.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 17 | const TEND_JAM_MS: i64 = 300000 // a waiter silent > 5min = JAMMED (data-driven default) |
| 18 | const TEND_OK: i64 = 0 |
| 19 | const TEND_DRAINING: i64 = 1 |
| 20 | const TEND_JAMMED: i64 = 2 |
functions
| 23 | func tend_verdict(waiters: i64, oldest_wait_ms: i64, jam_ms: i64) -> i64 |
| 31 | func tend_reap() -> i64 |
| 76 | func tend_health(holders_out: *i64, oldest_ms_out: *i64) -> i64 |
| 102 | func tend_run() -> i64 |
| 123 | func main(argc: i64, argv: *i64) -> i64 |