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: honor autoClean on pipeline renders, refresh collection after server-auto-filed clean

[._.]/ Adam Eivy0b1839d343e7
diff --git a/client/src/pages/MediaCollectionDetail.jsx b/client/src/pages/MediaCollectionDetail.jsx
index dc06191f33..18eddcf66b 100644
--- a/client/src/pages/MediaCollectionDetail.jsx
+++ b/client/src/pages/MediaCollectionDetail.jsx
@@ -249,11 +249,19 @@ export default function MediaCollectionDetail() {
// `onCleanComplete`.
const { handleRemix, handleSendToVideo, handleContinue, handleClean } = useImagePreviewActions({
onCleanComplete: async (cleaned) => {
+ // The server's clean route auto-files the cleaned filename into every
+ // collection that contained the source — including this one — so this
+ // client-side add usually returns ERR_DUPLICATE. Catch both shapes:
+ // when the add wins (cleaning from outside any collection containing
+ // the source) we get an updated collection; when it loses to the
+ // server's pre-fill we get null and need to refresh from the server
+ // so collection.items picks up the new entry.
const updated = await addMediaCollectionItem(collection.id, {
kind: 'image',
ref: cleaned.filename,
}).catch(() => null);
if (updated) setCollection(updated);
+ else await refresh();
// Without this the next render misses the cleaned file until
// refresh() reruns.
setImagesByName((m) => {
diff --git a/server/services/pipeline/visualStages.js b/server/services/pipeline/visualStages.js
index 8fd0c66a5e..3f68659278 100644
--- a/server/services/pipeline/visualStages.js
+++ b/server/services/pipeline/visualStages.js
@@ -45,6 +45,7 @@ import { pickCanon } from './seriesCanon.js';
import { STYLE_PROMPT_OVERRIDE_MODE_DEFAULT } from './series.js';
import { ASPECT_PRESETS } from '../../lib/creativeDirectorPresets.js';
import { IMAGE_GEN_MODE } from '../imageGen/modes.js';
+import { resolveAutoClean } from '../imageGen/index.js';
const joinStyleParts = (...parts) =>
parts.map((s) => (s || '').trim()).filter(Boolean).join(', ');
@@ -179,9 +180,16 @@ const enqueueImageJob = ({ prompt, world, settings, options, mode, owner, logLin
...(options.initImagePath ? { initImagePath: options.initImagePath } : {}),
...(Number.isFinite(options.initImageStrength) ? { initImageStrength: options.initImageStrength } : {}),
};
+ // The queue dispatches directly to imageGen/{codex,local}.generateImage,
+ // bypassing imageGen/index.js's dispatcher that resolves autoClean for
+ // direct callers. The /api/image-gen/generate route resolves it at the
+ // route layer; pipeline renders need the same resolution here, otherwise
+ // the saved settings.imageGen[mode].autoClean has no effect on storyboard,
+ // comic-panel, or cover renders.
+ const autoClean = resolveAutoClean(undefined, settings, mode);
const params = mode === IMAGE_GEN_MODE.CODEX
- ? { mode: IMAGE_GEN_MODE.CODEX, codexPath: settings.imageGen?.codex?.codexPath, model: settings.imageGen?.codex?.model, ...baseParams }
- : { pythonPath: settings.imageGen?.local?.pythonPath || null, modelId: options.modelId, ...baseParams };
+ ? { mode: IMAGE_GEN_MODE.CODEX, codexPath: settings.imageGen?.codex?.codexPath, model: settings.imageGen?.codex?.model, autoClean, ...baseParams }
+ : { pythonPath: settings.imageGen?.local?.pythonPath || null, modelId: options.modelId, autoClean, ...baseParams };
const { jobId } = enqueueJob({ kind: 'image', params, owner });
console.log(`${logLine} mode=${mode} jobId=${jobId.slice(0, 8)}`);
return jobId;