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
address review (claude): media-collection snapshot tombstones + LM Studio findModelDir traversal guard + model-delete confirm
Adam Eivyf46cac3d134e
diff --git a/PLAN.md b/PLAN.mdindex 539224f2af..9a72a67ce2 100644--- a/PLAN.md+++ b/PLAN.md@@ -122,11 +122,12 @@ Items here need a research / design pass, an explicit decision, or a preconditioSurfaced during code review of the federated-media-collection-sync feature and consciously deferred (out of scope for that PR). Each is independently pickable.-- [ ] [media-sync-snapshot-tombstones] **dataSync `mediaCollections` snapshot omits tombstones.** `getMediaCollectionsSnapshot` (`server/services/dataSync.js`) lists live-only collections, so a peer with the `mediaCollections` category enabled but no per-record subscription yet (transient window before auto-subscribe lands) won't receive collection tombstones via the 60s snapshot — only via the push path. Either include tombstones in the snapshot (bounded by a horizon, like the universe/series snapshots) or document that first-class push is the authoritative tombstone path for collections.- [ ] [media-sync-integrity-unreachable-reason-ui] **Integrity: surface the `peer-unreachable` vs `peer-too-old` reason in the UI.** Server-side is done — `getPeerIntegrity` (`server/services/sharing/integrity.js`) now returns `reason: 'peer-unreachable'` for a network failure, `'peer-too-old'` for a 404, and `'fetch-failed'` for other non-OK statuses. The remaining gap is client-side: `useSyncIntegrity` only checks `available` and silently drops the `reason`, so the badge/drawer can't tell the user "peer is offline" vs "update the peer's PortOS." Thread `reason` through the hook's per-peer payload and render distinct messaging in `SyncBadge`/`SyncDetailDrawer`.- [ ] [media-sync-series-issue-assets-manifest] **Series integrity manifest omits child-issue assets (v1 limitation).** `assetShaListForRecord('series', …)` (`server/services/sharing/peerSync.js`) uses `buildAssetManifest(series)`, capturing only the series' own asset refs, not its issues' — so a series whose images all live in issues reports assets in-parity even when a peer is missing them. Extend to fold in child-issue asset hashes (mirror `buildAssetManifestForSeries`).- [ ] [media-sync-metadata-missing-status] **(Enhancement) `metadata-missing` integrity status.** Surface records whose images lack gen-params sidecars as a distinct status so the badge directly flags the "no prompts" condition (today repaired via the Unsorted "Pull missing prompts" action; byte-divergence shows as `assets-missing`). Requires the peer manifest to carry per-record sidecar-presence. `server/lib/syncIntegrity.js` + the manifest builder.- [ ] [media-sync-drawer-test-act-warning] **Test polish: `SyncDetailDrawer.test.jsx` act() warning.** The universe-kind "shows per-peer breakdown" test renders without awaiting the async record-name fetch, emitting a React `act()` warning (test still passes). Wrap the render/assertions in `waitFor`/`act`. Test-quality only.+- [ ] [peer-sync-tombstone-cooldown-bypass] **Schema-block cooldown suppresses tombstone (delete) pushes for up to 5 min.** `pushRecordToPeer` (`server/services/sharing/peerSync.js` ~line 714) short-circuits on `sub.blockedBySchema && !options.bypassSchemaCooldown` BEFORE building the push payload, so a delete (tombstone) edit to a schema-blocked subscription is held off — even though the receiver-side gate (~line 1197) explicitly exempts tombstones (`record.deleted !== true`) so soft-deletes always converge. Delete still converges on the next `peer:online` (which passes `bypassSchemaCooldown: true`) or after the cooldown elapses, so this is eventual-consistency-correct but slow in the rare schema-mismatch + edit-triggered-delete window. Fix: resolve whether the pending push is a tombstone (load the record, or thread a `deleted` hint) before the cooldown gate and bypass the cooldown for tombstones, mirroring the receiver exemption. Surfaced during v2.8.0 release review (claude). Deferred: touches delicate push-gate ordering, no test coverage, low impact.+- [ ] [aitoolkit-ollama-ready-hook-injection] **Vendored AI toolkit imports out to a PortOS service.** `server/lib/aiToolkit/runner.js:8` does `import { ensureProviderReady as ensureOllamaProviderReady } from '../../services/ollamaManager.js'` (added by the "Run Ollama as a startup service" work), used at ~line 313 in the API chat-completions path. This violates the documented self-containment rule ("Keep the directory self-contained — no imports out to other PortOS modules — so future upstream syncs don't fight local edits"). Fix: inject `ensureProviderReady` through the runner `config`/`hooks` (the factory already accepts `hooks = {}`) and wire it where PortOS constructs the toolkit, mirroring the `executeCliRun`/`stopRun` override pattern in `server/index.js`; the hook early-returns success for non-Ollama providers, so no behavior change. Surfaced during v2.8.0 release review (claude). Deferred: cross-file DI refactor of the toolkit boundary with no test coverage — maintainability/sync-hygiene only, no runtime impact today.## Future Ideasdiff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsxindex 9157a520f6..e8ece80167 100644--- a/client/src/components/settings/LocalLlmTab.jsx+++ b/client/src/components/settings/LocalLlmTab.jsx@@ -226,6 +226,9 @@ export function LocalLlmTab() {const [actionInProgress, setActionInProgress] = useState(null);const [progressMsg, setProgressMsg] = useState('');const [confirmAction, setConfirmAction] = useState(null);+ // id of the installed model awaiting a delete confirmation (two-step inline+ // confirm — deleting weights is an irreversible multi-GB rm -rf / DELETE).+ const [confirmDeleteId, setConfirmDeleteId] = useState(null);const progressTimer = useRef(null);const statusRequestId = useRef(0);const catalogRequestId = useRef(0);@@ -642,14 +645,35 @@ export function LocalLlmTab() {</div></div>{m.size != null && <span className="text-xs text-gray-400 shrink-0">{formatBytes(m.size)}</span>}- <button- onClick={() => remove(m.id)}- disabled={busy}- className="px-2.5 py-1 text-xs bg-port-error/20 hover:bg-port-error/40 text-port-error rounded disabled:opacity-50 flex items-center gap-1 shrink-0"- >- {actionInProgress === `delete-${m.id}` ? <BrailleSpinner /> : <Trash2 size={12} />}- Delete- </button>+ {confirmDeleteId === m.id ? (+ <div className="flex items-center gap-1.5 shrink-0">+ <span className="text-xs text-port-error">Delete?</span>+ <button+ onClick={() => { setConfirmDeleteId(null); remove(m.id); }}+ disabled={busy}+ className="px-2 py-1 text-xs bg-port-error/30 hover:bg-port-error/50 text-port-error rounded disabled:opacity-50 flex items-center gap-1"+ >+ <Trash2 size={12} />+ Delete+ </button>+ <button+ onClick={() => setConfirmDeleteId(null)}+ className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"+ >+ Cancel+ </button>+ </div>+ ) : (+ <button+ onClick={() => setConfirmDeleteId(m.id)}+ disabled={busy}+ className="px-2.5 py-1 text-xs bg-port-error/20 hover:bg-port-error/40 text-port-error rounded disabled:opacity-50 flex items-center gap-1 shrink-0"+ aria-label={`Delete ${m.name}`}+ >+ {actionInProgress === `delete-${m.id}` ? <BrailleSpinner /> : <Trash2 size={12} />}+ Delete+ </button>+ )}</div>))}</div>diff --git a/server/services/dataSync.js b/server/services/dataSync.jsindex 184a3b0123..af14b8573d 100644--- a/server/services/dataSync.js+++ b/server/services/dataSync.js@@ -440,7 +440,12 @@ async function getMediaCollectionsSnapshot() {// listCollections re-reads + sanitizes from disk; we don't cache here since// the checksum cache (`CHECKSUM_PATHS` fingerprint check) already short-// circuits the I/O when the file hasn't moved.- const collections = await listCollections();+ // includeDeleted:true so tombstones cross the wire — matches getUniverseSnapshot+ // / getPipelineSnapshot. Without it, a peer that missed the live delete push+ // (offline/unsubscribed at delete time) never learns the collection was deleted+ // and keeps it live; the receiver (mergeMediaCollectionsFromSync) already LWWs+ // the incoming tombstone so this converges deletes without resurrecting them.+ const collections = await listCollections({ includeDeleted: true });// Filter out collections whose linked record (universe or series) is marked// ephemeral. Mirrors the per-record push pipeline's local-ephemeral guard// (see peerSync.js applyIncomingPush) — without this filter, thediff --git a/server/services/lmStudioManager.js b/server/services/lmStudioManager.jsindex bd835808ab..04d4434542 100644--- a/server/services/lmStudioManager.js+++ b/server/services/lmStudioManager.js@@ -504,7 +504,12 @@ const normalizeRepoKey = (s) => String(s || '').replace(/[-.]mlx[-.].*$/i, '')async function findModelDir(modelsDir, modelId) {- const direct = join(modelsDir, ...String(modelId || '').split('/'))+ // Reject `.`/`..` traversal segments before joining — mirrors the stricter+ // findDeletableModelDirs guard so the read path can't resolve outside the+ // models tree either (trusted ids today, but defense-in-depth parity).+ const segments = String(modelId || '').split('/').map((s) => s.trim()).filter(Boolean)+ if (segments.some((s) => s === '.' || s === '..')) return null+ const direct = join(modelsDir, ...segments)if (await dirExists(direct)) return directconst wanted = normalizeRepoKey(modelId)