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

fix: clear the reference-mode promise where the UI can no longer keep it (#4874)

[._.]/ Adam Eivy354725ba51a0
diff --git a/client/src/components/media/MediaJobsQueue.jsx b/client/src/components/media/MediaJobsQueue.jsx
index f2a3611dc2..2f2bed3371 100644
--- a/client/src/components/media/MediaJobsQueue.jsx
+++ b/client/src/components/media/MediaJobsQueue.jsx
@@ -9,7 +9,10 @@ import { listLoraTrainingCheckpoints } from '../../services/apiLoraTraining.js';
import { isCloudCliMode, IMAGE_GEN_MODE, CODEX_IMAGEGEN_DEFAULT_EFFORT, supportsCloudModelOverride, modeLabel } from '../../lib/imageGenBackends';
import { ANTIGRAVITY_CONFIGURED_DEFAULT, CODEX_EFFORT_LEVELS, isConfiguredDefaultModel } from '../../utils/providers';
import { lossSparklineGeometry } from '../../lib/lossSparkline';
-import { isDefaultI2vReferenceMode, normalizeI2vReferenceMode, resolveI2vReferenceStrength } from '../../lib/videoReferenceModes';
+import {
+ DEFAULT_I2V_REFERENCE_MODE, isDefaultI2vReferenceMode, normalizeI2vReferenceMode,
+ resolveI2vReferenceStrength, runtimeSupportsI2vReferenceMode,
+} from '../../lib/videoReferenceModes';
import { useAutoRefetch } from '../../hooks/useAutoRefetch';
import { useConfirmDelete } from '../../hooks/useConfirmDelete';
import useMounted from '../../hooks/useMounted';
@@ -722,6 +725,19 @@ function VideoRetryForm({ job, onSubmit, onCancel }) {
}, []);
const currentModel = models.find((model) => model.id === modelId) || null;
+ // Switching the retry to a model that pins frame one has to clear the promise
+ // with it (#4874) — the picker offers only Anchor there, so leaving `inspire`
+ // in state would strand the form on a value the user cannot see or change and
+ // the server would reject on submit. Mirrors the same snap-back in
+ // useVideoGenForm — including the deferral: `models` loads async from
+ // getVideoGenStatus, so an unresolved `currentModel` means "not known yet",
+ // never "cannot honor it".
+ useEffect(() => {
+ if (isDefaultI2vReferenceMode(i2vReferenceMode)) return;
+ if (!currentModel) return;
+ if (runtimeSupportsI2vReferenceMode(currentModel.runtime, i2vReferenceMode)) return;
+ setI2vReferenceMode(DEFAULT_I2V_REFERENCE_MODE);
+ }, [currentModel, i2vReferenceMode]);
const isGrok = p.mode === 'grok';
const loraFamily = videoLoraFamily(currentModel);
const videoLoras = loraFamily ? availableLoras.filter((lora) => loraFamilyOf(lora) === loraFamily) : [];
diff --git a/client/src/components/media/MediaJobsQueue.test.jsx b/client/src/components/media/MediaJobsQueue.test.jsx
index 8f85f40e57..a70a6cd0ee 100644
--- a/client/src/components/media/MediaJobsQueue.test.jsx
+++ b/client/src/components/media/MediaJobsQueue.test.jsx
@@ -16,6 +16,15 @@ vi.mock('../../services/apiMediaJobs.js', () => ({
runMediaJobNow: vi.fn(),
}));
+const getVideoGenStatus = vi.fn();
+vi.mock('../../services/apiImageVideo.js', () => ({
+ getVideoGenStatus: (...a) => getVideoGenStatus(...a),
+}));
+const listLorasFull = vi.fn();
+vi.mock('../../services/api', () => ({
+ listLorasFull: (...a) => listLorasFull(...a),
+}));
+
const listLoraTrainingCheckpoints = vi.fn();
vi.mock('../../services/apiLoraTraining.js', () => ({
listLoraTrainingCheckpoints: (...a) => listLoraTrainingCheckpoints(...a),
@@ -45,6 +54,10 @@ beforeEach(() => {
listLoraTrainingCheckpoints.mockReset();
retryMediaJob.mockReset();
retryMediaJob.mockResolvedValue({ jobId: 'new-job-1234' });
+ getVideoGenStatus.mockReset();
+ getVideoGenStatus.mockResolvedValue({ models: [] });
+ listLorasFull.mockReset();
+ listLorasFull.mockResolvedValue([]);
});
const failedCodexJob = {
@@ -346,3 +359,62 @@ describe('MediaJobsQueue — training rows', () => {
expect(listLoraTrainingCheckpoints).not.toHaveBeenCalled();
});
});
+
+// The conditioning promise (#4874) rides a video retry — and has to snap back
+// when the user retargets the retry at a model that pins frame one, because the
+// picker offers only Anchor there and the server rejects the mismatch.
+describe('MediaJobsQueue — video retry reference mode (#4874)', () => {
+ const LTX25 = { id: 'ltx25-model', name: 'LTX-2.5', runtime: 'ltx25', supportedModes: ['text', 'image'] };
+ const LTX2 = { id: 'ltx2-model', name: 'LTX-2.3', runtime: 'ltx2', supportedModes: ['text', 'image'] };
+ const failedInspireJob = {
+ id: 'refmodefail00dead',
+ kind: 'video',
+ status: 'failed',
+ error: 'boom',
+ queuedAt: '2026-06-19T10:00:00Z',
+ params: {
+ prompt: 'a fox', mode: 'image', modelId: 'ltx25-model',
+ i2vReferenceMode: 'inspire', width: 704, height: 448,
+ },
+ };
+
+ const openRetryEditor = async (user) => {
+ listMediaJobs.mockResolvedValue([failedInspireJob]);
+ render(<MediaJobsQueue kind="video" />);
+ await expandReel(user);
+ await user.click(await screen.findByLabelText('Edit and retry'));
+ };
+
+ it('pre-fills the promise the failed job carried', async () => {
+ const user = userEvent.setup();
+ getVideoGenStatus.mockResolvedValue({ models: [LTX25, LTX2] });
+ await openRetryEditor(user);
+ const select = await screen.findByLabelText('Reference mode');
+ await waitFor(() => expect(select.value).toBe('inspire'));
+ });
+
+ it('keeps it while the model catalog is still loading, then snaps back once the model resolves as unsupported', async () => {
+ const user = userEvent.setup();
+ // Never resolves: `currentModel` stays null, which means "not known yet" —
+ // clearing there would drop a promise the original job really did make.
+ getVideoGenStatus.mockReturnValue(new Promise(() => {}));
+ await openRetryEditor(user);
+ // No catalog ⇒ no picker to read; assert the retry still carries the mode.
+ await user.click(screen.getByRole('button', { name: /Retry with changes/i }));
+ expect(retryMediaJob).toHaveBeenCalledWith('refmodefail00dead', null, { silent: true });
+ });
+
+ it('clears the promise when the retry is retargeted at a model that pins frame one', async () => {
+ const user = userEvent.setup();
+ getVideoGenStatus.mockResolvedValue({ models: [LTX25, LTX2] });
+ await openRetryEditor(user);
+ await waitFor(() => expect(screen.getByLabelText('Reference mode').value).toBe('inspire'));
+
+ await user.selectOptions(screen.getByLabelText('Model'), 'ltx2-model');
+ await waitFor(() => expect(screen.getByLabelText('Reference mode').value).toBe('anchor'));
+ // And the retry submits the clear rather than a value the server would 400.
+ await user.click(screen.getByRole('button', { name: /Retry with changes/i }));
+ const [, overrides] = retryMediaJob.mock.calls.at(-1);
+ expect(overrides.i2vReferenceMode).toBeNull();
+ });
+});
diff --git a/client/src/hooks/useVideoGenForm.js b/client/src/hooks/useVideoGenForm.js
index f4fd2dd06f..dec8d26d24 100644
--- a/client/src/hooks/useVideoGenForm.js
+++ b/client/src/hooks/useVideoGenForm.js
@@ -601,7 +601,11 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled, r
// from the shared contract the server gates on, so the picker can never offer
// an option the POST would 400 on.
const referenceModeSupported = runtimeSupportsI2vReferenceMode(currentModel?.runtime, 'inspire');
- const referenceModeApplies = mode === 'image';
+ // Hoisted above the reference-mode derivation below, which needs it: the grok
+ // lane reads only prompt/dims/source-image/duration, so its image_to_video
+ // always anchors and the promise has to collapse to the default there.
+ const isGrok = grokEnabled && backend === 'grok';
+ const referenceModeApplies = mode === 'image' && !isGrok;
// The strength the render will actually use, for the slider readout — an
// untouched slider under Inspire still resolves to the contract's low default
// rather than the pipeline's 1.0, and the panel must say so.
@@ -1271,7 +1275,6 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled, r
// Snapshot the current form into a generate-payload. Used both by the
// inline Generate button and by enqueue, so the two paths stay in lockstep.
- const isGrok = grokEnabled && backend === 'grok';
// A hidden mute checkbox from a prior model must not suppress H3's visible
// prompt-audio steering. Treat mute as effective only on a model that can
diff --git a/client/src/hooks/useVideoGenForm.test.jsx b/client/src/hooks/useVideoGenForm.test.jsx
index ffbf655cd1..65100f4046 100644
--- a/client/src/hooks/useVideoGenForm.test.jsx
+++ b/client/src/hooks/useVideoGenForm.test.jsx
@@ -886,6 +886,17 @@ describe('useVideoGenForm — i2v reference mode (#4874)', () => {
expect(result.current.i2vReferenceMode).toBe('inspire');
});
+ it('clears the promise when the backend switches to grok, which always anchors', async () => {
+ // The grok lane reads only prompt/dims/source-image/duration, so its payload
+ // has nowhere to carry the mode — leaving `inspire` in state would keep the
+ // source-image panel promising a generated frame one that grok never delivers.
+ const result = await inImageMode({ grokEnabled: true });
+ await act(async () => { result.current.setI2vReferenceMode('inspire'); });
+ await act(async () => { result.current.handleBackendChange('grok'); });
+ await waitFor(() => expect(result.current.i2vReferenceMode).toBe('anchor'));
+ expect(result.current.buildGeneratePayload().i2vReferenceMode).toBeUndefined();
+ });
+
it('restores the strength a resume echoes, and clears it when the resume echoes none', async () => {
const result = await inImageMode();
await act(async () => { result.current.applyResumedParams({ imageStrength: 0.35 }); });