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
docs: changelog entries for the two release-review socket/beatGrid fixes
[._.]/ Adam Eivy0200f0a20340
diff --git a/.changelog/v2.25.0.md b/.changelog/v2.25.0.mdindex 4168a38984..ed5fe8edb8 100644--- a/.changelog/v2.25.0.md+++ b/.changelog/v2.25.0.md@@ -130,6 +130,8 @@ Released: 2026-07-01## Fixed+- **Chief of Staff and Moltworld live updates now survive a socket reconnect** — the server rebuilds an empty per-socket subscriber Set on every reconnect (laptop sleep, network blip, server restart), but both consumers registered their re-subscribe only conditionally: `ChiefOfStaff` attached its `socket.on('connect', …)` handler solely in the else branch (skipped when the socket singleton was already connected at mount) and `useMoltworldWs` emitted `agents:subscribe` once at mount with no connect listener at all. So after a reconnect the `cos:*` / `moltworld:*` events went dead until the component remounted — and the Moltworld feed has no polling fallback. Both now subscribe immediately when connected *and* re-subscribe on every `connect`, matching the established `Shell.jsx` pattern. (`client/src/pages/ChiefOfStaff.jsx`, `client/src/hooks/useMoltworldWs.js`)+- **Beat-snapping a right-edge timeline drag no longer commits a scene shorter than the minimum** — `computeDragSpan` floored the out-point at `startSec + minSceneSec` before snapping to the beat grid, then overwrote it with the snap target unconditionally, so a beat sitting just below the floored end (within tolerance) could commit a span under the minimum scene length. The floor is now re-applied after the snap. Server-side `beatSnapClips` re-clamps at render, so this was a displayed/committed-span bug only; covered by a new regression test. (`client/src/lib/beatGrid.js`)- **[issue-2022] Moltworld presence panel no longer shows phantom agents after everyone leaves** — `useMoltworldWs`'s `handlePresence`/`handleNearby` gated the state write on `agents.length > 0`, so an empty "nobody nearby" snapshot (forwarded verbatim from the external Moltworld WS) was silently dropped and the WorldTab "Nearby Agents" panel stuck on a stale agent list forever. Both handlers now validate `Array.isArray(agents)` and call `setPresence` unconditionally for a well-formed array, so a confirmed-empty event clears the panel. `presence` initializes to `null` (not-yet-known) rather than `[]`, and `WorldTab` distinguishes the two: `null` falls back to the last REST join/explore list, while an empty array is a live "nobody here" snapshot that wins over the stale fallback. A malformed non-array payload preserves prior state. Covered by new hook tests. (`client/src/hooks/useMoltworldWs.js`, `client/src/components/agents/tabs/WorldTab.jsx`, Closes #2022)- **PortOS self-restart / reconcile no longer hangs at "stopping apps" and leaves the server down** — restarting the PortOS app (Apps → restart, or a reconcile) sends `portos-server` a SIGINT, but the graceful-shutdown handler hung forever, so PM2's default 1600ms `kill_timeout` SIGKILLed the process — and the tree-kill took the in-flight restart orchestration down with it, so the server never came back and had to be restarted by hand. **Root cause:** the handler called `httpServer.close()` *after* `io.close()`, but socket.io's `io.close()` already closes its current `this.httpServer` — and since every `io.attach()` reassigns that reference (`socket.io` index.js:303), with HTTPS enabled it's the loopback mirror, not `:5555`. Calling `close()` a second time on an already-closed server makes Node register the callback as a one-time `'close'` listener for an event that already fired — so it never runs and the `await` blocks until the 10s force-exit timer (which PM2 pre-empted with SIGKILL). The rewritten `shutdown()`: force-drops long-lived SSE/keep-alive sockets with `closeAllConnections()` up front; closes socket.io + **both** HTTP servers idempotently (`ERR_SERVER_NOT_RUNNING` = already-closed = success), each behind a short bounded backstop so a WebSocket-upgraded socket that neither `closeAllConnections()` nor the server's connection tracker can reach can't stall the exit; bounds the DB-pool `close()` the same way (a leaked/`LISTEN` client can't hang it); and `unref()`s the force-exit timer so it can't itself hold the loop open. Graceful shutdown now completes in well under a second with the DB pool closed cleanly, every time (down from a 10s hang that ended in SIGKILL). As a backstop, `portos-server` also gains an explicit PM2 `kill_timeout: 12000` (just above the app's own 10s force-exit) so even a future stall defers to the app's clean exit instead of an abrupt SIGKILL. (`server/index.js`, `ecosystem.config.cjs`)- **[issue-1922] Music-video federation's bundled track tombstone is now ack-tracked, closing a narrow track-GC strand window** — #1858 bundles a music-video project's linked track record (`linkedTrack`) so a Music-Videos-only peer (no `track` subscription) can resolve it, and a track delete fans the tombstone out the same way. But `computeAckedDeletesFromPayload` (`peerSyncReceive.js`) only looked at `record`/`issues`, never `linkedTrack`, so such a peer could never ack a bundled track delete through any cursor — and the sender's `track`-tombstone GC cohort (`tombstoneGc.js`) only ever waited on peers with a direct `track` subscription, so it was entirely blind to a musicVideoProjects-only peer regardless of the ack fix. Implemented option (a) from the deferred #1858 review: `computeAckedDeletesFromPayload` now folds in a bundled `linkedTrack` tombstone's `deletedAt`, and the `track` GC cutoff additionally folds `musicVideoProject` subscribers into its cohort, reading their confirmed-delivery floor off a new bundle-specific `lastConfirmedTrackBundleAtMs` (stamped only when the bundled track merge actually succeeded — not the generic `lastConfirmedPushedAt`, which advances even when the bundle failed or was stripped for a legacy peer). Local subscription-state addition only; no wire-payload shape change, so no schema-version bump. (#1922)