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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix([issue-912]): carry regen lineage through normalizeImage + honest-lineage guards
[._.]/ Adam Eivy21f45420b925
diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsxindex 87848e75f1..afbd67e2c7 100644--- a/client/src/components/media/MediaLightbox.jsx+++ b/client/src/components/media/MediaLightbox.jsx@@ -51,6 +51,12 @@ function describeCleanedLineage(item) {if (item.autoCleaned) {return `Auto-cleaned (${item.cleanLevel || 'aggressive'})${item.c2paStripped ? ' · C2PA stripped' : ''}`;}+ // SynthID-defeat regen reuses `cleanedFrom` for grouping but is a generative+ // round-trip, not a clean — describe it honestly (issue #912).+ if (item.regenerated && item.cleanedFrom) {+ const pct = typeof item.regenStrength === 'number' ? ` · ${Math.round(item.regenStrength * 100)}% denoise` : '';+ return `Regenerated from ${item.cleanedFrom}${pct}`;+ }if (item.cleanedFrom) {return `${item.cleanLevel ? `Cleaned (${item.cleanLevel}) ` : 'Cleaned '}from ${item.cleanedFrom}`;}diff --git a/client/src/components/media/normalize.js b/client/src/components/media/normalize.jsindex 662008ff86..05ea8849b2 100644--- a/client/src/components/media/normalize.js+++ b/client/src/components/media/normalize.js@@ -70,6 +70,14 @@ export function normalizeImage(i) {cleanLevel: i.cleanLevel || null,autoCleaned: i.autoCleaned === true,c2paStripped: typeof i.c2paStripped === 'boolean' ? i.c2paStripped : null,+ // SynthID-defeat regen lineage (issue #912) — stamped by+ // /api/image-gen/:filename/regenerate. `regenerated` is the discriminator+ // computeImageVariantGroup uses to label a `cleanedFrom` sibling as+ // "Regenerated" rather than "Cleaned", so it MUST survive normalization.+ regenerated: i.regenerated === true,+ regenStrength: typeof i.regenStrength === 'number' ? i.regenStrength : null,+ regenSteps: typeof i.regenSteps === 'number' ? i.regenSteps : null,+ regenModelId: i.regenModelId || null,raw: i,};}diff --git a/client/src/components/media/normalize.test.js b/client/src/components/media/normalize.test.jsindex 73bacccbdd..3713d0eb74 100644--- a/client/src/components/media/normalize.test.js+++ b/client/src/components/media/normalize.test.js@@ -115,6 +115,33 @@ describe('getRenderConfigForItem - image', () => {});});+describe('normalizeImage - regen lineage (issue #912)', () => {+ it('carries the regen lineage fields through normalization', () => {+ const n = normalizeImage({+ filename: 'r.png',+ cleanedFrom: 'src.png',+ regenerated: true,+ regenStrength: 0.4,+ regenSteps: 8,+ regenModelId: 'flux2-klein-9b',+ });+ // These MUST survive normalization — computeImageVariantGroup reads+ // `regenerated` off normalized items to label the variant "Regenerated".+ expect(n.regenerated).toBe(true);+ expect(n.regenStrength).toBe(0.4);+ expect(n.regenSteps).toBe(8);+ expect(n.regenModelId).toBe('flux2-klein-9b');+ expect(n.cleanedFrom).toBe('src.png');+ });++ it('defaults regen fields off for a normal (non-regen) image', () => {+ const n = normalizeImage({ filename: 'a.png' });+ expect(n.regenerated).toBe(false);+ expect(n.regenStrength).toBeNull();+ expect(n.regenModelId).toBeNull();+ });+});+describe('normalize loraNames - snake_case sidecar coverage', () => {// MediaCard chips/search read `item.loraNames`; these must surface for// sidecars written in any of the four supported field shapes so the UIdiff --git a/client/src/components/media/variants.test.js b/client/src/components/media/variants.test.jsindex 8c8d0aa50f..39837a531a 100644--- a/client/src/components/media/variants.test.js+++ b/client/src/components/media/variants.test.js@@ -1,5 +1,6 @@import { describe, it, expect } from 'vitest';import { computeImageVariantGroup } from './variants';+import { normalizeImage } from './normalize';const img = (filename, extra = {}) => ({ kind: 'image', filename, ...extra });@@ -78,6 +79,17 @@ describe('computeImageVariantGroup', () => {expect(result.active.label).toBe('Regenerated');});+ it('labels a regen variant correctly through the real normalizeImage path (issue #912)', () => {+ // Guards the actual UI path: the gallery feeds normalizeImage output (not+ // raw sidecars) into computeImageVariantGroup, so the `regenerated`+ // discriminator must survive normalization or the variant mislabels.+ const orig = normalizeImage({ filename: 'a.png', prompt: 'x' });+ const regen = normalizeImage({ filename: 'r.png', cleanedFrom: 'a.png', regenerated: true, regenStrength: 0.4 });+ const result = computeImageVariantGroup(regen, [orig, regen]);+ expect(result.group.map((g) => g.label)).toEqual(['Original', 'Regenerated']);+ expect(result.active.label).toBe('Regenerated');+ });+it('returns null when only the original exists (no clean siblings yet — no toggle needed)', () => {const orig = img('a.png');const unrelated = img('b.png');diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsxindex de7eec7710..d7ab5571ab 100644--- a/client/src/pages/ImageGen.jsx+++ b/client/src/pages/ImageGen.jsx@@ -247,14 +247,19 @@ export default function ImageGen() {// SynthID-defeat regen (issue #912) is hardware-gated on a local FLUX// runner — only surface the lightbox action when the backend is installed.+ // Re-checked on mount AND when the Settings drawer closes (via+ // reloadBackends) so installing the FLUX venv mid-session reveals the action+ // without a hard reload, matching how the other backend gates refresh.const [regenAvailable, setRegenAvailable] = useState(false);- useEffect(() => {+ const refreshRegenAvailability = useCallback(() => {getRegenAvailability().then((r) => setRegenAvailable(!!r?.available)).catch(() => {});}, []);+ useEffect(() => { refreshRegenAvailability(); }, [refreshRegenAvailability]);// Re-runnable so the Settings drawer can trigger a refresh on close// without forcing a full page reload.const reloadBackends = useCallback(() => {+ refreshRegenAvailability();return getSettings().then((s) => {const backends = deriveAvailableBackends(s);// Per-mode saved defaults via the shared helper (mirrored from@@ -285,7 +290,7 @@ export default function ImageGen() {setCleanC2PA(c2[next] === true);setDenoise(dn[next] === true);}).catch(() => {});- }, []);+ }, [refreshRegenAvailability]);// Re-seed the cleaner checkboxes when the user manually picks a different// backend chip — without this, switching external→local would leave thediff --git a/server/services/imageGen/local.js b/server/services/imageGen/local.jsindex 698c532d66..e3775545bc 100644--- a/server/services/imageGen/local.js+++ b/server/services/imageGen/local.js@@ -376,7 +376,10 @@ export function buildSidecarMeta({// fresh sampling pass rather than stripped. `regenStrength`/`regenSteps`/// `regenModelId` mirror the resolved render params (not the raw inputs) so a// replayed/clamped value is what's recorded.- if (typeof regenOf === 'string' && regenOf) {+ // Only stamp the lineage when the init image actually resolved — if the+ // source path was rejected/missing, this render degraded to txt2img and is+ // NOT a regen of anything, so claiming `regenerated: true` would be a lie.+ if (typeof regenOf === 'string' && regenOf && validInitImagePath) {meta.cleanedFrom = regenOf;meta.regenerated = true;meta.regenStrength = validInitImageStrength;diff --git a/server/services/imageGen/local.test.js b/server/services/imageGen/local.test.jsindex b403a73b1e..95d9b2df99 100644--- a/server/services/imageGen/local.test.js+++ b/server/services/imageGen/local.test.js@@ -543,6 +543,18 @@ describe('imageGen local.buildSidecarMeta', () => {expect(meta.regenStrength).toBeUndefined();});+ it('does NOT stamp regen lineage when the init image fails to resolve (no false claim)', () => {+ const { meta } = buildSidecarMeta({+ ...baseMetaInput,+ initImagePath: '/data/images/gone.png',+ initImageStrength: 0.4,+ regenOf: 'gone.png',+ resolveInputPath: () => null, // source path rejected → degraded to txt2img+ });+ expect(meta.regenerated).toBeUndefined();+ expect(meta.cleanedFrom).toBeUndefined();+ });+it('defaults each missing reference strength to 1.0 (full influence)', () => {const { meta } = buildSidecarMeta({...baseMetaInput,