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
fix: update.sh / update.ps1 start PortOS when it wasn't already running
[._.]/ Adam Eivy545065217113
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 17783337b7..311d51a715 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -54,6 +54,8 @@## Fixed+- **`update.sh` / `update.ps1` now start PortOS when it wasn't already running.** Both scripts `pm2 kill` the daemon early to clear stale fork paths, then previously called `npm run pm2:restart` to bring the app back. `pm2 restart <ecosystem>` against a torn-down daemon doesn't reliably (re)start processes that aren't currently managed, so users who ran the updater while PortOS was stopped ended an "update complete" cycle with no server running and the auto-open script timing out against a dead port. The restart step now mirrors the `npm start` pattern — `pm2 delete --silent` → `pm2 start ecosystem.config.cjs` → `pm2 save` — which boots a fresh daemon, starts the apps, and persists the process list so they come back on reboot. The `STEP:restart:…` markers are preserved so the UI progress panel (`UpdateTab.jsx`) continues to render correctly.+- **[med-pipeline-server-services-pipeline-arcplanner] `sanitizeSeasonList` now warns when LLM-emitted seasons collide on id.** `server/lib/storyArc.js#sanitizeSeasonList` dedupes by id with last-write-wins (Map.set overwrite) on every series persist. Two LLM-emitted seasons sharing an id were silently dropped before persist while child issues kept their `seasonId` pointers — leaving the issues attached to the surviving season under the colliding id, which is rarely what an arc-resolve LLM rewrite intended. The helper now tracks colliding ids during the loop and emits a single `console.warn` listing the offending ids (counting both total overwrites and distinct colliding ids) so the responsible run is grep-able in logs. Behavior is preserved (LWW still wins, no throw); the warning is the new signal. Four tests added to `storyArc.test.js` cover the warn, the unique no-warn baseline, the multi-id collision listing, and the same-id-3+-times listing (deduped via Set).- **[med-migration-scripts-migrations-014-attribute] Migration 014 no longer writes `'unknown'` as a phantom annotation author.** When the migration runner fires before `ensureSelf()` on a fresh install (the order in `server/index.js` — migrations at startup, identity later), `instances.json` is absent and the old fallback `instances?.self?.instanceId || 'unknown'` stamped the literal string `'unknown'` into every legacy annotation entry forever (`setAnnotation` refuses to write under `'unknown'` and `annotationsSync.flushAll` refuses to export it, so those notes became unrecoverable / unexportable). `scripts/migrations/014-attribute-existing-annotations.js` now lazy-creates the local identity inline (same shape as `ensureSelf()` — `randomUUID()` + `os.hostname()`) and writes it to `data/instances.json` before reading. Read-side belt-and-suspenders: `mediaAnnotations.readAll()` heals any pre-existing `authors.unknown` bucket by re-keying it to the real `localInstanceId` (in-memory only; the first subsequent `setAnnotation` persists the clean shape via the normal write path). When a real local entry already exists alongside an unknown phantom, the real entry wins and the phantom is dropped. Tests in `scripts/migrations/014-attribute-existing-annotations.test.js` and `server/services/mediaAnnotations.test.js`.diff --git a/update.ps1 b/update.ps1index b15a54e8e7..7812d548f1 100644--- a/update.ps1+++ b/update.ps1@@ -246,16 +246,25 @@ $utf8NoBom = New-Object System.Text.UTF8Encoding($false)[System.IO.File]::WriteAllText("$RootDir\data\update-complete.json.tmp", $marker, $utf8NoBom)Move-Item -Force "$RootDir\data\update-complete.json.tmp" "$RootDir\data\update-complete.json"-# Restart PM2 apps — remove marker if restart fails so it isn't misread on boot-Step "restart" "running" "Restarting PortOS..."-Invoke-Logged npm run pm2:restart+# Start PM2 apps — `pm2 kill` above tore down the daemon, so use `start` not+# `restart` (restart against a config doesn't reliably start processes that+# aren't currently managed, leaving the app stopped after an update that ran+# while PortOS wasn't running). `delete --silent` first so a partial prior+# state doesn't make `start` a no-op, then `save` so the apps come back on+# reboot. Remove the completion marker if start fails so it isn't misread on boot.+Step "restart" "running" "Starting PortOS..."+Invoke-Logged node ./node_modules/pm2/bin/pm2 delete ecosystem.config.cjs --silent+$global:LASTEXITCODE = 0+Invoke-Logged node ./node_modules/pm2/bin/pm2 start ecosystem.config.cjsif ($LASTEXITCODE -ne 0) {if (Test-Path "$RootDir\data\update-complete.json") {Remove-Item -Force "$RootDir\data\update-complete.json"}exit $LASTEXITCODE}-Step "restart" "done" "PortOS restarted"+Invoke-Logged node ./node_modules/pm2/bin/pm2 save+$global:LASTEXITCODE = 0+Step "restart" "done" "PortOS started"Write-SafeHost ""# Open the dashboard in the PortOS-managed browser. Fail-soft — explicitlydiff --git a/update.sh b/update.shindex ba7ae29c20..e4bff6dba4 100755--- a/update.sh+++ b/update.sh@@ -179,13 +179,20 @@ TAG="$TAG" ROOT_DIR="$ROOT_DIR" node -e 'fs.writeFileSync(path.join(process.env.ROOT_DIR, "data", "update-complete.json.tmp"), marker);' && mv "$ROOT_DIR/data/update-complete.json.tmp" "$ROOT_DIR/data/update-complete.json"-# Restart PM2 apps — remove marker if restart fails so it isn't misread on boot-step "restart" "running" "Restarting PortOS..."-if ! run npm run pm2:restart; then+# Start PM2 apps — `pm2 kill` above tore down the daemon, so use `start` not+# `restart` (restart against a config doesn't reliably start processes that+# aren't currently managed, leaving the app stopped after an update that ran+# while PortOS wasn't running). `delete --silent` first so a partial prior+# state doesn't make `start` a no-op, then `save` so the apps come back on+# reboot. Remove the completion marker if start fails so it isn't misread on boot.+step "restart" "running" "Starting PortOS..."+run node ./node_modules/pm2/bin/pm2 delete ecosystem.config.cjs --silent || true+if ! run node ./node_modules/pm2/bin/pm2 start ecosystem.config.cjs; thenrm -f "$ROOT_DIR/data/update-complete.json"exit 1fi-step "restart" "done" "PortOS restarted"+run node ./node_modules/pm2/bin/pm2 save || true+step "restart" "done" "PortOS started"log ""# Open the dashboard in the PortOS-managed browser. Fail-soft — never blocks