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-732]): address codex review
[._.]/ Adam Eivy6cc20503c14c
diff --git a/server/lib/mediaModels.js b/server/lib/mediaModels.jsindex 6a3af06a3a..48de02e3cb 100644--- a/server/lib/mediaModels.js+++ b/server/lib/mediaModels.js@@ -386,14 +386,23 @@ const backfillEditOnly = (list) => {};// Multi-reference editing on the bf16 path loads the `-kv` sibling repo. Map-// each id to the kv repo it should use. Existing installs stored their-// `flux2-klein-9b-bf16` entry before `kvRepo` existed, so backfill it at load-// (same pattern as cfgDisabled/editOnly) AND ship migration 064 for installs-// that have already persisted the registry. Mirrored in-// data.reference/media-models.json. A user-set `kvRepo` (any value, including-// '') wins — `'kvRepo' in entry` is the override signal.+// each id to the base repo it shipped with and the kv repo it should pair+// with. Existing installs stored their `flux2-klein-9b-bf16` entry before+// `kvRepo` existed, so backfill it at load (same pattern as+// cfgDisabled/editOnly) AND ship migration 064 for installs that have already+// persisted the registry. Mirrored in data.reference/media-models.json.+//+// Fork-preservation: only backfill when the entry's `repo` still matches the+// shipped base repo. A user who pointed `repo` at a fork must NOT get the+// upstream kv sibling silently injected (reference renders would mix a custom+// base with the upstream KV repo) — this mirrors migration 064's guard. A+// user-set `kvRepo` (any value, including '') always wins: `'kvRepo' in entry`+// is the override signal.const KV_REPO_BY_ID = {- 'flux2-klein-9b-bf16': 'black-forest-labs/FLUX.2-klein-9B-kv',+ 'flux2-klein-9b-bf16': {+ shippedRepo: 'black-forest-labs/FLUX.2-klein-9B',+ kvRepo: 'black-forest-labs/FLUX.2-klein-9B-kv',+ },};const backfillKvRepo = (list) => {@@ -401,9 +410,9 @@ const backfillKvRepo = (list) => {return list.map((entry) => {if (!isPlainObject(entry) || typeof entry.id !== 'string') return entry;if ('kvRepo' in entry) return entry; // user override wins- const kvRepo = KV_REPO_BY_ID[entry.id];- if (!kvRepo) return entry;- return { ...entry, kvRepo };+ const spec = KV_REPO_BY_ID[entry.id];+ if (!spec || entry.repo !== spec.shippedRepo) return entry; // unknown id or forked repo+ return { ...entry, kvRepo: spec.kvRepo };});};diff --git a/server/lib/mediaModels.test.js b/server/lib/mediaModels.test.jsindex 09325d5208..4674fb06e7 100644--- a/server/lib/mediaModels.test.js+++ b/server/lib/mediaModels.test.js@@ -490,6 +490,20 @@ describe('mediaModels registry', () => {expect(bf16.kvRepo).toBe('');});+ it('does NOT inject kvRepo when repo points at a fork (fork-preservation, mirrors migration 064)', async () => {+ writeFileSync(registryFile, JSON.stringify({+ video: { macos: [], windows: [], defaultMacos: 'x', defaultWindows: 'x' },+ image: [+ { id: 'flux2-klein-9b-bf16', name: 'Flux 2 Klein 9B (bf16)', runner: 'flux2', quantization: 'none', repo: 'my-fork/FLUX.2-klein-9B', steps: 20, guidance: 3.5 },+ ],+ textEncoders: [{ id: 't', label: 't', repo: 'r' }],+ selectedTextEncoder: 't',+ }));+ const { getImageModels } = await import('./mediaModels.js');+ const bf16 = getImageModels().find((m) => m.id === 'flux2-klein-9b-bf16');+ expect('kvRepo' in bf16).toBe(false);+ });+it('existing install without _shippedDefaults.image gains the new z-image entries on upgrade', async () => {// Simulate a pre-z-image registry: only flux2 and Flux 1 entries, no// _shippedDefaults.image at all.