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
plan: defer two reassignment follow-ups from PR #1243 review (stale-run filtering, TOCTOU recheck)
[._.]/ Adam Eivy33953ac234d1
diff --git a/PLAN.md b/PLAN.mdindex 18b02411d4..c70d64c405 100644--- a/PLAN.md+++ b/PLAN.md@@ -20,6 +20,10 @@ independently.<!-- reference-watch proposals: slug-tagged, picked up by /claim later -->+- [ ] [lora-reassign-filter-stale-runs-by-character] **After a dataset is reassigned to a new character, stop showing the old character's training runs (and their checkpoint picker) under the new character.** Deferred from the codex review of PR #1243 (gated-repo + dataset-reassignment). `patchDataset` now resets a reassigned dataset to draft and `flipDatasetAfterRun` is character-guarded, so an old run can no longer flip the new character's status — but `TrainingPanel` (`client/src/components/loraTraining/TrainingPanel.jsx`) still lists runs purely by `datasetId` (`listLoraTrainingRuns({ datasetId })`), so after reassigning A→B, B's workbench shows A's completed run and offers its CheckpointPicker. Promoting A's checkpoint then registers a LoRA for A (correct, via `run.character`) while B's dataset stays draft — confusing "nothing happened" UX. Fix: filter the runs `TrainingPanel` displays/promotes to those whose `run.character.entryId` matches the dataset's current character (runs carry their character snapshot), or scope the runs query by current character. Server `listRuns` already accepts `characterId`. Estimated scope: small.++- [ ] [lora-reassign-recheck-training-status-under-lock] **Re-check dataset training status inside the `patchDataset` write lock to close the reassign/train-start TOCTOU.** Deferred from the codex review of PR #1243. The new "refuse reassignment while training" guard in `server/services/loraDatasets.js` reads status from a `loraDatasetStore.loadAll()` snapshot taken before `updateDataset()` acquires the per-record write lock; if `startTrainingRun` stamps `status: 'training'` in that window, the reassignment can still slip through. The character-aware `flipDatasetAfterRun` guard already prevents the worst outcome (wrong-character flip), so this is a residual hardening, not a corruption risk. Fix: re-read `current.status` inside the `updateDataset` mutation callback when `characterChanged` and abort/throw `409 DATASET_TRAINING` there (confirm `updateDataset` propagates a thrown `ServerError` from the callback to the caller, or return a sentinel the wrapper translates). Estimated scope: small. (Single-user trust model — per CLAUDE.md this is a same-actor re-entrancy guard, which is in-scope, not a multi-actor race.)+- [ ] [ref-watch-phosphene-model-weights-integrity-repair] **Verify downloaded model weights (header/size + optional checksum) and offer one-click Repair.** From `reference-watch` review of Phosphene (commits `173d2fd5` + `80752a70`, 2026-06-12). Upstream proved that corrupt/partial safetensors (right size, *wrong bytes*) silently decode to garbled "mosaic" video output that a clean re-download fixes — a leading non-Metal cause of bad renders that hits some machines and not others, so it's cross-platform-relevant for PortOS (mac and windows). PortOS currently only sums file sizes: `server/lib/hfCache.js#inspectModelCache()` returns `{ cached, sizeBytes }` with no integrity check. Fix: add a `verifyModelCache(repoId)` to `server/lib/hfCache.js` that does a cheap structural check first (read each safetensors header length prefix and confirm the file is at least header+declared-tensor-bytes long — catches truncation without loading tensors), and an optional deep check that hashes each weight and compares against HuggingFace's published LFS sha256 (from the repo's `git lfs` pointer / `/api/models/<repo>` metadata). Surface results on `GET /api/video-gen/status` (and the imageGen status it mirrors) as a `modelIntegrity` field, add `POST /api/video-gen/models/verify` (force re-scan, threaded/on-demand) and `POST /api/video-gen/models/repair` (delete flagged files + re-download via the existing resumable HF fetch path), and show a dismissible "Repair model" banner in `client/src/pages/VideoGen.jsx` when integrity reports bad/missing files. Estimated scope: large.- [ ] [ref-watch-phosphene-runtime-fingerprint-in-status] **Surface the video runtime fingerprint (ltx-2-mlx version, MLX/Metal version, chip, OS) in video-gen status + render logs.** From `reference-watch` review of Phosphene (commits `b069e2d2` P2 + `093a9f05`, 2026-06-12). Upstream found that garbled/"mosaic" output is often a per-chip/per-runtime numerical bug, not a crash, and healthy bug reports carried no version info — so it now logs a one-line runtime fingerprint and exposes `ltx_version`/`mlx_version`/`chip`/`os` on `/status`. PortOS already resolves BYOV runtimes (`server/services/videoGen/local.js#BYOV_RUNTIME_INFO`) but `GET /api/video-gen/status` (`server/routes/videoGen.js:180`) does not report the resolved interpreter/package versions. Fix: have `generate_ltx2.py` (and the wan22/hunyuan/win helpers) emit a single `runtime | ...` fingerprint line at startup (importlib.metadata version of the runtime package + platform/processor on mac, torch+CUDA on windows), capture it in `local.js`, persist it onto the render job/history record so each render log self-documents its environment, and add a `runtime` block to the `/status` payload for the client to show. Estimated scope: medium.