Skip to content

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

docs([issue-1328]): log issue #1328 to changelog

[._.]/ Adam Eivy6d416abec70d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index aea1f5f9ce..fb11cce439 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -67,6 +67,8 @@
## Fixed
+- **[issue-1328] When a sync peer is too old to understand a new kind of record, you now see "this peer needs to update PortOS" instead of a silent retry that never lands.** PortOS already surfaces a "peer is behind — they need to update" badge on the Instances page when a peer rejects a push because its storage layout is older than yours. But that badge only appeared for peers that recognized the *record* and balked at its *version* — the first time a brand-new kind of record ships (author personas were the latest; media collections did the same when they arrived), a peer running a PortOS version old enough to not know that record kind at all would reject the push one step earlier, and the rejection slipped past the badge: the push just kept quietly retrying on every edit, with nothing in the UI explaining why that record never reached the peer. Now that earlier rejection is recognized too, so the same "peer needs to update PortOS to sync \<record kind\>" badge appears and the retries back off until the peer upgrades — at which point the record syncs automatically. No data is ever lost: the push simply waits for the peer to catch up. (#1328)
+
- **[issue-1327] Uploaded (non-gallery) author headshots now transfer to federated peers.** The authors federation only shipped a headshot's image bytes when its `headshotImageUrl` pointed at `/data/images/<f>` (a gallery-picked image) — `headshotImageFilename()` maps that to the `image` asset the peer-sync pull worker fetches. But the Authors page's **upload** button routed through the generic `POST /api/uploads`, storing the file in `data/uploads/` and setting `headshotImageUrl = /api/uploads/<f>`, which is **not** a pullable asset kind — so on a peer the author record synced but the headshot 404'd. Author-headshot uploads now go through the gallery instead: a new `POST /api/image-gen/upload` saves the uploaded bytes into `data/images/` — sniffing the real format from the magic bytes (PNG/JPEG/WebP/GIF), rejecting non-image payloads, and re-encoding to PNG so the saved file is a first-class gallery citizen (it lists in the gallery and deletes through the gallery API, both PNG-only) — and returns a `/data/images/<f>` URL, so the headshot rides the existing `image` pull path and its bytes reach every peer. The magic-byte sniffer is consolidated into a shared `detectImageFormat()` in `fileUtils.js` (reused by `imageClean.js`). (`server/lib/fileUtils.js`, `server/lib/imageClean.js`, `server/services/imageGen/local.js`, `server/routes/imageGen.js`, `client/src/services/apiSystem.js`, `client/src/pages/Authors.jsx`, #1327)
- **[issue-1319] LoRA training and video renders now survive a `pm2 restart portos-server` instead of dying mid-run.** A multi-hour LoRA training run kept dying with `SIGINT`/`KeyboardInterrupt` at the exact second portos-server restarted (it restarts routinely on the memory ceiling). Root cause: pm2's `TreeKill` walks the parent→child process tree by **PPID** and signals every descendant of portos-server on restart — and the trainer/render children were descendants. `detached: true` didn't help (it only moves the child to a new process *group*; TreeKill keys on PPID, not the group), and `treekill: false` on the app broke pm2's own reap (lingering `:5555` → EADDRINUSE crash-loop). The fix is spawn-side: a new `spawnDetached` helper (`server/lib/detachedSpawn.js`) **double-forks** the job through a pure-`sh` launcher so it reparents to init (PPID=1) and leaves pm2's tree entirely, while the server keeps streaming progress by tailing on-disk log files (`stdout`/`stderr`/exit-status). Both spawn sites adopt it — `server/services/loraTraining/index.js` (was relying on the ineffective `detached: true`) and `server/services/videoGen/local.js` (which previously had *no* detach at all, so it was fully exposed). Cancel/SIGKILL escalation, the completion watchdog, and `caffeinate` keep-awake all work unchanged (they signal the job by PID, which still reaches the reparented child); video renders clean up their `data/videos/.detached/<jobId>` scratch dir on completion. Because a surviving child outlives the server, boot reconcile now **reaps** any still-running orphan (clean `SIGTERM` so the trainer checkpoints, then `SIGKILL`) before marking its run/job failed — and `resumeTrainingRun` reaps too — so a restart becomes a clean checkpointed stop instead of a mid-op `SIGINT` crash, and a resume can never spawn a second trainer into the same checkpoint dir. (Full re-attach-and-finalize across a restart is tracked in #1332.) The raised memory ceiling + checkpoint-resume remain the safety net for the rare restart that lands in the ~1ms pre-detach window. (`server/lib/detachedSpawn.js`, `server/services/loraTraining/index.js`, `server/services/videoGen/local.js`, `server/services/mediaJobQueue/index.js`, #1319)