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

refactor: apply self-review cleanup to the render-mode ladder fix (#6815)

[._.]/ Adam Eivydbd3878fb69a
diff --git a/client/src/components/pipeline/stages/VisualGenSettings.jsx b/client/src/components/pipeline/stages/VisualGenSettings.jsx
index 85d9130b4f..9d524c0e68 100644
--- a/client/src/components/pipeline/stages/VisualGenSettings.jsx
+++ b/client/src/components/pipeline/stages/VisualGenSettings.jsx
@@ -20,7 +20,7 @@ import {
} from '../../../services/api';
import { filterSelectableModels } from '../../../utils/providers';
import {
- deriveAvailableBackends, IMAGE_GEN_MODE, MODE_LABELS, RENDER_TARGET, imageModeCandidates, pickUsableMode,
+ deriveAvailableBackends, IMAGE_GEN_MODE, RENDER_TARGET, imageModeCandidates, modeLabel, pickUsableMode,
} from '../../../lib/imageGenBackends';
import BackendChipStrip from '../../media/BackendChipStrip';
import ProviderModelSelector from '../../ProviderModelSelector';
@@ -82,14 +82,15 @@ const loadLookups = () => {
// candidate order is `[series pin, pipeline-visual renderDefaults pin,
// settings.imageGen.mode]`, exactly matching
// `pipeline/visualStageHelpers.js#resolveMode`. Local diffusion gets a
-// friendlier display name here than `MODE_LABELS` (used by the terser chip
-// strip), plus the "(not configured)" suffix when it has no pythonPath.
+// friendlier display name here than the shared `modeLabel` (used by the
+// terser chip strip), plus the "(not configured)" suffix when it has no
+// pythonPath.
const AUTO_LOCAL_LABEL = 'Local diffusion';
const autoModeLabel = (mode, s) => {
if (mode === IMAGE_GEN_MODE.LOCAL) {
return s?.imageGen?.local?.pythonPath ? AUTO_LOCAL_LABEL : `${AUTO_LOCAL_LABEL} (not configured)`;
}
- return MODE_LABELS[mode] || mode;
+ return modeLabel(mode);
};
const summarizeMode = (cfg, autoResolution) => {
@@ -233,7 +234,7 @@ function VisualGenSettingsBody({ cfg, update, stageLabel, systemSettings, imageM
// so the "Auto →" label honors a series-level render pin (#6815) the same way
// the server's resolver does. Optional: omit it for a caller with no series in
// scope, which just means that candidate never contributes a pin.
-function useVisualGenSettings(value, stageLabel, refreshOnMount = false, series = null) {
+function useVisualGenSettings(value, stageLabel, { refreshOnMount = false, series = null } = {}) {
const cfg = { ...DEFAULT_CONFIG, ...(value || {}) };
const [systemSettings, setSystemSettings] = useState(null);
const [imageModels, setImageModels] = useState([]);
@@ -284,7 +285,7 @@ function useVisualGenSettings(value, stageLabel, refreshOnMount = false, series
export function VisualGenSettingsPanel({
value, onChange, stageLabel = 'Visual stage', series = null,
}) {
- const bag = useVisualGenSettings(value, stageLabel, true, series);
+ const bag = useVisualGenSettings(value, stageLabel, { refreshOnMount: true, series });
const update = (patch) => onChange?.({ ...bag.cfg, ...patch });
return <VisualGenSettingsBody {...bag} update={update} />;
}
@@ -305,7 +306,7 @@ export function summarizeGenConfig(cfg) {
export default function VisualGenSettings({
value, onChange, stageLabel = 'Visual stage', series = null,
}) {
- const bag = useVisualGenSettings(value, stageLabel, false, series);
+ const bag = useVisualGenSettings(value, stageLabel, { series });
const update = (patch) => onChange?.({ ...bag.cfg, ...patch });
const [open, setOpen] = useState(false);
diff --git a/server/services/sprites/reference.js b/server/services/sprites/reference.js
index b9264de2ea..a1f1d3980c 100644
--- a/server/services/sprites/reference.js
+++ b/server/services/sprites/reference.js
@@ -35,7 +35,8 @@ import {
IMAGE_GEN_MODE, resolveQueueImageMode, LOCAL_IMAGEGEN_DEFAULT_MODEL,
} from '../imageGen/modes.js';
import { resolveImageCleaners } from '../imageGen/index.js';
-import { pickUsableMode, renderTargetDefaults, resolveRenderTargetConfig } from '../imageGen/cloudProviderConfig.js';
+import { resolveRenderTargetConfig } from '../imageGen/cloudProviderConfig.js';
+import { imageModeCandidates, pickUsableMode } from '../../lib/renderModeLadder.js';
import { RENDER_TARGET, recordRenderPin } from '../../lib/renderTargets.js';
import { getSettings } from '../settings.js';
import { getRecord, updateRecord, listRecords, createCharacter } from './records.js';
@@ -389,18 +390,15 @@ async function startReferenceGenerationImpl(recordId, body, upload = null) {
const settings = await getSettings();
// Render-target ladder (#3231): the page's explicit body.mode wins, then
// the sprite record's persisted pin (Phase 3), then the sprite-reference
- // pin in settings.renderDefaults, then the install default. The pins go
+ // pin in settings.renderDefaults, then the install default — the shared
+ // `imageModeCandidates` order (lib/renderModeLadder.js, #6815). The pins go
// through pickUsableMode so each disabled rung falls to the NEXT rung
// (matching resolveRenderTargetConfig's per-rung gating) instead of a
// disabled record pin swallowing the target pin; resolveQueueImageMode
// keeps the historical gate for an explicit body.mode.
const spritePin = recordRenderPin(record);
const mode = resolveQueueImageMode(
- body.mode || pickUsableMode(settings, [
- spritePin.mode,
- renderTargetDefaults(settings, RENDER_TARGET.SPRITE_REFERENCE).imageMode,
- settings?.imageGen?.mode,
- ]),
+ body.mode || pickUsableMode(settings, imageModeCandidates(settings, RENDER_TARGET.SPRITE_REFERENCE, record)),
settings,
);