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

address review (claude): use typeof guard for systemMemoryGb budget + name the swapped model in toast + cover new status field

[._.]/ Adam Eivy9e14011b01a1
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index 6fb5081381..782ba606f6 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -595,7 +595,12 @@ export default function VideoGen() {
// so the user can at least try, and the install banner / OOM surfaces
// the real constraint instead of a silent dropdown change.
const reserveGb = 16;
- const budget = status?.systemMemoryGb
+ // typeof === 'number' (not `status?.systemMemoryGb ? ...`) so a server
+ // legitimately reporting a tiny number (0 GB after rounding on a
+ // sub-GB box) flows through the `fits` check and lands on the
+ // smallest model. The truthiness shortcut would collapse 0 with
+ // "absent" and pick the LARGEST model on a tiny machine.
+ const budget = typeof status?.systemMemoryGb === 'number'
? Math.max(0, status.systemMemoryGb - reserveGb)
: Number.POSITIVE_INFINITY;
const sortedDesc = [...visibleModels].sort(
@@ -614,10 +619,13 @@ export default function VideoGen() {
if (!fallback || fallback === modelId) return;
// Toast only for the stale-id case (model removed from catalog). The
// mode-incompatibility swap is expected behavior after a mode change —
- // no need to surface it.
+ // no need to surface it. Name the destination model so users on a2v
+ // don't think they landed on `status.defaultModel` (they may not have —
+ // a2v picks the largest-fits model, which is often a dgrauet entry).
if (!current && staleModelToastRef.current !== modelId) {
staleModelToastRef.current = modelId;
- toast(`Original model "${modelId}" is no longer available — using default`);
+ const fallbackName = models.find((m) => m.id === fallback)?.name || fallback;
+ toast(`Original model "${modelId}" is no longer available — switched to "${fallbackName}"`);
}
setModelId(fallback);
}, [modelId, models, status?.defaultModel, status?.systemMemoryGb, mode, visibleModels]);
diff --git a/server/routes/videoGen.test.js b/server/routes/videoGen.test.js
index e01e80f604..7652da7251 100644
--- a/server/routes/videoGen.test.js
+++ b/server/routes/videoGen.test.js
@@ -182,6 +182,11 @@ describe('videoGen routes', () => {
expect(r.body.pythonPath).toBe('/usr/bin/python3');
expect(r.body.missingPackages).toEqual([]);
expect(r.body.defaultModel).toBe('ltx2_unified');
+ // systemMemoryGb drives the client's a2v auto-select (largest model
+ // that fits in `systemMemoryGb - 16 GB` headroom). Pin the field's
+ // presence + type so a future accidental removal is caught here.
+ expect(typeof r.body.systemMemoryGb).toBe('number');
+ expect(r.body.systemMemoryGb).toBeGreaterThan(0);
});
it('reports disconnected with reason + missingPackages when packages fail to import', async () => {