Skip to content

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

docs(reference-watch): propose 4 item(s) from Phosphene

[._.]/ Adam Eivyfa6026a514e5
diff --git a/PLAN.md b/PLAN.md
index e2157602a7..18b02411d4 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -15,3 +15,17 @@ This file no longer tracks individual tasks (so it stops generating merge
conflicts as work proceeds). Speculative ideas now live as `future`-labeled
issues rather than a list here, so they can each be promoted, refined, or closed
independently.
+
+## Next Up
+
+<!-- reference-watch proposals: slug-tagged, picked up by /claim later -->
+
+- [ ] [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.
+
+- [ ] [ref-watch-phosphene-i2v-snap-dims-to-source-aspect] **Auto-snap I2V default width×height to the uploaded source image's aspect ratio.** From `reference-watch` review of Phosphene (commit `0b98a5bd`, 2026-06-12). Upstream keeps custom W×H inputs editable for image flows but auto-snaps the *default* dimensions to the uploaded image via `snapAspectToImage()`, because the common case can't cover-crop a 16:9 photo into a 9:16 frame without losing content. PortOS already exposes editable W×H plus presets, but on I2V it ffmpeg cover-crops the source to the chosen size (`server/services/videoGen/local.js#resizeImage()` uses `force_original_aspect_ratio=increase,crop`), so a mismatched preset silently crops away the subject. Fix: when a source/keyframe image is selected in `client/src/pages/VideoGen.jsx`, read its natural dimensions and snap the width/height fields to the nearest 64-aligned preset that matches the image's aspect ratio (only when the user hasn't manually overridden), leaving the inputs editable for power users; keep the existing server-side 64-grid clamp. Estimated scope: small.
+
+### Trigger-gated (waiting for a precondition)
+
+- [ ] [ref-watch-phosphene-spaced-lora-id-decode-validate] **Harden trained-character/LoRA id handling for spaced filenames + percent-encoded path segments.** From `reference-watch` review of Phosphene (commit `ce031395`, 2026-06-12). Upstream's character-id validation regex was a hard gate that ran *before* the sidecar was read, so a LoRA whose trigger/filename contained a space (e.g. `Annie Phosphene_v2.safetensors`) was misclassified as style-only and vanished from the Characters tab; the fix widened the id class to allow spaces and made the route `unquote()`-then-validate (staying traversal-safe because an encoded `../` or `/` decodes to chars the class still rejects). PortOS's equivalent is `server/services/loras.js#assertSafeLoraFilename()` plus the trained-LoRA `character` classification it surfaces. Fix (if applicable): audit whether any PortOS LoRA/character id route 404s or misclassifies spaced filenames and whether percent-encoded id segments are decoded before validation; if so, widen the allowed id class to permit spaces and decode-then-validate in the route. **Decision needed:** confirm PortOS actually exposes id-addressed character/LoRA routes (not just filename-addressed ones) and reproduces the spaced-name misclassification before investing — it may already be covered by `assertSafeLoraFilename`'s filename-only model. Estimated scope: small.