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-no-pm2-kill): stop self-update from killing other projects' PM2 apps
Adam Eivy528f72f8f02f
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 3ed54beeaf..9162a90e31 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -57,6 +57,7 @@## Fixed+- **[update-no-pm2-kill] Self-update no longer kills other projects' PM2 apps.** `update.sh` / `update.ps1` ran `pm2 kill` to force a fresh daemon launch — but `pm2 kill` tears down the *entire* shared PM2 daemon, stopping every other project's apps on the machine, not just PortOS's. The update now removes only PortOS's apps (`pm2 delete ecosystem.config.cjs`) and runs `pm2 update` to reload the daemon in place from this checkout's `node_modules` — which still refreshes the cached `ProcessContainerFork.js` path that the `kill` was working around (a stale path from a daemon launched by another project, e.g. a Yarn PnP zip cache, otherwise crashes future `fork()` calls with `MODULE_NOT_FOUND`), without disturbing co-located apps.- **[canon-extraction-failure-retry] Failed prose→canon extraction is now retained and retryable with a different model.** When a pipeline issue's prose finishes, PortOS auto-extracts characters / places / objects into the linked universe. A provider failure (e.g. Codex safety-refusing the `object` kind, a Claude `401`, or a malformed-JSON response) used to be swallowed — and because all three kinds ran in one `Promise.all`, a single failing kind discarded the characters + places that *did* extract. Now extraction is per-kind resilient: the kinds that succeed are merged, the rest are flagged, and the outcome (`ok` / `partial` / `failed` + which kinds failed, the error, and the provider/model used) is persisted on the prose stage so it survives a reload. The Nouns stage surfaces a banner for partial/failed extractions and adds a provider/model picker next to "Extract from prose" (defaulting to the series' configured LLM) so you can keep retrying different models until the failed kinds come through — the entries that already landed are kept. The manual extract now routes through the pipeline endpoint (which accepts `prose` alongside `comicScript`/`teleplay` and a `model` override) so both the auto and manual paths stamp the same marker. Both the `extract-canon` and storyboards `extract-scenes` routes also stop pairing an override provider with the series' stored model id (a model id is provider-specific) — switching providers in a retry now correctly resolves the new provider's default model instead of forwarding e.g. an OpenAI model id to Anthropic.- **[catalog-character-sheet-enrichment] Catalog character stats now display.** The catalog detail page's read-only stats list read each stat's `.key` field, but the storyBible canon shape stores stats as `{ label, value }` — so every stat rendered with a blank label. The new editable stat editor and the read path both standardize on `.label`, so stats finally show (and edit) correctly.- **[browser-navigate-ssrf-guard] SSRF guard on the browser navigate route.** `POST /api/browser/navigate` validated its URL with a bare `z.string().url()`, so `file://`, loopback, link-local, and cloud-metadata (`169.254.169.254`) targets were reachable — a redirect or agent-driven navigation could turn it into local-file exfiltration or a metadata-endpoint hit. It now reuses the catalog ingest guard (`isSafeIngestUrl`): http(s) only, with loopback / link-local / metadata hosts blocked (including IPv4-mapped-IPv6 bypass forms like `[::ffff:127.0.0.1]`). Private/LAN and Tailscale hosts stay allowed; `localhost`/`127.x` are now blocked, so navigate a local app by its LAN IP/hostname. Bad input also returns a clean 400 instead of a 500. The shared host guard was also hardened against two literal bypasses (deprecated IPv4-compatible IPv6 like `[::127.0.0.1]`, and trailing-FQDN-dot hosts like `localhost.`), which strengthens catalog URL ingest as well.diff --git a/update.ps1 b/update.ps1index b87300235d..bb203a2160 100644--- a/update.ps1+++ b/update.ps1@@ -161,16 +161,18 @@ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }Step "submodules" "done" "Submodules updated"Write-SafeHost ""-# Kill PM2 daemon entirely — pm2 stop/restart only signal app processes but-# leave the daemon alive. If the daemon was originally launched from a different-# project, it can cache a stale ProcessContainerFork.js path and crash future-# fork() calls with MODULE_NOT_FOUND. Killing the daemon mirrors update.sh and-# forces a fresh launch from this checkout on restart.+# Remove ONLY PortOS's apps from the shared PM2 daemon — never `pm2 kill`, which+# tears down the daemon and stops EVERY other project's apps on this machine.+# `pm2 update` then reloads the daemon in place from this checkout's node_modules,+# refreshing its cached ProcessContainerFork.js path (a stale path from a daemon+# originally launched by another project — e.g. a Yarn PnP zip cache — makes+# future fork() calls crash with MODULE_NOT_FOUND) while leaving other projects'+# apps running instead of killing them.Step "pm2-stop" "running" "Stopping PortOS apps..."-Invoke-Logged node ./node_modules/pm2/bin/pm2 kill-if ($LASTEXITCODE -ne 0) {- Write-SafeHost "⚠️ PM2 daemon was not running or could not be killed; continuing update" -ForegroundColor Yellow-}+Invoke-Logged node ./node_modules/pm2/bin/pm2 delete ecosystem.config.cjs --silent+$global:LASTEXITCODE = 0+Invoke-Logged node ./node_modules/pm2/bin/pm2 update+$global:LASTEXITCODE = 0Step "pm2-stop" "done" "Apps stopped"Write-SafeHost ""@@ -256,8 +258,8 @@ $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"-# 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+# Start PM2 apps — 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 ondiff --git a/update.sh b/update.shindex 7bf13193b7..ec10170038 100755--- a/update.sh+++ b/update.sh@@ -104,13 +104,16 @@ run git submodule update --init --recursivestep "submodules" "done" "Submodules updated"log ""-# Kill PM2 daemon entirely — pm2 stop/restart only signal app processes but-# leave the daemon alive. If the daemon was originally launched from a different-# project (e.g. a Yarn PnP zip cache), it caches a stale ProcessContainerFork.js-# path and all subsequent fork() calls crash with MODULE_NOT_FOUND. Killing the-# daemon forces a fresh launch from our local node_modules on restart.+# Remove ONLY PortOS's apps from the shared PM2 daemon — never `pm2 kill`, which+# tears down the daemon and stops EVERY other project's apps on this machine.+# `pm2 update` then reloads the daemon in place from our local node_modules,+# refreshing its cached ProcessContainerFork.js path (a stale path from a daemon+# originally launched by another project — e.g. a Yarn PnP zip cache — makes all+# subsequent fork() calls crash with MODULE_NOT_FOUND) while resurrecting other+# projects' apps instead of killing them.step "pm2-stop" "running" "Stopping PortOS apps..."-run node ./node_modules/pm2/bin/pm2 kill || true+run node ./node_modules/pm2/bin/pm2 delete ecosystem.config.cjs --silent || true+run node ./node_modules/pm2/bin/pm2 update || truestep "pm2-stop" "done" "Apps stopped"log ""@@ -189,8 +192,8 @@ 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"-# 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+# Start PM2 apps — 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