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 (codex): a local pin outranks the planner's model and strips a planner-authored grok discriminator
[._.]/ Adam Eivy2e6a351cc71b
diff --git a/server/services/creative/tools/media.js b/server/services/creative/tools/media.jsindex 938edfe1d2..a6bab28fba 100644--- a/server/services/creative/tools/media.js+++ b/server/services/creative/tools/media.js@@ -127,10 +127,19 @@ async function enforceRenderBackendPin(kind, params, project) {const mode = resolveVideoMode(pin.mode, settings);if (mode !== VIDEO_GEN_MODE.GROK) {// Local video: `params.mode` is the t2v/i2v SEMANTIC for this lane (see- // videoGen/modes.js), so it must not be stamped with the backend name —- // absence of the 'grok' discriminator IS "render locally". Only the model- // pin travels, and only when the planner didn't name one itself.- return pin.modelId && !params?.modelId ? { ...params, modelId: pin.modelId } : params;+ // videoGen/modes.js), so it must NOT be stamped with the backend name —+ // the absence of the 'grok' discriminator IS "render locally", and+ // overwriting a real semantic ('fflf', 'a2v', 'extend', an IC-LoRA id)+ // would silently drop the caller's keyframes/audio. But the discriminator+ // and the semantic share this one key, so a planner-authored `mode: 'grok'`+ // must be STRIPPED or the queue would dispatch to grok in defiance of the+ // pin (and of the grok-disabled fallback). Dropping it lets local.js infer+ // the semantic from `sourceImagePath`, which is what an unset mode means.+ const { mode: authored, ...rest } = params || {};+ const base = authored === VIDEO_GEN_MODE.GROK ? rest : (params || {});+ // The user's pinned model wins over the planner's freehand guess — that+ // asymmetry is the whole point of a pin.+ return pin.modelId ? { ...base, modelId: pin.modelId } : base;}const grok = settings.imageGen?.grok || {};// videoGen/grok.js reads the same `imageGen.grok` slice the image path does@@ -152,8 +161,8 @@ async function enforceRenderBackendPin(kind, params, project) {...params,mode: IMAGE_GEN_MODE.LOCAL,pythonPath: settings.imageGen?.local?.pythonPath || null,- // The planner's own modelId wins if it named one; otherwise the pin's.- ...(pin.modelId && !params?.modelId ? { modelId: pin.modelId } : {}),+ // The user's pinned model wins over the planner's freehand guess.+ ...(pin.modelId ? { modelId: pin.modelId } : {}),};}diff --git a/server/services/creative/tools/media.test.js b/server/services/creative/tools/media.test.jsindex 4f2d1fb748..8ac6d94c16 100644--- a/server/services/creative/tools/media.test.js+++ b/server/services/creative/tools/media.test.js@@ -85,13 +85,22 @@ describe('render-backend pin — image (#3135)', () => {expect(enqueued().params.pythonPath).toBe('/py');});- it('applies a local pin with its model id, but the planner model wins if it named one', async () => {+ it('the pinned local model beats a planner-authored one', async () => {getSettings.mockResolvedValue({ imageGen: { local: { pythonPath: '/py' } } });getProject.mockResolvedValue(projectWithPin({ image: { mode: 'local', modelId: 'pinned-model' } }));await run('media_enqueueImageJob', { prompt: 'p' }, { projectId: 'cd-1' });expect(enqueued().params.modelId).toBe('pinned-model');+ // The asymmetry IS the pin: a user who named a model must get that model,+ // not whatever the planner guessed.+ await run('media_enqueueImageJob', { prompt: 'p', modelId: 'planner-model' }, { projectId: 'cd-1' });+ expect(enqueued().params.modelId).toBe('pinned-model');+ });++ it('leaves the planner model alone when the pin names none', async () => {+ getSettings.mockResolvedValue({ imageGen: { local: { pythonPath: '/py' } } });+ getProject.mockResolvedValue(projectWithPin({ image: { mode: 'local' } }));await run('media_enqueueImageJob', { prompt: 'p', modelId: 'planner-model' }, { projectId: 'cd-1' });expect(enqueued().params.modelId).toBe('planner-model');});@@ -134,11 +143,33 @@ describe('render-backend pin — video (#3135)', () => {expect(enqueued().params.modelId).toBe('pinned-video-model');});- it('degrades a grok video pin to local when the grok toggle is off', async () => {+ it('STRIPS a planner-authored grok discriminator when the pin says local', async () => {+ // The discriminator and the t2v/i2v semantic share `params.mode`, so leaving+ // a planner-written 'grok' in place would dispatch to grok in defiance of the+ // pin. Dropping it lets local.js infer the semantic (= what an unset mode means).+ getSettings.mockResolvedValue({ imageGen: {} });+ getProject.mockResolvedValue(projectWithPin({ video: { mode: 'local' } }));+ await run('media_enqueueVideoJob', { prompt: 'p', mode: 'grok' }, { projectId: 'cd-1' });+ expect(enqueued().params).toEqual({ prompt: 'p' });+ });++ it('degrades a grok video pin to local when the grok toggle is off — and strips the discriminator', async () => {getSettings.mockResolvedValue({ imageGen: { grok: { enabled: false } } });getProject.mockResolvedValue(projectWithPin({ video: { mode: 'grok' } }));await run('media_enqueueVideoJob', { prompt: 'p' }, { projectId: 'cd-1' });expect(enqueued().params).toEqual({ prompt: 'p' });++ // The fallback must also survive a planner that already wrote 'grok', or the+ // disabled-backend degrade would be silently defeated.+ await run('media_enqueueVideoJob', { prompt: 'p', mode: 'grok' }, { projectId: 'cd-1' });+ expect(enqueued().params).toEqual({ prompt: 'p' });+ });++ it('the pinned local video model beats a planner-authored one', async () => {+ getSettings.mockResolvedValue({ imageGen: {} });+ getProject.mockResolvedValue(projectWithPin({ video: { mode: 'local', modelId: 'pinned-video-model' } }));+ await run('media_enqueueVideoJob', { prompt: 'p', modelId: 'planner-model' }, { projectId: 'cd-1' });+ expect(enqueued().params.modelId).toBe('pinned-video-model');});it('applies the video pin alongside the locked geometry preset', async () => {