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
detach the LoRA training subprocess so a server restart doesn't SIGINT it
[._.]/ Adam Eivy7b416966793a
diff --git a/server/services/loraTraining/index.js b/server/services/loraTraining/index.jsindex eaec834a8a..4f93b6861b 100644--- a/server/services/loraTraining/index.js+++ b/server/services/loraTraining/index.js@@ -498,7 +498,18 @@ export async function runTraining({ jobId, runId, pythonPath = null, resumeCheckchildEnv.PYTHONUNBUFFERED = '1';console.log(`🏋️ training [${shortId(jobId)}] spawn ${basename(bin)} ${run.runtime} steps=${run.params.steps} rank=${run.params.rank} images=${manifest.images.length}${resumeCheckpoint ? ` resume=${basename(resumeCheckpoint)}` : ''}`);- const proc = spawn(bin, args, { env: childEnv, stdio: ['ignore', 'pipe', 'pipe'] });+ // `detached: true` puts the trainer in its OWN process group. Without it the+ // child sits in the server's group, so when pm2 restarts portos-server — e.g.+ // on the `max_memory_restart` 2 GB ceiling, which a long session crosses+ // routinely — the SIGINT pm2 sends to the group reaches the trainer too and+ // kills it mid-run (observed twice: SIGINT/KeyboardInterrupt at the exact+ // second of a server restart, losing hours of GPU work to a process unrelated+ // to training). Detaching isolates the multi-hour trainer from the server's+ // lifecycle. We still keep `proc` and `proc.kill()` it directly on cancel+ // (signals the child PID, not the group), and DON'T `.unref()` — the queue+ // worker awaits the 'close' event, so the child must keep the worker's+ // promise alive for the run lifecycle.+ const proc = spawn(bin, args, { env: childEnv, stdio: ['ignore', 'pipe', 'pipe'], detached: true });activeProcess = proc;activeJobId = jobId;