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: don't let the reference picker claim anything about an unloaded model (#4874)

[._.]/ Adam Eivy90d0ac242dd3
diff --git a/client/src/components/videoGen/AdvancedParamsPanel.jsx b/client/src/components/videoGen/AdvancedParamsPanel.jsx
index e20b634ddb..db6673ea18 100644
--- a/client/src/components/videoGen/AdvancedParamsPanel.jsx
+++ b/client/src/components/videoGen/AdvancedParamsPanel.jsx
@@ -61,11 +61,22 @@ export default function AdvancedParamsPanel({
// selected model cannot honor the loose option.
const showReferenceMode = mode === 'image' && typeof onI2vReferenceModeChange === 'function';
const referenceMode = normalizeI2vReferenceMode(i2vReferenceMode);
- const referenceOptions = I2V_REFERENCE_MODE_OPTIONS.filter(
- (o) => runtimeSupportsI2vReferenceMode(currentModel?.runtime, o.value),
- );
+ // Which promises this model can actually keep. An unresolved `currentModel`
+ // means "the catalog has not loaded yet", NOT "anchor only" — the same
+ // deferral the form's snap-back makes, so the picker can't contradict the
+ // state it is rendering: collapsing to Anchor here would disable the control
+ // and claim "this model can only anchor" about a model nobody has seen.
+ const supportedReferenceOptions = currentModel
+ ? I2V_REFERENCE_MODE_OPTIONS.filter((o) => runtimeSupportsI2vReferenceMode(currentModel.runtime, o.value))
+ : I2V_REFERENCE_MODE_OPTIONS;
+ // A controlled <select> must never hold a value with no matching <option>.
+ // A restored pick survives one render past a model switch — until the
+ // snap-back effect lands — so keep it listed for exactly that window.
+ const referenceOptions = supportedReferenceOptions.some((o) => o.value === referenceMode)
+ ? supportedReferenceOptions
+ : [...supportedReferenceOptions, I2V_REFERENCE_MODE_OPTIONS.find((o) => o.value === referenceMode)].filter(Boolean);
const referencePromise = I2V_REFERENCE_MODE_OPTIONS.find((o) => o.value === referenceMode);
- const referenceModeLocked = referenceOptions.length < 2;
+ const referenceModeLocked = supportedReferenceOptions.length < 2;
// `0` is a legal strength (ignore the source entirely) and the retry editor
// hands it over as a NUMBER, so presence has to be tested explicitly — a
// `imageStrength || …` fallback renders the slider at 1 while the form still
diff --git a/client/src/components/videoGen/AdvancedParamsPanel.test.jsx b/client/src/components/videoGen/AdvancedParamsPanel.test.jsx
index f266af56d7..25456ec0be 100644
--- a/client/src/components/videoGen/AdvancedParamsPanel.test.jsx
+++ b/client/src/components/videoGen/AdvancedParamsPanel.test.jsx
@@ -276,3 +276,50 @@ describe('AdvancedParamsPanel — image strength presence vs zero', () => {
expect(screen.getByLabelText('Image Strength').value).toBe('0');
});
});
+
+// The picker must not contradict the state it renders. The form's snap-back
+// deliberately defers clearing an Inspire pick until the model catalog resolves,
+// so a picker that reads an unresolved model as "anchor only" would disable
+// itself, drop the selected option, and claim something about a model nobody has
+// seen yet — on exactly the resume/retry path this feature hardened.
+describe('AdvancedParamsPanel — reference mode before the model catalog loads', () => {
+ const beforeLoad = (props) => renderPanel({
+ mode: 'image',
+ currentModel: undefined,
+ i2vReferenceMode: 'inspire',
+ onI2vReferenceModeChange: vi.fn(),
+ ...props,
+ });
+
+ it('keeps the selected promise listed and the control usable', () => {
+ beforeLoad();
+ const select = screen.getByLabelText('Reference mode');
+ expect(select.value).toBe('inspire');
+ expect([...select.options].map((o) => o.value)).toEqual(['anchor', 'inspire']);
+ expect(select.disabled).toBe(false);
+ });
+
+ it('makes no claim about a model it has not seen', () => {
+ beforeLoad();
+ expect(screen.queryByText(/can only anchor a reference/i)).toBeNull();
+ });
+
+ it('never renders a controlled value with no matching option, even mid-switch', () => {
+ // The render between "model switched to one that pins frame one" and "the
+ // snap-back effect ran" still holds `inspire`; it stays listed so the select
+ // is not silently blank, while the option list is already narrowed.
+ renderPanel({
+ mode: 'image',
+ currentModel: { runtime: 'ltx2', name: 'LTX-2 Unified', supportedModes: MLX_MODES },
+ i2vReferenceMode: 'inspire',
+ onI2vReferenceModeChange: vi.fn(),
+ });
+ const select = screen.getByLabelText('Reference mode');
+ expect(select.value).toBe('inspire');
+ expect([...select.options].map((o) => o.value)).toContain('inspire');
+ // The model genuinely cannot loosen a reference, so the control still locks
+ // and still says why.
+ expect(select.disabled).toBe(true);
+ expect(screen.getByText(/can only anchor a reference/i)).toBeTruthy();
+ });
+});