code wiki / (root) / nx_deploy_leash.nx

nx_deploy_leash.nx

buildroot/runtime/nx_deploy_leash.nx

10774 B270 linesdepth 5pulls 7 transitivereach 1 importersview sourcekind tooltopic deploy
docsdependenciesstructsconstsfunctions

about

nx_deploy_leash.nx -- DEPLOYMENTS ON A LEASH (operator 2026-07-16: "owners take accountability... models loaded into resources and the owner walks away... someone should have our deployments on a leash, not just let them wander loose -- part of the RACI"). Every long-lived deployment (model seat, serve daemon, heavy holder) REGISTERS: accountable owner + purpose + pid + renewal TTL + its own STOP-PATH (a declared graceful kill-switch -- reclaim is never a blind kill). The leash is RENEWAL-BASED liveness of the OWNER'S USE (nx_watch beats on every use), NOT process liveness -- a seat daemon stays alive forever, so pid-checks can never catch walk-away. SOTA norm this matches: K8s lease renewal / SLURM walltime / Ray actor liveness -- resources held AGAINST RENEWAL. register <name> <owner> <purpose> <pid> <renew_ttl_ms> <stop_path> (also starts the leash clock) beat = nx_watch beat leash <name> (consumers beat on every USE; no new plumbing) walk supervisor's rounds: HEALTHY / ABANDONED(alive+stale-beat -> touch stop_path, mark RECLAIMED) / DEAD(pid gone). Exit = worst seen (0 none/healthy, 2 dead, 3 abandoned). status same scan, print-only (no reclaim actions). Store: knowledge/store/leash key d:<name> = "name|owner|purpose|pid|ttl_ms|stop_path|reg_us" (latest-wins), d:ids index under flock. Beat clock: knowledge/store/watch_leash via nx_watch. RACI: supervisor R (walks the leash) · pm A (owns the box) · conductor C · every workstream I. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_watch.nx nx_model_lane_core.nx nx_deploy_leash.nx nx_deploy_leash_gate.nx

imports: nx_watch.nxnx_model_lane_core.nx

imported by: nx_deploy_leash_gate.nx

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

main std_putln std_puts std_slen sys_write std_streq dl_register std_itoa sys_mmap sys_now_us sys_mmap ↻ sys_clock_gettime_mono dl_key sov_put ss_begin ss_begin_cap sys_mmap ↻ ss_add ss_add2 ss_w32 ss_len ss_commit ss_segid_ok sys_mmap ↻ ss_cat ss_catn sys_mmap ↻ sys_write ↻ ss_write_seg ss_segid_ok ↻ sys_mmap ↻ ss_cat ↻ ss_catn ↻ sys_write ↻ ss_segname ss_cat ↻ ss_catn ↻ ss_writefile sys_openat_wr sys_write ↻

structs

none

consts

20const DL_MAGIC_262144: i64 = 262144
21const DL_MAGIC_262143: i64 = 262143
22const DL_MAGIC_999999999: i64 = 999999999
24const DL_STORE: *u8 = "knowledge/store/leash"
25const DL_LOCK: *u8 = "knowledge/status/leash.lock"
26const DL_HEALTHY: i64 = 0
27const DL_DEAD: i64 = 2
28const DL_ABANDONED: i64 = 3

functions

31func dl_verdict(pid_alive: i64, beat_age_ms: i64, renew_ttl_ms: i64) -> i64
called by 2: dl_walkmain
38func dl_key(name: *u8, out: *u8) -> i64
called by 2: dl_registerdl_walk
48func dl_add_id(name: *u8) -> i64
88func dl_register(name: *u8, owner: *u8, purpose: *u8, pid: i64, ttl_ms: i64, stop_path: *u8) -> i64
119func dl_field(row: *u8, n: i64, k: i64, out: *u8, cap: i64) -> i64
called by 1: dl_walk
136func dl_walk(act: i64) -> i64
219func sq_field_int(row: *u8, n: i64, k: i64) -> i64
called by 1: dl_walk
234func main(argc: i64, argv: *i64) -> i64