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
Silence benign 404 log spam when a LoRA dataset's universe was deleted
[._.]/ Adam Eivy5fdf7e7ae9bd
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 69c6cc8f6b..2a27c64010 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -40,6 +40,8 @@## Fixed+- **Opening a LoRA dataset whose universe was deleted no longer spams the server log with `❌ Route error`** — The dataset workbench (`/media/training/:id`) speculatively fetches the dataset's `character.universeId` ({ silent: true }) to pre-load the canon character's variation axes. When that universe has since been deleted, the lookup 404s — harmless, and the client already swallows it — but the server logged every 404 as `❌ Route error [GET /api/universe-builder/<id>]: Universe not found`, and since the page reconnects every ~20s it logged the same line on a loop. `GET /api/universe-builder/:id` now tags a not-found result `severity: 'warning'`, so the error middleware skips the log line (and the client's error-toast hook already drops warnings) — matching the existing benign-404 precedent for speculative media-job archive lookups. (`server/routes/universeBuilder.js`)+- **A gated-model LoRA training failure now shows a one-click "Request access" link, like image rendering already does** — Training a FLUX.2 Klein LoRA pulls a *different, separately-gated* HuggingFace repo than rendering does (the mflux trainer resolves `flux2-klein-9b` → `black-forest-labs/FLUX.2-klein-base-9B`, whereas inference uses `FLUX.2-klein-9B`). So a user who'd accepted the inference model's license — and whose stored token is otherwise valid, with `canReadGatedRepos` — still hit a `GatedRepoError` the instant training started, with no obvious next step. Image rendering already turns this into an actionable banner with a deep link to the license page; training now does the same. The failure classifier extracts the gated `owner/repo` from the trainer's stderr (both the `Access to model … is restricted` and `Cannot access gated repo for url …` forms), persists it on the run record as `errorRepo`, and the training panel renders a **"Request access to `<repo>` ↗"** button that opens the exact license page — accept it there with the token's account and retry, no token change needed. The repo-extraction the image runner already did inline is now a shared `extractGatedRepo()` helper (`server/lib/hfErrors.js`) both subsystems consume. (`server/lib/hfErrors.js`, `server/services/loraTraining/failure.js`, `server/services/loraTraining/index.js`, `server/services/imageGen/local.js`, `client/src/components/loraTraining/TrainingPanel.jsx`)- **mflux-trained FLUX.2 LoRAs now load into diffusers (double-block `to_out` key mismatch)** — Even on the bf16 base, an mflux-trained adapter failed to load with `Target module ModuleList(...) is not supported`, so the whole LoRA was dropped and the render fell back to base. Cause: mflux targets a double transformer block's `attn.to_out` as a bare Linear and exports the key `transformer_blocks.N.attn.to_out.lora_*`, but diffusers' `Flux2Attention` wraps that projection in `ModuleList([Linear, Dropout])` — PEFT needs the inner `.0`. The shared LoRA loader (`scripts/lora_utils.py`) now normalizes mflux adapters on load: it inserts the `.0` for double-block `to_out` only (single-block `to_out` is a bare Linear in diffusers and is left alone), then hands diffusers the remapped state dict. Verified against the real diffusers Flux2 structure — all 100 of the adapter's target modules resolve to `nn.Linear` after the fix. Self-healing: existing trained LoRAs are fixed at load time with no re-training or migration. Every other mflux target already matched diffusers naming. (`scripts/lora_utils.py`)diff --git a/server/routes/universeBuilder.js b/server/routes/universeBuilder.jsindex 70eb573e02..eacdd0fbfb 100644--- a/server/routes/universeBuilder.js+++ b/server/routes/universeBuilder.js@@ -515,7 +515,16 @@ router.post('/merge/ai-resolve', asyncHandler(async (req, res) => {}));router.get('/:id', asyncHandler(async (req, res) => {- const w = await svc.getUniverse(req.params.id).catch((err) => { throw mapServiceError(err); });+ // Read-by-id 404s are benign and high-volume: callers like LoraDatasetDetail+ // speculatively fetch a dataset's `character.universeId` ({ silent: true }),+ // which 404s whenever that universe was deleted. Classify as `warning` so the+ // error middleware skips it instead of spamming ❌ Route error on every+ // page reconnect. (Mirrors the media-job archive-lookup precedent.)+ const w = await svc.getUniverse(req.params.id).catch((err) => {+ const mapped = mapServiceError(err);+ if (mapped?.code === svc.ERR_NOT_FOUND) mapped.severity = 'warning';+ throw mapped;+ });// Lazy stale-reference-sheet collapse: nulls out any character.referenceSheetImageRef// whose underlying file was deleted from disk, so the UI never tries to// render `<img src="/data/image-refs/<gone>">`. Doesn't persist the changediff --git a/server/routes/universeBuilder.test.js b/server/routes/universeBuilder.test.jsindex 5de7b3a84b..ce3ec45728 100644--- a/server/routes/universeBuilder.test.js+++ b/server/routes/universeBuilder.test.js@@ -215,6 +215,18 @@ describe('universe-builder routes', () => {expect(res.body).toEqual([]);});+ it('GET /:id for a missing universe 404s without spamming console.error', async () => {+ // LoraDatasetDetail speculatively fetches a dataset's character.universeId+ // ({ silent: true }); that 404s whenever the universe was deleted. The route+ // tags it severity:'warning' so the error middleware skips the log line.+ const errSpy = vi.spyOn(console, 'error').mockImplementation(() => {});+ const res = await request(buildApp()).get('/api/universe-builder/does-not-exist');+ expect(res.status).toBe(404);+ expect(res.body.code).toBe('NOT_FOUND');+ expect(errSpy).not.toHaveBeenCalled();+ errSpy.mockRestore();+ });+it('POST / creates a universe', async () => {const res = await request(buildApp()).post('/api/universe-builder')