Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): drop invalid powermetrics smc sampler + verify sidecar started
[._.]/ Adam Eivy5d3f4f69e659
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex daa255d4e7..f658558192 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -42,7 +42,7 @@## Fixed-- **LoRA training now survives a mid-run machine crash and self-instruments for GPU forensics** — Two GPU watchdog-timeout kernel panics (`watchdog timeout: no checkins from watchdogd in 90 seconds`) hard-rebooted the machine during mflux FLUX.2 training in a single day on M5 silicon (`Mac17,7`/`T6050`, macOS 26.5) — a system-level Metal/GPU hang, not a PortOS bug. Two changes make training resilient to it: (1) a checkpoint crash-resilience floor — `save_frequency` is now capped at `ceil(totalSteps/4)` (`MFLUX_MIN_CHECKPOINTS`) even when the user picks "only final save" (`checkpointEvery: 0`) or a huge interval, so a hard reboot loses at most ~¼ of a run instead of everything; resume from the newest checkpoint as before. (2) Each run streams `powermetrics --samplers gpu_power,thermal,smc` into `<run>/powermetrics.log` so the next crash leaves a forensic record of GPU temp/power leading up to the hang — gated on a non-interactive `sudo -n` probe so it no-ops cleanly (training unaffected) when passwordless `powermetrics` isn't configured. The incident, analysis, and an investigation checklist are documented in `docs/TROUBLESHOOTING.md` ("GPU watchdog kernel panic during LoRA training") + `docs/research/2026-06-13-mflux-training-watchdog-panic.md`. (`server/services/loraTraining/runtimes.js`, `scripts/train_mflux_lora.py`, `docs/TROUBLESHOOTING.md`, `docs/research/`)+- **LoRA training now survives a mid-run machine crash and self-instruments for GPU forensics** — Two GPU watchdog-timeout kernel panics (`watchdog timeout: no checkins from watchdogd in 90 seconds`) hard-rebooted the machine during mflux FLUX.2 training in a single day on M5 silicon (`Mac17,7`/`T6050`, macOS 26.5) — a system-level Metal/GPU hang, not a PortOS bug. Two changes make training resilient to it: (1) a checkpoint crash-resilience floor — `save_frequency` is now capped at `ceil(totalSteps/4)` (`MFLUX_MIN_CHECKPOINTS`) even when the user picks "only final save" (`checkpointEvery: 0`) or a huge interval, so a hard reboot loses at most ~¼ of a run instead of everything; resume from the newest checkpoint as before. (2) Each run streams `powermetrics --samplers cpu_power,gpu_power,thermal` into `<run>/powermetrics.log` so the next crash leaves a forensic record of GPU temp/power leading up to the hang — gated on a non-interactive `sudo -n` probe so it no-ops cleanly (training unaffected) when passwordless `powermetrics` isn't configured. The incident, analysis, and an investigation checklist are documented in `docs/TROUBLESHOOTING.md` ("GPU watchdog kernel panic during LoRA training") + `docs/research/2026-06-13-mflux-training-watchdog-panic.md`. (`server/services/loraTraining/runtimes.js`, `scripts/train_mflux_lora.py`, `docs/TROUBLESHOOTING.md`, `docs/research/`)- **Postgres pool no longer throws spurious "timeout exceeded when trying to connect"** — On a single-user box that periodically runs heavy local workloads (Ollama model pulls, CoS agents), establishing a fresh loopback connection could briefly exceed the 2s `connectionTimeoutMillis`, surfacing pool connection errors against a perfectly healthy Postgres. The connect timeout is raised to 10s (absorbs busy moments while still failing fast on a real outage) and `max` connections bumped 10→20 so concurrent in-process work isn't starved while one connection is slow to establish. (`server/lib/db.js`)diff --git a/docs/research/2026-06-13-mflux-training-watchdog-panic.md b/docs/research/2026-06-13-mflux-training-watchdog-panic.mdindex e1e383d59c..c481d4d5c3 100644--- a/docs/research/2026-06-13-mflux-training-watchdog-panic.md+++ b/docs/research/2026-06-13-mflux-training-watchdog-panic.md@@ -62,7 +62,7 @@ swap thrash if a run oversubscribes unified memory.`--resume-checkpoint <newest .zip>` path picks up from the last checkpoint.2. **GPU/thermal telemetry sidecar** — `TelemetrySidecar` in`scripts/train_mflux_lora.py` streams `powermetrics --samplers- gpu_power,thermal,smc` into `<run>/powermetrics.log` for the life of each+ cpu_power,gpu_power,thermal` into `<run>/powermetrics.log` for the life of eachtraining run. Gated on a non-interactive `sudo -n` probe: if passwordlesssudo for `powermetrics` is not configured it no-ops with a STATUS note andtraining proceeds. This gives the next crash a forensic record of GPU temp /diff --git a/scripts/train_mflux_lora.py b/scripts/train_mflux_lora.pyindex 702fb43eb3..adda663ef9 100644--- a/scripts/train_mflux_lora.py+++ b/scripts/train_mflux_lora.py@@ -232,7 +232,7 @@ class TelemetrySidecar:returncmd = ["sudo", "-n", pm,- "--samplers", "gpu_power,thermal,smc",+ "--samplers", "cpu_power,gpu_power,thermal","-i", str(self.SAMPLE_INTERVAL_MS),"--output-file", str(self.log_path),]@@ -242,6 +242,17 @@ class TelemetrySidecar:log(f"STATUS:GPU telemetry unavailable ({err}); continuing without it")self.proc = Nonereturn+ # Confirm powermetrics actually stayed up — a bad sampler, an OS that+ # dropped a sampler, or a perms issue makes it exit immediately, and we+ # must not report telemetry as enabled while the log stays empty.+ try:+ rc = self.proc.wait(timeout=0.5)+ log(f"STATUS:GPU telemetry failed to start (powermetrics exited {rc}); "+ "continuing without it")+ self.proc = None+ return+ except subprocess.TimeoutExpired:+ pass # still running after the grace window → healthy# Guarantee the root powermetrics child is reaped even if main() throws# between start() and the explicit stop() — unlike the daemon watcher# thread, this is a separate OS process that outlives the interpreter.