nsbx: fail loud on daemon-not-ready + el_seed.c standalone compile #118
Reference in New Issue
Block a user
Delete Branch "fix/nsbx-tooling-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
nsbx tooling hardening
Three confirmed-live bugs from tonight's session, each verified with real before/after command output (not just code review):
False "ready" banner.
nsbx upon an existing-but-dead sandbox printed the readiness-failure warning immediately followed by a green "your sandbox is ready" success banner and exited 0. Root cause:daemon_alive "$name" || start_daemon "$name"incmd_upnever checkedstart_daemon's return code. Same unguarded pattern existed incmd_build,cmd_run,cmd_validate. All four now|| diewith a pointer todaemon.log.Stale liveness reporting.
nsbx status/nsbx listreported barestate: runningfor a process that's alive (kill -0passes) but not actually answering/api/stats-- pegged, hung, or mid-boot. Addeddaemon_health(), which does the real stats fetch (short 2s timeout) and distinguishes stopped/running/unresponsive. Reproduced live against another agent's actively-running (CPU-pinned, 100% CPU, LISTENing but not responding) sandbox tonight, and again via a deliberateSIGSTOPon a throwaway sandbox of my own.No visibility into stale binaries.
status/listnow show the binary's sha + real build timestamp (mtime survivescp -p, so it's the original build time even for stock-prod clones), plus a best-effort staleness note: for stock-prod clones, compare against the currently-configured live binary; for source/branch builds, compare the recorded source commit against localorigin/devviamerge-base --is-ancestor.Also found and fixed while verifying the above (live, not manufactured):
NSBX_READY_TIMEOUT_SECS) instead of blindly widening the default.cmd_create's post-boot baseline capture could silently recordsbx_baselineas0/0when the stats fetch came back empty right after the auto-remerge step -- which would make every futurensbx validatezero-loss/reboot-prove check trivially PASS regardless of real data loss. Added a bounded retry + loud warning.lang: el_seed.c standalone compile
runtime/el_seed.cdidn't compile via the exact commandtools/install.shuses. 51 of its__-prefixed wrappers (http serving, JSON, key-val state, URL/HTML escaping, the wholeengram_*surface) call unprefixed counterparts implemented inel_runtime.cbut never declared inel_seed.c.install.shalready compiles both files separately and archives them intolibel.a, so the symbols are always present at link time --el_seed.cwas just missing the prototypes. A plain#include "el_runtime.h"was tried and rejected (redefinesel_to_float/el_from_float, already provided byel_seed.h); added narrow prototypes for exactly the 51 symbols instead.Verified:
cc -std=c11 -O2 -I runtime -c runtime/el_seed.c(0 errors/warnings,-ferror-limit=0) and a fulltools/install.shrun (libel.abuilt successfully).Confirmed before editing: the
AGENTS.mdwarning about a protectedel-compiler/runtime/el_seed.cpath describes a layout that doesn't exist in this worktree (lang/el-compiler/runtime/is absent) -- the real, current file atlang/runtime/el_seed.cisn't what that warning protects.Noted but explicitly NOT fixed here (separate, pre-existing, unrelated to this change):
AGENTS.md's documented compiler self-rebuild command fails regardless of which runtime file it links against (elc-new.c references 3 symbols that exist in neitherel_runtime.cnorel_seed.c), andinstall.sh'slibel.adoesn't archive theengram_*.cengine files, so any program that calls into theengram_*surface fails to link against it. Both worth their own look.Sandboxes touched
All verification used my own throwaway sandboxes (created and destroyed within this session).
dev-api-reshape(stopped) andtransduce-verify(running, another agent's active work) were left untouched throughout --transduce-verifywas torn down by its own owning session partway through mine, not by me.runtime/el_seed.c does not compile standalone via the exact command tools/install.sh uses (`cc -std=c11 -O2 -I runtime -c runtime/el_seed.c`): 51 of its __-prefixed wrapper functions (http serving, JSON access, key-val state, URL/HTML escaping, and the whole engram_* node/edge/layer/search surface) call unprefixed counterparts that are implemented in el_runtime.c, not in el_seed.c itself, and el_seed.c never declared them -- a toolchain that treats an implicit function declaration as a hard error under C11 fails the compile outright. install.sh already compiles el_seed.c and el_runtime.c as separate objects and archives both into libel.a, so the symbols are always present at link time; el_seed.c alone was just missing the prototypes. A plain `#include "el_runtime.h"` was tried first and rejected: it redefines el_to_float/el_from_float, which el_seed.h already provides -- a real compile error, not a style preference. Added narrow prototypes instead, copied verbatim from el_runtime.h, for exactly the 51 symbols el_seed.c's wrappers reference and nothing else. Verified clean: - `cc -std=c11 -O2 -I runtime -c runtime/el_seed.c` (install.sh's exact per-file compile) -- 0 errors, 0 warnings, even with -ferror-limit=0. - full `tools/install.sh` run -- compiles both objects and archives them into libel.a successfully. Separately (not fixed here, out of scope): AGENTS.md's documented compiler self-rebuild command links elc-new.c against el_seed.c, but elc-new.c's own generated `#include "el_runtime.h"` line and 3 undeclared symbols (el_mem_check, stdout_to_file, stdout_restore -- present in neither el_runtime.c nor el_seed.c) mean that command fails regardless of which runtime file it's linked against; and install.sh's libel.a only archives el_seed.o + el_runtime.o, so any program that calls into the engram_* surface fails to link against it (el_runtime.c's engram_* wrappers need engram_store.c/engram_geometry.c/engram_reason.c/engram_cognition.c/ engram_vindex.c, none of which install.sh compiles in). Both are real, pre-existing, and independent of this fix -- worth their own look.