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): send explicit backend from VideoGen page, anchor named-local-model requests local under a grok pin

[._.]/ Adam Eivy3b2aeacf76ee
diff --git a/client/src/components/settings/ImageGenTab.test.jsx b/client/src/components/settings/ImageGenTab.test.jsx
index 6825f8d81a..ec7955fe9c 100644
--- a/client/src/components/settings/ImageGenTab.test.jsx
+++ b/client/src/components/settings/ImageGenTab.test.jsx
@@ -212,6 +212,26 @@ describe('ImageGenTab grouped tabs', () => {
expect(patch.imageGen).toHaveProperty('agy');
expect(patch.imageGen).toHaveProperty('expose');
});
+
+ it('the videoGen save body round-trips sibling keys the tab does not edit (#3231 Phase 4)', async () => {
+ // The settings PUT replaces top-level slices wholesale, so if this wire
+ // body ever drops the loaded slice's sibling keys, a Defaults-tab save
+ // erases videoGen.defaultModelId (read by pipeline video stages). The
+ // server suite can't see this — it validates whatever body arrives — so
+ // the exact wire body is pinned HERE.
+ getSettings.mockResolvedValue({
+ imageGen: { mode: 'external', external: { sdapiUrl: 'http://localhost:7860' } },
+ videoGen: { mode: 'grok', defaultModelId: 'ltx23_distilled_q4' },
+ });
+ await renderTab(['/media/image?mediaTab=defaults']);
+ const videoSelect = screen.getByLabelText(/Default video backend/i);
+ expect(videoSelect.value).toBe('grok');
+ fireEvent.change(videoSelect, { target: { value: 'local' } });
+ fireEvent.click(screen.getByRole('button', { name: /^Save$/ }));
+ await waitFor(() => expect(updateSettings).toHaveBeenCalled());
+ const patch = updateSettings.mock.calls[0][0];
+ expect(patch.videoGen).toEqual({ mode: 'local', defaultModelId: 'ltx23_distilled_q4' });
+ });
});
describe('ImageGenTab — Agy CLI section', () => {
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index df9cab13d5..7fd7742c35 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -1193,6 +1193,10 @@ export default function VideoGen() {
// along when keyframes aren't active.
const legacyFflf = mode === 'fflf' && !keyframesActive;
return {
+ // The page's backend toggle IS an explicit choice — send it so the
+ // server's #3231 video pin ladder can't reroute a Local render to a
+ // pinned grok backend behind the UI's back.
+ backend: 'local',
prompt: promptOut,
negativePrompt: composed.negativePrompt,
modelId,
diff --git a/server/routes/settings.test.js b/server/routes/settings.test.js
index 9c9568e373..b5c25b6f2f 100644
--- a/server/routes/settings.test.js
+++ b/server/routes/settings.test.js
@@ -220,7 +220,11 @@ describe('Settings routes — videoGen slice (#3231 Phase 4)', () => {
vi.clearAllMocks();
});
- it('accepts the install-wide video pin and preserves sibling keys', async () => {
+ it('accepts the install-wide video pin fields and the null clear', async () => {
+ // NOTE: the settings PUT replaces top-level slices wholesale, so sibling-key
+ // preservation (defaultModelId surviving a mode-only save) is the CLIENT's
+ // job — ImageGenTab round-trips the loaded slice (videoGenSliceRef); the
+ // client suite pins that wire body. This test only pins schema acceptance.
const res = await request(buildApp())
.put('/api/settings')
.send({ videoGen: { mode: 'grok', defaultModelId: 'ltx23_distilled_q4' } });
diff --git a/server/routes/videoGen.js b/server/routes/videoGen.js
index 6f8969725c..aa88e842e0 100644
--- a/server/routes/videoGen.js
+++ b/server/routes/videoGen.js
@@ -763,6 +763,11 @@ router.post('/', frameImageUpload, asyncHandler(async (req, res) => {
// silently dropping those inputs. A pin degrades; only an explicit backend
// request errors.
const grokDeliverable = (!body.mode || body.mode === 'text' || body.mode === 'image')
+ // A named local model is local-only machinery in the same sense as the
+ // fields below — grok has no model knob, so honoring a grok pin here
+ // would silently discard the model the caller asked for (e.g. a media
+ // requeue rebuilding a local render's config without a backend field).
+ && !body.modelId
&& !uploads.lastImage && !body.lastImageFile
&& !uploads.audioFile
&& !uploads.icReference && !body.icReferenceVideoIds?.length && !body.icReferenceImageFiles?.length
diff --git a/server/routes/videoGen.test.js b/server/routes/videoGen.test.js
index 5ed5cf4988..3a603a33ca 100644
--- a/server/routes/videoGen.test.js
+++ b/server/routes/videoGen.test.js
@@ -334,6 +334,21 @@ describe('videoGen routes', () => {
expect(call[0].params.mode).not.toBe('grok');
});
+ it('a named local model anchors a no-backend request local, even under a grok pin', async () => {
+ const { getSettings } = await import('../services/settings.js');
+ getSettings.mockResolvedValueOnce({
+ imageGen: { ...grokReady, local: { pythonPath: '/usr/bin/python3' } },
+ videoGen: { mode: 'grok' },
+ });
+ // A media requeue rebuilds a local render's config (modelId, no backend)
+ // — grok has no model knob, so the pin must not discard the model.
+ const r = await request(app).post('/api/video-gen/').send({ prompt: 'a fox', modelId: 'ltx2_unified' });
+ expect(r.status).toBe(200);
+ const [call] = mediaJobQueue.enqueueJob.mock.calls;
+ expect(call[0].params.mode).not.toBe('grok');
+ expect(call[0].params.modelId).toBe('ltx2_unified');
+ });
+
it('a grok pin degrades to local when the request carries local-only machinery', async () => {
const { getSettings } = await import('../services/settings.js');
getSettings.mockResolvedValueOnce({