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
address review (claude): clear model pin on any backend switch, tolerate unknown renderDefaults keys
[._.]/ Adam Eivye930b8362e9d
diff --git a/client/src/components/settings/ImageGenTab.jsx b/client/src/components/settings/ImageGenTab.jsxindex 6eab19b62f..666053cb2e 100644--- a/client/src/components/settings/ImageGenTab.jsx+++ b/client/src/components/settings/ImageGenTab.jsx@@ -694,9 +694,12 @@ export function ImageGenTab() {onChange={(e) => {const v = e.target.value;setPin('imageMode', v || null);- // A backend change invalidates a model pinned for another- // backend — clear it rather than sending codex a gemini id.- if (!v || !supportsCloudModelOverride(v)) setPin('imageModel', null);+ // ANY backend change invalidates the pinned model — model ids+ // are namespaced per provider, and a codex→agy switch that+ // kept the gpt-* id would save a pin agy errors on. The+ // server's leak guard can't catch this case (mode and model+ // are pinned together), so the clear must happen here.+ setPin('imageModel', null);}}className="bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent sm:w-44">diff --git a/server/lib/validation.js b/server/lib/validation.jsindex 249156e656..be98fc3a52 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -992,8 +992,16 @@ const agyImageModelSchema = z.preprocess(// one optional entry per render target, each pinning a backend and/or a cloud// model for that surface. `'auto'`, `''`, and null all mean "no pin — fall// through to the install default" (renderTargetDefaults normalizes them).-// Strict at both levels so a typo'd target key or a stray field is rejected-// instead of silently persisting a slice no resolver reads.+// Deliberately TOLERANT of unknown keys at both levels (no `.strict()`): the+// Settings UI round-trips the WHOLE stored object on every save, so after a+// version rollback (or a newer client against an older server) a target/field+// this build doesn't know would otherwise 400 every Image Gen save until the+// user hand-edits settings.json — the same forward-compat call the settings+// route makes for catalogUserTypes. The route persists the raw body, so a+// newer build's pins survive the round-trip intact rather than being dropped.+// Known fields keep full enum/charset enforcement (that's what stops a bad+// model id reaching a CLI argv); the client mirror's parity test guards the+// known-key alphabet.const renderTargetModelSchema = z.preprocess((v) => (v === '' ? null : v),cloudModelIdString('model must be a valid model id').nullable().optional(),@@ -1003,10 +1011,10 @@ const renderTargetEntrySchema = z.object({imageModel: renderTargetModelSchema,videoMode: z.enum([RENDER_TARGET_BACKEND_AUTO, ...VIDEO_GEN_MODES]).nullable().optional(),videoModel: renderTargetModelSchema,-}).strict();+});export const renderDefaultsSettingsSchema = z.object(Object.fromEntries(RENDER_TARGETS.map((t) => [t, renderTargetEntrySchema.optional()])),-).strict();+);export const imageGenAgySettingsSchema = z.object({enabled: z.boolean().optional(),diff --git a/server/routes/settings.test.js b/server/routes/settings.test.jsindex bdd602f031..150bca9655 100644--- a/server/routes/settings.test.js+++ b/server/routes/settings.test.js@@ -178,11 +178,16 @@ describe('Settings routes — renderDefaults slice (#3231)', () => {});});- it('rejects an unknown render target key (strict)', async () => {+ it('tolerates and preserves unknown target keys (forward compat after rollback)', async () => {+ // A newer build's target (or field) must not 400 every Image Gen save on+ // an older build — the UI round-trips the whole stored object. Unknown+ // keys pass validation and persist raw, so the newer pins survive.const res = await request(buildApp()).put('/api/settings')- .send({ renderDefaults: { 'not-a-target': { imageMode: 'codex' } } });- expect(res.status).toBe(400);+ .send({ renderDefaults: { 'future-target': { imageMode: 'codex' }, 'universe-bible': { imageMode: 'codex', futureField: 'x' } } });+ expect(res.status).toBe(200);+ expect(res.body.renderDefaults['future-target']).toEqual({ imageMode: 'codex' });+ expect(res.body.renderDefaults['universe-bible'].futureField).toBe('x');});it('rejects a non-queueable backend and a shell-syntax model id', async () => {