nx_daemon_health_audit.nx
buildroot/runtime/nx_daemon_health_audit.nx
about
nx_daemon_health_audit.nx -- substrate-side audit of running daemons /
proxy chains / nginx-location-block coverage.
module: nishi-core.perception.daemon_health_audit
depends: nishi-core.perception.profile + nishi-core.perception.instrument_diagnostician +
nishi-core.perception.perceptual_dataset + nishi-core.io.syscalls
disk_kb: 5
capability: PERCEPTION
wired_status: PARTIAL_WIRED
MISSING_CAPABILITIES:
- REMOTE_PS_DISPATCH (issue ps + ss + lsof against remote host via SSH
and parse output; SSH primitive lands in queued nx_ssh_client arc)
- DEFUNCT_ZOMBIE_DETECTION -- ★ PROVIDED 2026-06-16 by runtime/nx_zombie_audit.nx (SOVEREIGN, no
ps/shell: scans /proc, parses /proc/<pid>/stat state 'Z', maps each to its parent pid+comm, reports
per-parent zombie counts, flags > threshold as a reap-LEAK). KAT-proven (nx_zombie_audit_gate 2/2:
fork a known 41-cluster -> detected -> reaped -> gone). FOUND REAL LEAKS this session: nx_mp_serve
(516, fixed) + nx_torrent_get workers (76, fixed) -- ALL the no-wait4 fork-hygiene class. TODO here:
call za_scan() in the morning-health-check (nx_daemon_audit_all_claimed) so the doctor auto-flags it.
- NGINX_CONFIG_AUDIT (parse nginx -T output for location blocks +
upstream proxy chains; verify EVERY claimed endpoint has a real
location block routing to a real listening upstream)
- LISTENING_VS_CLAIMED_MISMATCH -- ★ PROVIDED 2026-06-16 by runtime/nx_port_audit.nx (SOVEREIGN, no
ss/netstat: parses /proc/net/tcp + tcp6 for LISTEN sockets (st=0A), extracts local ports, checks each
known Nishi daemon port -> LISTENING or DOWN). FOUND a real outage this session: torrent/gallery/mp
LISTENING, but the WHOLE nishifamily stack DOWN -- sites-tls:8443 + redirect:8080 + vroom-video:8446
+ translate:8447, AND the nx_hostctl supervisor not running (tmpfs-wipe on WSL/reboot, boot-supervise
didn't re-fire). Remediation = nx_hostctl supervise/takeover (REMEDIATION_HOOK, still supervised-only).
- REMEDIATION_HOOK (compose with nx_instrument_diagnostician + the
existing run_if_dead.sh pattern for auto-restart of dead daemons,
STAGE 1 SUPERVISED: substrate proposes, user ratifies first
few restarts)
license_tier: PUBLIC_NISHI_SUBSTRATE
genealogy_id: feedback-substrate-does-heavy-lifting-user-is-partner-not-gate_2026 +
feedback-substrate-primitives-meta-not-one-off_2026 +
feedback-no-false-ok-substrate-honesty-audit +
feedback-launching-content-must-be-one-command-easy +
feedback-self-surfacing-intelligence-staged-autonomy
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_perceptual_profile.nxnx_instrument_diagnostician.nxnx_perceptual_dataset.nx
imported by: nobody (leaf or entry point)
structs
| 102 | struct NxDaemonAuditFinding |
consts
| 72 | const NX_DAEMON_OK: i64 = 0 |
| 73 | const NX_DAEMON_RUNNING_BUT_HUNG: i64 = 1 // process alive, port |
| 76 | const NX_DAEMON_DEFUNCT_ZOMBIE: i64 = 2 // <defunct> in ps |
| 77 | const NX_DAEMON_NOT_LISTENING_ON_CLAIMED: i64 = 3 // process up, no socket |
| 78 | const NX_DAEMON_LISTENING_BUT_NO_ROUTE: i64 = 4 // bound but no nginx |
| 81 | const NX_DAEMON_RESPONDING_WRONG_CONTENT: i64 = 5 // upstream returned but |
| 85 | const NX_DAEMON_NOT_RUNNING_AT_ALL: i64 = 6 |
| 86 | const NX_DAEMON_DEPENDENCY_MISSING: i64 = 7 // PARTIAL_WIRED default |
functions
| 88 | func nx_daemon_verdict_name(v: i64) -> *u8 |
| 126 | func nx_daemon_audit_one(daemon_name_ptr: *u8, daemon_name_len: i64, |
| 142 | func nx_daemon_audit_all_claimed(failures_count_out: *i64) -> i64 |
| 152 | func nx_daemon_audit_register_pair(daemon_name_ptr: *u8, daemon_name_len: i64, |
| 169 | func nx_daemon_audit_propose_remediation(finding_ptr: *NxDaemonAuditFinding, |
| 178 | func nx_daemon_audit_get_last_verdict() -> i64 |