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): render first-pass scene frames at project aspect ratio
[._.]/ Adam Eivyc3103e6ce7f9
diff --git a/server/services/creativeDirector/firstPassGen.js b/server/services/creativeDirector/firstPassGen.jsindex 5d3174401e..a9b3ba89cb 100644--- a/server/services/creativeDirector/firstPassGen.js+++ b/server/services/creativeDirector/firstPassGen.js@@ -33,6 +33,7 @@ import { getSettings } from '../settings.js';import { resolveImageCleaners } from '../imageGen/index.js';import { IMAGE_GEN_MODE } from '../imageGen/modes.js';import { getIngredient, listMediaForIngredient } from '../catalogDB.js';+import { ASPECT_PRESETS } from '../../lib/creativeDirectorPresets.js';import { payloadSnippet, getActiveCatalogType } from '../../lib/catalogTypes.js';// Keep the derived portrait prompt bounded — enough descriptive text to render@@ -188,6 +189,11 @@ export async function enqueueFirstPassPortraits(members = []) {* missing a prompt is recorded in `skipped`, never thrown, since this runs as* a side effect of writing the treatment and must not fail that write.*+ * Renders at the project's locked-in `aspectRatio` (via `ASPECT_PRESETS`) so+ * the seeded frame matches what sceneRunner.js will force-crop the source+ * image to at actual render time — an unscaled square seed would have its+ * edges cropped away to fit a 16:9/9:16 target.+ ** Returns `{ mode, enqueued: [{ sceneId, jobId }], skipped: [{ sceneId, reason }], reason? }`.*/export async function enqueueFirstPassSceneFrames(project) {@@ -199,6 +205,18 @@ export async function enqueueFirstPassSceneFrames(project) {return { mode: resolved.mode, enqueued: [], skipped: [], reason: resolved.reason };}+ // Render at the project's locked-in aspect ratio, not the image worker's+ // square default. sceneRunner.js force-scales+center-crops whatever source+ // image it's handed to the project's target box+ // (`scale=w:h:force_original_aspect_ratio=increase,crop=w:h` in+ // videoGen/local.js) — a square seed for a 16:9/9:16 project would have a+ // large chunk of its top/bottom or left/right cropped away before the+ // scene ever renders, silently defeating the seeded frame. Falls back to+ // the worker's own default (undefined → 1024x1024) for an unrecognized+ // aspectRatio rather than throwing, matching this function's best-effort+ // contract.+ const { width, height } = ASPECT_PRESETS[project.aspectRatio] || {};+const enqueued = [];const skipped = [];for (const scene of scenes) {@@ -217,6 +235,8 @@ export async function enqueueFirstPassSceneFrames(project) {params: {...resolved.jobParams,prompt,+ width,+ height,// Tag the job so the durable creativeDirectorSceneImageHook files the// finished render onto this scene's sourceImageFile — no mounted// client required. Mirrors the catalogAttach tag the portrait pathdiff --git a/server/services/creativeDirector/firstPassGen.test.js b/server/services/creativeDirector/firstPassGen.test.jsindex b4894f3a4b..110830fb2e 100644--- a/server/services/creativeDirector/firstPassGen.test.js+++ b/server/services/creativeDirector/firstPassGen.test.js@@ -157,7 +157,7 @@ describe('enqueueFirstPassSceneFrames (#1867)', () => {});it('enqueues a creativeDirector-tagged job per scene lacking a reference frame', async () => {- const project = { id: 'cd-1', treatment: { scenes: [scene({ sceneId: 's1' }), scene({ sceneId: 's2' })] } };+ const project = { id: 'cd-1', aspectRatio: '16:9', treatment: { scenes: [scene({ sceneId: 's1' }), scene({ sceneId: 's2' })] } };const out = await enqueueFirstPassSceneFrames(project);expect(out.mode).toBe('local');expect(out.enqueued).toEqual([@@ -172,6 +172,26 @@ describe('enqueueFirstPassSceneFrames (#1867)', () => {expect(firstJob.params.pythonPath).toBe('/py');});+ it('renders at the project aspect ratio, not the worker default square (#1867 fix)', async () => {+ const wide = { id: 'cd-1', aspectRatio: '16:9', treatment: { scenes: [scene({ sceneId: 's1' })] } };+ const wideOut = await enqueueFirstPassSceneFrames(wide);+ expect(wideOut.enqueued).toHaveLength(1);+ expect(enqueueJob.mock.calls[0][0].params).toMatchObject({ width: 768, height: 432 });++ enqueueJob.mockClear();+ const tall = { id: 'cd-2', aspectRatio: '9:16', treatment: { scenes: [scene({ sceneId: 's1' })] } };+ await enqueueFirstPassSceneFrames(tall);+ expect(enqueueJob.mock.calls[0][0].params).toMatchObject({ width: 432, height: 768 });+ });++ it('falls back to undefined width/height for an unrecognized aspectRatio rather than throwing', async () => {+ const project = { id: 'cd-1', aspectRatio: 'bogus', treatment: { scenes: [scene({ sceneId: 's1' })] } };+ const out = await enqueueFirstPassSceneFrames(project);+ expect(out.enqueued).toHaveLength(1);+ expect(enqueueJob.mock.calls[0][0].params.width).toBeUndefined();+ expect(enqueueJob.mock.calls[0][0].params.height).toBeUndefined();+ });+it('skips a scene that already has a reference frame (idempotent re-run)', async () => {const project = {id: 'cd-1',