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

review: clean dead test config, defensive client guards, document deprecated default constraint

Adam Eivyfcd2964ff23f
diff --git a/PLAN.md b/PLAN.md
index 73e371f6b1..dc2cfd616b 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -50,6 +50,8 @@ The dgrauet/ltx-2-mlx runtime ships with FFLF (true keyframe interpolation), aud
- [ ] **Route `MediaLightbox` settings drawer through `components/Drawer.jsx`** — In full-screen mode the lightbox renders a hand-rolled aside (`absolute top-0 right-0 bottom-0 w-full sm:w-96 z-20`) that is exactly the project's existing `Drawer` component. Skipped during the simplify pass because `Drawer`'s flat Esc handler conflicts with the lightbox's layered Escape cascade (drawer → fullscreen → close); reconcile by either lifting the cascade above `Drawer` or letting `Drawer` accept a no-op-Esc prop.
- [ ] **Extract `<ModelSelect>` component for the active+Legacy optgroup pattern** — `client/src/pages/VideoGen.jsx` and `client/src/pages/CreativeDirector.jsx` both render an identical "filter(!deprecated).map + optgroup('Legacy') + filter(deprecated).map" block (differ only in `m.name` vs `m.name || m.id`). Extract `client/src/components/ModelSelect.jsx` taking `{ models, value, onChange, labelOf?, disabled? }` and convert both sites. ~30 LOC removal, and any future model dropdown picks up the deprecated-grouping for free. Surfaced from the LTX-deprecate /simplify pass.
- [ ] **Extract `mockPathsDataRoot()` test helper** — `server/lib/storyBible.test.js`, `server/services/writersRoom/{characters,settings,objects,local,promoteToPipeline}.test.js` (6 files) all open with byte-identical setup: `let tempRoot; vi.mock('../../lib/fileUtils.js', async () => { const actual = await vi.importActual(...); return new Proxy(actual, { get(t,p){ if (p==='PATHS') return new Proxy(actual.PATHS,{get(tp,pp){ if(pp==='data') return tempRoot; ... }}); ... } }); }); beforeEach(() => { tempRoot = mkdtempSync(...) }); afterEach(() => rmSync(tempRoot, { recursive: true, force: true }))`. Extract into `server/test-utils/tempDataRoot.js` exposing `mockPathsDataRoot()` that returns a live tempRoot getter. ~20 LOC saved per file plus a single fix-point if PATHS mocking semantics ever change. Surfaced from the bibleStore-factory /simplify pass.
+- [ ] **Widen `spawningTasks` try/finally in `agentLifecycle.js#spawnAgentForTask`** — pre-existing bug surfaced during /do:review. Today's try/finally (`server/services/agentLifecycle.js:536-547`) only wraps the spawn call itself. Between `spawningTasks.add(task.id)` (line 134) and the try-block, the function does ~400 lines of async work — `buildAgentPrompt`, `writeFile(prompt)`, `createAgentRun`, `registerAgent`, etc. — each of which can throw (ENOSPC, EACCES, network). A throw on any of those paths leaves `spawningTasks` registered FOREVER, permanently blocking future spawns of that task id. The detected-error paths call `cleanupOnError` which does delete, but an unhandled throw is the gap. Fix: hoist the try/finally up to wrap from line 134 (after `add`) through the spawn calls. `cleanupOnError`'s redundant `spawningTasks.delete` becomes a no-op (Set.delete on absent key) which is fine. Pre-existing bug, not introduced by the dedup-race fix.
+- [ ] **`useAsyncAction` post-unmount setState guard** — the hook in `client/src/hooks/useAsyncAction.js` calls `setRunning(false)` after an awaited async fn resolves. If the owning component unmounts mid-action, React 18 silently warns; React 17 surfaces the warning. Add a `mountedRef` (set true in mount effect, false in cleanup) and gate `setRunning(false)` on `mountedRef.current`. YAGNI for current call sites (all stable parent components) but worth doing once the hook gains a 4th consumer or any consumer that unmounts during long-running ops. Surfaced from /do:review.
### Civitai LoRA / Z-Image-Turbo follow-ups (from /simplify pass)
diff --git a/client/src/components/pipeline/stages/EpisodeVideoStage.jsx b/client/src/components/pipeline/stages/EpisodeVideoStage.jsx
index c10566f109..f1b01885cc 100644
--- a/client/src/components/pipeline/stages/EpisodeVideoStage.jsx
+++ b/client/src/components/pipeline/stages/EpisodeVideoStage.jsx
@@ -102,9 +102,9 @@ export default function EpisodeVideoStage({ issue, onStageUpdate }) {
// tore the in-flight progress UI off the page even though the
// previous CD project was still rendering.
setCdProject(null);
- toast.success(`Restarted: ${result.cdProjectId.slice(0, 8)}`);
+ toast.success(`Restarted: ${result.cdProjectId?.slice(0, 8) ?? '?'}`);
} else if (result.reused) {
- toast.success(`Reusing in-flight CD project ${result.cdProjectId.slice(0, 8)}`);
+ toast.success(`Reusing in-flight CD project ${result.cdProjectId?.slice(0, 8) ?? '?'}`);
} else {
toast.success(`Queued ${result.scenes} scene${result.scenes === 1 ? '' : 's'}`);
}
diff --git a/client/src/pages/CreativeDirector.jsx b/client/src/pages/CreativeDirector.jsx
index 3a88d4e1f7..1acc2dc419 100644
--- a/client/src/pages/CreativeDirector.jsx
+++ b/client/src/pages/CreativeDirector.jsx
@@ -45,7 +45,10 @@ export default function CreativeDirector() {
const fetchProjects = useCallback(() => {
listCreativeDirectorProjects()
.then((data) => { setProjects(data || []); setLoading(false); })
- .catch(() => setLoading(false));
+ .catch((err) => {
+ toast.error(err?.message || 'Failed to load Creative Director projects');
+ setLoading(false);
+ });
}, []);
useEffect(() => {
diff --git a/server/lib/mediaModels.js b/server/lib/mediaModels.js
index bb24d36b1c..5ca4a93cae 100644
--- a/server/lib/mediaModels.js
+++ b/server/lib/mediaModels.js
@@ -448,6 +448,12 @@ export const getVideoModels = () => {
export const getDefaultVideoModelId = () => {
const reg = loadMediaModels();
+ // Note: defaultMacos / defaultWindows may legitimately point at a model
+ // flagged `deprecated: true` — the dgrauet (non-deprecated) runtime
+ // requires an opt-in venv (`INSTALL_LTX2=1 bash scripts/setup-image-video.sh`),
+ // so the shipped default must stay on a model that works out of the box.
+ // The UI dropdowns surface dgrauet at the top via the `Legacy` optgroup
+ // pattern; user-driven migration > auto-rolling forward.
const configuredId = IS_WIN ? reg.video.defaultWindows : reg.video.defaultMacos;
// Validate against the platform's available (non-broken) list — a typo or
// a model marked broken on this platform would otherwise surface as
diff --git a/server/lib/storyBible.test.js b/server/lib/storyBible.test.js
index ab8027ae5f..2270d11b9e 100644
--- a/server/lib/storyBible.test.js
+++ b/server/lib/storyBible.test.js
@@ -314,9 +314,6 @@ function characterStore() {
return createBibleStore({
kind: BIBLE_KIND.CHARACTER,
idPrefix: 'wr-char-',
- idRegex: /^wr-char-[0-9a-f-]+$/i,
- fileName: 'characters.json',
- listKey: 'characters',
dedupKey: (entry) => normalizeBibleName(entry?.name),
primaryFields: ['name'],
editableFields: ['aliases', 'role', 'physicalDescription'],
@@ -331,9 +328,6 @@ function settingStore() {
return createBibleStore({
kind: BIBLE_KIND.SETTING,
idPrefix: 'wr-setting-',
- idRegex: /^wr-setting-[0-9a-f-]+$/i,
- fileName: 'settings.json',
- listKey: 'settings',
dedupKey: (entry) => normalizeSlugline(entry?.slugline || entry?.name || ''),
primaryFields: ['slugline', 'name'],
editableFields: ['description', 'palette'],
diff --git a/server/services/agentLifecycle.test.js b/server/services/agentLifecycle.test.js
index af60b4802f..14be91544c 100644
--- a/server/services/agentLifecycle.test.js
+++ b/server/services/agentLifecycle.test.js
@@ -304,23 +304,16 @@ describe('spawningTasks dedup — late-delete race', () => {
// flips red and points the dev at the race the structural change re-opened.
describe('agentLifecycle source — spawningTasks delete placement', () => {
- it('releases the dedup guard inside a finally, not after updateTask(in_progress)', () => {
+ it('releases the dedup guard inside a finally block', () => {
const fnStart = AGENT_LIFECYCLE_SRC.indexOf('export async function spawnAgentForTask');
expect(fnStart, 'spawnAgentForTask must exist').toBeGreaterThan(-1);
const fnBody = AGENT_LIFECYCLE_SRC.slice(fnStart, fnStart + 60_000);
expect(fnBody).toMatch(/spawningTasks\.add\(task\.id\)/);
- // ANTI-PATTERN: bare `spawningTasks.delete(task.id);` directly after the
- // `updateTask(... 'in_progress' ...)` await (the pre-fix shape). The
- // delete must live inside a `finally` block instead.
- const buggyPattern = /await\s+updateTask\([\s\S]{0,800}?status:\s*['"]in_progress['"][\s\S]{0,800}?\}\s*,\s*task\.taskType[\s\S]{0,200}?\)\s*;\s*spawningTasks\.delete\(task\.id\)/;
- expect(fnBody).not.toMatch(buggyPattern);
-
- // The dedup-delete must be inside a `finally { ... }` clause somewhere in
- // the function — the structural guarantee that the guard outlives the
- // spawn call regardless of which runner/direct branch is taken or what
- // the function names become.
+ // The dedup-delete must live inside a `finally { ... }` clause — the
+ // structural guarantee that the guard outlives the spawn call regardless
+ // of which runner/direct branch is taken or what intervening logic exists.
const finallyPattern = /finally\s*\{[\s\S]{0,400}?spawningTasks\.delete\(task\.id\)/;
expect(fnBody).toMatch(finallyPattern);
});