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 (codex): drop foreign modelId on send-to-i2i, reseed cleaners on auto-switch

[._.]/ Adam Eivy167802ad524d
diff --git a/client/src/hooks/useMediaPreviewActions.js b/client/src/hooks/useMediaPreviewActions.js
index e39bab6a71..1ea35418ad 100644
--- a/client/src/hooks/useMediaPreviewActions.js
+++ b/client/src/hooks/useMediaPreviewActions.js
@@ -98,6 +98,13 @@ export default function useMediaPreviewActions({ onCleanComplete = null } = {})
const handleSendToImage = useCallback((item) => {
if (!item?.filename || item.kind === 'video') return;
const params = buildImageGenParams(item);
+ // Drop modelId: i2i is image-driven and the page may auto-switch the user to
+ // a different (i2i-capable) backend, so the source's model — often a
+ // provider-specific id like `gpt-image-2` or a checkpoint the target backend
+ // lacks — would poison the form and fail on Generate. Let the target keep its
+ // own current/default model. (The in-page handler routes through handleRemix,
+ // which already guards modelId against the loaded model list.)
+ params.delete('modelId');
params.set('initImageFile', item.filename);
navigate(`/media/image?${params}`);
}, [navigate]);
diff --git a/client/src/hooks/useMediaPreviewActions.test.jsx b/client/src/hooks/useMediaPreviewActions.test.jsx
index f2457d18f2..d0afd742fd 100644
--- a/client/src/hooks/useMediaPreviewActions.test.jsx
+++ b/client/src/hooks/useMediaPreviewActions.test.jsx
@@ -27,9 +27,11 @@ describe('useMediaPreviewActions.handleSendToImage', () => {
expect(params.get('initImageFile')).toBe('cat.png');
expect(params.get('prompt')).toBe('a cat');
expect(params.get('negativePrompt')).toBe('blurry');
- expect(params.get('modelId')).toBe('flux2');
expect(params.get('width')).toBe('1024');
expect(params.get('seed')).toBe('7');
+ // modelId is intentionally dropped — i2i may auto-switch backends, so the
+ // source's model (possibly provider-specific) must not poison the target form.
+ expect(params.get('modelId')).toBeNull();
// Distinct from Remix — no `remix` param.
expect(params.get('remix')).toBeNull();
});
diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsx
index a2f34c9758..db182c4cfa 100644
--- a/client/src/pages/ImageGen.jsx
+++ b/client/src/pages/ImageGen.jsx
@@ -312,10 +312,13 @@ export default function ImageGen() {
}).catch(() => {});
}, [refreshRegenAvailability]);
- // Re-seed the cleaner checkboxes when the user manually picks a different
- // backend chip — without this, switching external→local would leave the
- // external values in the form.
- const handleSelectMode = useCallback((next) => {
+ // Switch the active backend AND re-seed the cleaner checkboxes from the
+ // target backend's saved defaults — without the reseed, switching
+ // external→local would leave the external cleaner values in the form. Shared
+ // by the manual chip, the deferred i2i nudge, and ensureI2iCapableMode so an
+ // auto-switch queues with the right per-backend defaults too (not just the
+ // chip path).
+ const switchMode = useCallback((next) => {
setSelectedMode(next);
setCleanC2PA(savedCleanC2PAByMode[next] === true);
setDenoise(savedDenoiseByMode[next] === true);
@@ -399,9 +402,9 @@ export default function ImageGen() {
if (i2iCapable) { wantI2iModeRef.current = false; return; }
if (!availableBackends.length) return; // wait for load
const mode = pickI2iMode(availableBackends);
- if (mode) setSelectedMode(mode);
+ if (mode) switchMode(mode);
wantI2iModeRef.current = false;
- }, [availableBackends, i2iCapable]);
+ }, [availableBackends, i2iCapable, switchMode]);
// ?lora=<filename> preselects a LoRA when the user clicks "Test" on the
// /media/loras manager page. Defers until availableLoras has loaded so the
@@ -978,9 +981,9 @@ export default function ImageGen() {
const ensureI2iCapableMode = useCallback(() => {
if (i2iCapable) return;
const mode = pickI2iMode(availableBackends);
- if (mode) setSelectedMode(mode);
+ if (mode) switchMode(mode);
else wantI2iModeRef.current = true;
- }, [i2iCapable, availableBackends]);
+ }, [i2iCapable, availableBackends, switchMode]);
// Send to image-to-image (in-page): reuse the remix settings AND queue this
// image as the i2i source on an i2i-capable backend.
@@ -1026,7 +1029,7 @@ export default function ImageGen() {
<BackendChipStrip
availableBackends={availableBackends}
value={effectiveMode}
- onChange={handleSelectMode}
+ onChange={switchMode}
disabled={statusLoading}
loadingId={statusLoading ? effectiveMode : null}
titlePrefix="Use"