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([codex5-onboarding-capability-map]): address codex review — sync-failure + not-started accuracy
Adam Eivy4e24be600501
diff --git a/PLAN.md b/PLAN.mdindex f91c061598..a1725ac81a 100644--- a/PLAN.md+++ b/PLAN.md@@ -12,7 +12,7 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [.changel- [ ] [flux2-multi-reference-python-runner] **FLUX.2 multi-reference Python runner.** The UI + server contract for multi-reference editing shipped 2026-05-17 (slug `multi-reference-image-editing-for-flux-2-ui`); the Python runner (`scripts/flux2_macos.py`) currently ignores the `--reference-images`/`--reference-strengths` args that `local.js` now passes. Wire diffusers' multi-reference API in the runner and swap `server/lib/mediaModels.js#flux2-klein-9b` `tokenizerRepo` to `FLUX.2-klein-9B-kv` (gated repo — requires the user to accept the license on HF). Validate end-to-end with 2–4 uploaded refs.- [ ] [voice-cos-tool-expansion-calendar-today-calendar] **Voice CoS tool expansion** — `calendar_today` / `calendar_next` (existing Google Calendar MCP), `meatspace_log_workout` (wraps `meatspaceHealth.js`), `weather_now` (pick API: OpenWeather / WeatherKit / NWS), `timer_set` (reuses `agentActionExecutor.js`).- [ ] [voice-agent-vision-fallback-ui-describe-visually] **Voice agent vision fallback** — `ui_describe_visually`: screenshot tab and send to a vision-capable model so "what's on this chart?" works on CyberCity / graph views.-- [ ] [apple-health-integration-live-sync] **Apple Health integration for MeatSpace.** iOS live sync (HealthKit Shortcut → `POST /api/meatspace/apple-health` endpoint) plus a bulk historical import path for an exported `export.xml`. Wire into existing MeatSpace tabs so steps / sleep / heart rate / VO2 max / resting HR show alongside the alcohol / blood / body / epigenetic tracks already shipped. GOALS.md flags this as a documented Secondary Goal ("Apple Health integration planned") but no implementation tracking existed until this entry.+- [ ] [apple-health-integration-live-sync] **Apple Health integration for MeatSpace.** iOS live sync (HealthKit Shortcut → `POST /api/meatspace/apple-health` endpoint) plus a bulk historical import path for an exported `export.xml`. Wire into existing MeatSpace tabs so steps / sleep / heart rate / VO2 max / resting HR show alongside the alcohol / blood / body / epigenetic tracks already shipped. GOALS.md flags this as a documented Secondary Goal ("Apple Health integration planned") but no implementation tracking existed until this entry. When this lands, also fold an Apple-Health-imported signal into the Capabilities page "Genome & Health" row (`server/lib/capabilityMap.js#genomeRow` + the route's `genome` fetch) so a health-only setup no longer reports "Not set up" purely because no genome is uploaded (codex review of `[codex5-onboarding-capability-map]`, 2026-05-24).- [ ] [ref-watch-phosphene-mlx-post-decode-os-exit] **Bypass MLX post-decode deallocator hang via `os._exit(0)`.** From `reference-watch` review of phosphene (commits `adc1cd25` + `94bd6965`, 2026-05-22). At PortOS's current `LTX2_PIN=f8f20c83` the bug isn't reachable, but the moment a user updates `ltx-2-mlx` or PortOS bumps the pin past the May 9 refactor, every Distilled / Extend / two-stage render stalls 5–15 min after the upstream "Decoding done in X.Xs" log while Metal command-buffer completion handlers hold the GIL through frame teardown. Fix: in `scripts/generate_ltx2.py` `main()`, after `print(json.dumps(...))`, call `os._exit(0)` instead of returning normally — mp4 is on disk, stdout was flushed, skipping deallocator teardown saves up to 15 min. Document why in the file's docstring. Subsumes any in-helper watchdog approach.- [ ] [ref-watch-phosphene-broaden-negative-prompt-override] **Broaden `DEFAULT_NEGATIVE_PROMPT` override to every module that defines it.** From `reference-watch` review of phosphene (commit `4e6129b7`, 2026-05-22). `scripts/generate_ltx2.py:55-70` `configure_negative_prompt()` only patches `ti2vid_one_stage.DEFAULT_NEGATIVE_PROMPT`. At PortOS's current pin this happens to cover every pipeline (the constant resolves against `ti2vid_one_stage` for the base class), but post-May-9 the constant moves to `ltx_pipelines_mlx._base` and `utils.constants` — and the PortOS override silently no-ops on Q8 / two-stage / HQ paths with no error for the user to chase. Fix: rewrite `configure_negative_prompt()` to probe `ti2vid_one_stage`, `_base`, and `utils.constants`, monkey-patch every module that has the constant. Keep PortOS's *replace* semantics (don't switch to phosphene's append-with-comma). No contextmanager needed — the helper is short-lived.- [ ] [peer-sync-ephemeralize-then-delete-stalls-tombstone] **A previously-shared universe/series that's marked ephemeral, then deleted, never propagates the tombstone when the peer still has other subscriptions of that kind.** Codex iter-8 in v2.7.0 release review (P2). The ephemeralize step's `unsubscribeAllForRecord` removes the per-record sub for that record; the subsequent delete fires `recordEvents.deleted` but there's no sub to push it. The snapshot path in `syncOrchestrator.categoriesCoveredByPeerSync` then suppresses the whole-category snapshot for that peer (because ANY other per-record sub for that kind exists), so the tombstone has no fallback transport either. The peer keeps the old live copy indefinitely. Same root cause as `[peer-sync-snapshot-skip-too-coarse-for-partial-subscriptions]` — the snapshot-skip fix needs to either send the snapshot with subscribed records excluded (so tombstones for unsubscribed-but-previously-known records can still ride it), or detect the ephemeralize-then-delete sequence and proactively push the tombstone before tearing down the sub.@@ -96,7 +96,6 @@ Items here need a research / design pass, an explicit decision, or a preconditio- [ ] [scene-level-wardrobe-picking-per-scene] **Scene-level wardrobe picking.** Per-scene `characterAppearances: [{ characterId, wardrobeId? }]` on storyboard scenes with wardrobe-picker dropdown. Decide first: does the extractor guess or does the user pick? Append wardrobe after physicalDescription vs substitute body fields?- [ ] [useasyncaction-post-unmount-setstate-guard-add] **`useAsyncAction` post-unmount setState guard.** Add `mountedRef` to gate `setRunning(false)`. YAGNI today; do at 4th consumer.- [ ] [extract-usecanonpatch-universe-setuniverse] **Extract `useCanonPatch(universe, setUniverse, universeId, mountedRef)`.** `UniverseCanon.jsx` + `NounsStage.jsx` 95% identical optimistic-patch handlers. Extract when a 3rd caller appears.-- [ ] [extract-account-list-capability-row] **Extract a shared `accountListRow(id, label, settingsPath, accounts)` in `server/lib/capabilityMap.js`.** `calendarRow` and `messagesRow` are structurally identical (account list → enabled-count → ok/warn/unconfigured tier + "N of M syncing" summary), differing only in id/label/path. Two callers today — extract at the 3rd account-style integration (e.g. a future email/social-accounts capability row). Surfaced by /simplify during `[codex5-onboarding-capability-map]` claim 2026-05-24.- [ ] [shallow-equal-guard-in-usemediaannotations-socket] **Shallow-equal guard in `useMediaAnnotations` socket handler.** Speculative micro-opt; theoretical until observed.- [ ] [low-client-extract-shared-usepopoverposition-hook] **[LOW][CLIENT]** Extract shared `usePopoverPosition` hook — **premise eroded; revisit when a 3rd caller lands.** Original PLAN flagged 4 components but `VisualStylePicker` no longer exists and `AddToCollectionMenu` / `BulkTargetPicker` no longer use portal positioning. Today the pattern lives in exactly two components (`client/src/components/ThemeSwitcher.jsx` and `client/src/components/media/CollectionPickerShell.jsx`) — both implement portal-with-fixed-positioning + `useLayoutEffect` measurement + rAF-coalesced scroll/resize listeners. With only 2 callers the abstraction isn't worth the indirection; extract when a third surface needs the same shape.- [ ] [setup-data-import-drift-tables-from-migrations] **`setup-data.js` should import drift tables from each migration file.** `SHIPPED_PROMPT_OLD_MD5` + `SHIPPED_PROMPT_NEW_MD5` in `scripts/setup-data.js:139-196` manually mirror the `ACCEPTED_OLD_MD5` + `NEW_SHIPPED_MD5` exports each migration file already maintains. The mirror is hand-edited every time a migration ships and is the most likely place to drift. After `[backport-pre-023-migrations-to-_lib]` lands, every prompt-replace migration will export those constants — `setup-data.js` can build `SHIPPED_PROMPT_OLD_MD5` / `SHIPPED_PROMPT_NEW_MD5` by `import * as m025 from './migrations/025-idea-stage-character-detail.js'`-style sweep (or by glob+dynamic import) and removing the mirror entirely. Single source of truth, no hand sync. Surfaced by /simplify during `[pipeline-idea-stage-character-detail-plumbing]`.diff --git a/server/lib/capabilityMap.js b/server/lib/capabilityMap.jsindex 4e5e9c01dc..2b6c5fb795 100644--- a/server/lib/capabilityMap.js+++ b/server/lib/capabilityMap.js@@ -63,26 +63,47 @@ export function providersRow(providers = [], statuses = {}) {});}-export function calendarRow(accounts = []) {+// Calendar and Messages share the same account-list shape: each account has an+// `enabled` flag and a persisted `lastSyncStatus`. An enabled account whose last+// sync ended in 'error' or 'partial' degrades the row to WARN so the page can't+// claim "Ready" while a sync is actively failing.+function accountListRow(id, label, settingsPath, accounts) {const list = Array.isArray(accounts) ? accounts : [];if (list.length === 0) {- return row('calendar', 'Calendar', '/calendar/config', {+ return row(id, label, settingsPath, {status: UNCONFIGURED,configured: false,- summary: 'No calendar accounts connected',+ summary: `No ${label} accounts connected`,});}- const enabled = list.filter((a) => a && a.enabled).length;- return row('calendar', 'Calendar', '/calendar/config', {- status: enabled > 0 ? OK : WARN,+ const enabledAccounts = list.filter((a) => a && a.enabled);+ const enabled = enabledAccounts.length;+ const failing = enabledAccounts.filter(+ (a) => a.lastSyncStatus === 'error' || a.lastSyncStatus === 'partial',+ ).length;+ let status = OK;+ let summary;+ if (enabled === 0) {+ status = WARN;+ summary = `${list.length} ${plural(list.length, 'account')}, none enabled`;+ } else if (failing > 0) {+ status = WARN;+ summary = `${enabled} of ${list.length} syncing · ${failing} failing`;+ } else {+ summary = `${enabled} of ${list.length} ${plural(list.length, 'account')} syncing`;+ }+ return row(id, label, settingsPath, {+ status,configured: true,- summary: enabled > 0- ? `${enabled} of ${list.length} ${plural(list.length, 'account')} syncing`- : `${list.length} ${plural(list.length, 'account')}, none enabled`,- detail: { total: list.length, enabled },+ summary,+ detail: { total: list.length, enabled, failing },});}+export function calendarRow(accounts = []) {+ return accountListRow('calendar', 'Calendar', '/calendar/config', accounts);+}+export function brainRow({ memoryCount = 0, embeddingProviderConfigured = false } = {}) {const count = Number(memoryCount) || 0;if (count === 0 && !embeddingProviderConfigured) {@@ -183,23 +204,7 @@ export function telegramRow({ hasToken = false, hasChatId = false, connected = f}export function messagesRow(accounts = []) {- const list = Array.isArray(accounts) ? accounts : [];- if (list.length === 0) {- return row('messages', 'Messages', '/messages/config', {- status: UNCONFIGURED,- configured: false,- summary: 'No message accounts connected',- });- }- const enabled = list.filter((a) => a && a.enabled).length;- return row('messages', 'Messages', '/messages/config', {- status: enabled > 0 ? OK : WARN,- configured: true,- summary: enabled > 0- ? `${enabled} of ${list.length} ${plural(list.length, 'account')} syncing`- : `${list.length} ${plural(list.length, 'account')}, none enabled`,- detail: { total: list.length, enabled },- });+ return accountListRow('messages', 'Messages', '/messages/config', accounts);}export function appsRow(summary = {}) {@@ -213,12 +218,17 @@ export function appsRow(summary = {}) {}const online = Number(summary?.online) || 0;const stopped = Number(summary?.stopped) || 0;+ // notStarted = registered but never launched / no matching PM2 process — a+ // setup gap this page exists to surface, so it degrades the row too. unmanaged+ // (Xcode/native projects with no runtime state) is intentionally NOT counted.+ const notStarted = Number(summary?.notStarted) || 0;return row('apps', 'Apps & Processes', '/apps', {- status: stopped > 0 ? WARN : OK,+ status: stopped > 0 || notStarted > 0 ? WARN : OK,configured: true,summary: `${total} ${plural(total, 'app')} · ${online} online`- + (stopped > 0 ? ` · ${stopped} stopped` : ''),- detail: { total, online, stopped },+ + (stopped > 0 ? ` · ${stopped} stopped` : '')+ + (notStarted > 0 ? ` · ${notStarted} not started` : ''),+ detail: { total, online, stopped, notStarted },});}diff --git a/server/lib/capabilityMap.test.js b/server/lib/capabilityMap.test.jsindex 361b307d6b..20f5426fc3 100644--- a/server/lib/capabilityMap.test.js+++ b/server/lib/capabilityMap.test.js@@ -62,6 +62,17 @@ describe('calendarRow / messagesRow', () => {it('warns when accounts exist but none enabled', () => {expect(calendarRow([{ enabled: false }]).status).toBe(WARN);});++ it('warns when an enabled account last sync failed', () => {+ const r = calendarRow([{ enabled: true, lastSyncStatus: 'error' }, { enabled: true, lastSyncStatus: 'success' }]);+ expect(r.status).toBe(WARN);+ expect(r.detail.failing).toBe(1);+ expect(r.summary).toContain('1 failing');+ // 'partial' also counts as failing+ expect(messagesRow([{ enabled: true, lastSyncStatus: 'partial' }]).status).toBe(WARN);+ // a never-synced (null) account is not a failure+ expect(calendarRow([{ enabled: true, lastSyncStatus: null }]).status).toBe(OK);+ });});describe('brainRow', () => {@@ -147,6 +158,13 @@ describe('appsRow', () => {expect(appsRow({ total: 3, online: 3, stopped: 0 }).status).toBe(OK);expect(appsRow({ total: 3, online: 2, stopped: 1 }).status).toBe(WARN);});++ it('warns when apps are registered but never started', () => {+ const r = appsRow({ total: 3, online: 0, stopped: 0, notStarted: 3 });+ expect(r.status).toBe(WARN);+ expect(r.summary).toContain('3 not started');+ expect(r.detail.notStarted).toBe(3);+ });});describe('buildCapabilityRows', () => {