Skip to content

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

fix: keep mood-board captions out of music video motion prompts

[._.]/ Adam Eivy8c2ee02ccb47
diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.js
index e63b57620b..ca59c3189e 100644
--- a/client/src/hooks/useMusicVideoSceneMedia.js
+++ b/client/src/hooks/useMusicVideoSceneMedia.js
@@ -107,6 +107,8 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS
const style = project?.concept?.style?.trim();
const direction = [musicVideoCreativeContext(project?.concept), visualDirection(project?.visualSpec)].filter(Boolean).join('; ');
+ // The i2v prompt leaves the mood-board look out (handoff.js composePrompt): the frame already carries it.
+ const motionDirection = [musicVideoCreativeContext(project?.concept, { moodBoard: false }), visualDirection(project?.visualSpec)].filter(Boolean).join('; ');
const conditioning = conditioningReferences(project);
// The image prompt for a scene's reference frame: its frame prompt (or the
// shot prompt as a fallback) suffixed with the project's global concept style
@@ -121,7 +123,7 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS
// fallback) suffixed the same way. The reference frame already fixes the
// look; this prompt guides the motion.
const buildShotPrompt = (scene) =>
- [(scene.prompt?.trim() || scene.framePrompt?.trim() || ''), style, direction, scene.direction?.motionClause?.trim()].filter(Boolean).join(', ');
+ [(scene.prompt?.trim() || scene.framePrompt?.trim() || ''), style, motionDirection, scene.direction?.motionClause?.trim()].filter(Boolean).join(', ');
/**
* Render a still reference frame for one scene from its frame prompt. The
diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsx
index 24ac19b54b..c14e56b428 100644
--- a/client/src/pages/MusicVideo.test.jsx
+++ b/client/src/pages/MusicVideo.test.jsx
@@ -1767,7 +1767,7 @@ describe('MusicVideo visual spec, takes and handoff (#8965)', () => {
await waitFor(() => expect(generateImage).toHaveBeenCalledWith(expect.objectContaining({
prompt: expect.stringContaining('character (protagonist): Example singer — Silver coat'),
}), { silent: true }));
- expect(generateImage.mock.calls[0][0].prompt).toContain('Mood board style: Watercolor');
+ expect(generateImage.mock.calls[0][0].prompt).toContain('Mood board look (palette, lighting and texture only; never its locations, objects or poses): Watercolor');
expect(generateImage.mock.calls[0][0].prompt).toContain('Universe style: Ink silhouettes');
});
diff --git a/server/lib/musicVideoCreativeContext.js b/server/lib/musicVideoCreativeContext.js
index 333362a84f..8425f93692 100644
--- a/server/lib/musicVideoCreativeContext.js
+++ b/server/lib/musicVideoCreativeContext.js
@@ -3,12 +3,22 @@ import { trimTo } from './textUtils.js';
const CONTEXT_MAX = 6000;
const BIBLE_HEADER = 'Production bible (use the subjects relevant to this shot; preserve their identity; descriptions may be abbreviated):';
-/** Shared, bounded creative bible for planning, media generation and handoff. */
-export function musicVideoCreativeContext(concept) {
+// The mood board describes a LOOK. Its snapshot can still carry the board's own
+// subjects and places (image captions, or a synthesized style that pictures a
+// street or a bathroom), so it is labelled look-only wherever it is included.
+export const MOOD_BOARD_LOOK_LABEL = 'Mood board look (palette, lighting and texture only; never its locations, objects or poses)';
+
+/**
+ * Shared, bounded creative bible for planning, media generation and handoff.
+ * `moodBoard: false` leaves the mood-board look out — a motion prompt is
+ * conditioned on a reference frame that already carries the look, and the
+ * board's pictured places and subjects only fight the shot there.
+ */
+export function musicVideoCreativeContext(concept, { moodBoard = true } = {}) {
if (!concept) return '';
const styles = [
concept.universeStyle && `Universe style: ${trimTo(concept.universeStyle, 800)}`,
- concept.moodBoardStyle && `Mood board style: ${trimTo(concept.moodBoardStyle, 800)}`,
+ moodBoard && concept.moodBoardStyle && `${MOOD_BOARD_LOOK_LABEL}: ${trimTo(concept.moodBoardStyle, 800)}`,
].filter(Boolean);
const subjects = (concept.subjects || []).slice(0, 24);
const identities = subjects.map((s) =>
diff --git a/server/services/musicVideo/handoff.js b/server/services/musicVideo/handoff.js
index a3cca6c90f..860ea3fc53 100644
--- a/server/services/musicVideo/handoff.js
+++ b/server/services/musicVideo/handoff.js
@@ -82,11 +82,13 @@ export function visualDirection(spec) {
// `clause` is the scene's applied treatment direction (#8980) — the composition
// constraints for a frame or a motion prompt. Same order as the client's
// buildFramePrompt/buildShotPrompt.
-function composePrompt(primary, fallback, project, clause) {
+// A motion prompt (`motion: true`) omits the mood-board look: the i2v model
+// starts from the reference frame, which already carries it.
+function composePrompt(primary, fallback, project, clause, { motion = false } = {}) {
return [
primary?.trim() || fallback?.trim() || '',
project.concept?.style?.trim() || '',
- musicVideoCreativeContext(project.concept),
+ musicVideoCreativeContext(project.concept, { moodBoard: !motion }),
visualDirection(project.visualSpec),
clause?.trim() || '',
].filter(Boolean).join(', ');
@@ -96,7 +98,7 @@ function composePrompt(primary, fallback, project, clause) {
export const sceneFramePrompt = (project, scene) => composePrompt(scene.framePrompt, scene.prompt, project, scene.direction?.frameClause);
/** A scene's composed shot (motion) prompt. */
-export const sceneShotPrompt = (project, scene) => composePrompt(scene.prompt, scene.framePrompt, project, scene.direction?.motionClause);
+export const sceneShotPrompt = (project, scene) => composePrompt(scene.prompt, scene.framePrompt, project, scene.direction?.motionClause, { motion: true });
/** Build the export manifest for a project. */
export function buildHandoffManifest(project, { now = new Date().toISOString() } = {}) {
diff --git a/server/services/musicVideo/handoff.test.js b/server/services/musicVideo/handoff.test.js
index 12563dd0fe..4c30d553c7 100644
--- a/server/services/musicVideo/handoff.test.js
+++ b/server/services/musicVideo/handoff.test.js
@@ -125,5 +125,8 @@ describe('buildHandoffManifest typography (#8992)', () => {
const manifest = buildHandoffManifest(await projects.getProject(p.id));
expect(manifest.concept.subjects).toEqual(concept.subjects);
expect(manifest.scenes[0].framePrompt).toContain('Example singer — Silver coat');
- expect(manifest.scenes[0].shotPrompt).toContain('Mood board style: Watercolor');
+ expect(manifest.scenes[0].framePrompt).toContain('Mood board look (palette, lighting and texture only; never its locations, objects or poses): Watercolor');
+ // The motion prompt starts from the frame, which already carries the look.
+ expect(manifest.scenes[0].shotPrompt).not.toContain('Watercolor');
+ expect(manifest.scenes[0].shotPrompt).toContain('Universe style: Ink silhouettes');
});
diff --git a/server/services/musicVideo/planner.test.js b/server/services/musicVideo/planner.test.js
index f2537d65aa..ec0fb4ef3d 100644
--- a/server/services/musicVideo/planner.test.js
+++ b/server/services/musicVideo/planner.test.js
@@ -245,7 +245,7 @@ describe('buildScenePlanPrompt', () => {
subjects: [{ id: 'lead', kind: 'character', role: 'protagonist', name: 'Example singer', description: 'Silver coat' }],
} }), shots);
expect(prompt).toContain('Universe style: Ink silhouettes');
- expect(prompt).toContain('Mood board style: Watercolor');
+ expect(prompt).toContain('Mood board look (palette, lighting and texture only; never its locations, objects or poses): Watercolor');
expect(prompt).toContain('character (protagonist): Example singer — Silver coat');
expect(prompt).toContain('Neon Nights');
expect(prompt).toContain('cyberpunk chase');
diff --git a/server/services/musicVideo/styleSnapshots.js b/server/services/musicVideo/styleSnapshots.js
index 34ff581238..672c73656b 100644
--- a/server/services/musicVideo/styleSnapshots.js
+++ b/server/services/musicVideo/styleSnapshots.js
@@ -21,7 +21,15 @@ function universeStyleSnapshot(universe) {
].filter(Boolean).join('\n').slice(0, STYLE_SNAPSHOT_MAX);
}
+// Prefer the board's synthesized style (a look description with its own
+// avoid list) over its raw item captions, which name the pictured places and
+// subjects ("a woman sitting in a bathtub") rather than the look.
function moodBoardStyleSnapshot(board) {
+ const synthesized = board?.style?.prompt?.trim();
+ if (synthesized) {
+ const avoid = board.style.negativePrompt?.trim();
+ return [synthesized, avoid ? `Avoid: ${avoid}` : ''].filter(Boolean).join('\n').slice(0, STYLE_SNAPSHOT_MAX);
+ }
const context = board ? collectBoardStyleContext(board) : null;
if (!context) return '';
return [context.name, context.description, ...context.items.map((item) => Object.values(item).join('; '))]
diff --git a/server/services/musicVideo/styleSnapshots.test.js b/server/services/musicVideo/styleSnapshots.test.js
index dde654d60b..41a05674be 100644
--- a/server/services/musicVideo/styleSnapshots.test.js
+++ b/server/services/musicVideo/styleSnapshots.test.js
@@ -23,6 +23,13 @@ describe('withStyleSnapshots (#9105)', () => {
expect(out.visualSpec).toEqual({ moodBoardId: 'b1' });
});
+ it('snapshots a board\'s synthesized style and avoid list instead of its item captions', async () => {
+ getBoard.mockResolvedValue({ ...BOARD, style: { prompt: 'Teal and red neon, 35mm grain', negativePrompt: 'daylight, cartoon' } });
+ const out = await withStyleSnapshots({ name: 'MV', visualSpec: { moodBoardId: 'b1' }, concept: {} });
+ expect(out.concept.moodBoardStyle).toBe('Teal and red neon, 35mm grain\nAvoid: daylight, cartoon');
+ expect(out.concept.moodBoardStyle).not.toContain('Loose brush strokes');
+ });
+
it('keeps an explicit snapshot and does not refetch an unchanged, already-snapshotted source', async () => {
const existing = { concept: { universeId: 'u1', universeStyle: 'kept', moodBoardStyle: 'kept' }, visualSpec: { moodBoardId: 'b1' } };
const patch = { concept: { universeId: 'u1', subjects: [] }, visualSpec: { moodBoardId: 'b1' } };
diff --git a/server/services/videoGen/fal.js b/server/services/videoGen/fal.js
index 94ec68ee1a..eaf2f5954e 100644
--- a/server/services/videoGen/fal.js
+++ b/server/services/videoGen/fal.js
@@ -204,6 +204,21 @@ async function pollFalStatus({ statusUrl, apiKey }) {
return res.json();
}
+/** A short, single-line reason from a fal error response body (`detail` string or validation list), or ''. */
+async function falErrorDetail(response) {
+ const text = typeof response.text === 'function' ? await response.text().catch(() => '') : '';
+ if (!text) return '';
+ let reason = text;
+ try {
+ const body = JSON.parse(text);
+ const detail = body?.detail ?? body?.error ?? body?.message;
+ reason = Array.isArray(detail)
+ ? detail.map((d) => [d?.loc?.slice?.(-1)?.[0], d?.msg || d?.type].filter(Boolean).join(': ')).join('; ')
+ : typeof detail === 'string' ? detail : JSON.stringify(detail ?? body);
+ } catch { /* not JSON: keep the text */ }
+ return reason.replace(/\s+/g, ' ').trim().slice(0, 300);
+}
+
// Retry only reads of the already-paid render, including body consumption.
// Schema/JSON errors and permanent HTTP failures must not enter this loop.
async function readCompletedRender(url, { apiKey, signal, deadline, video = false }) {
@@ -218,8 +233,13 @@ async function readCompletedRender(url, { apiKey, signal, deadline, video = fals
signal,
}, Math.min(remaining, video ? FAL_DOWNLOAD_TIMEOUT_MS : FAL_POLL_TIMEOUT_MS));
if (!response.ok) {
- const error = new Error(`fal.ai ${video ? 'video download' : 'result retrieval'} failed: HTTP ${response.status}`);
- error.transientRead = response.status === 408 || response.status === 429 || (response.status >= 500 && response.status <= 599);
+ const transientRead = response.status === 408 || response.status === 429 || (response.status >= 500 && response.status <= 599);
+ // A permanent failure on the result read is how fal reports a job that
+ // failed on its side (a 422 with a `detail` naming the input or policy
+ // violation). Keep that reason — without it the job just says "HTTP 422".
+ const detail = !transientRead && !video ? await falErrorDetail(response) : '';
+ const error = new Error(`fal.ai ${video ? 'video download' : 'result retrieval'} failed: HTTP ${response.status}${detail ? ` — ${detail}` : ''}`);
+ error.transientRead = transientRead;
throw error;
}
const value = await (video ? response.arrayBuffer() : response.json());
diff --git a/server/services/videoGen/fal.test.js b/server/services/videoGen/fal.test.js
index ebd1279cb8..568cf41656 100644
--- a/server/services/videoGen/fal.test.js
+++ b/server/services/videoGen/fal.test.js
@@ -654,6 +654,12 @@ describe('videoGen/fal — recover completed renders (#8564)', () => {
expect(counts).toEqual({ submit: 1, result: 1, video: phase === 'video' ? 1 : 0 });
await expect(readFile(join(FAKE_VIDEOS_DIR, job.filename))).rejects.toMatchObject({ code: 'ENOENT' });
});
+ it('keeps fal\'s reason when the result read reports a failed job', async () => {
+ installReads({ result: () => new Response(JSON.stringify({ detail: [{ loc: ['body', 'image_url'], msg: 'Image flagged by the content checker', type: 'content_policy_violation' }] }), { status: 422 }) });
+ const job = await generate();
+ expect(await waitForTerminal(job.jobId)).toMatchObject({ type: 'failed', error: expect.stringContaining('HTTP 422 — image_url: Image flagged by the content checker') });
+ expect(counts).toEqual({ submit: 1, result: 1, video: 0 });
+ });
it('shares the ten-minute budget across result timeouts, backoff and a stalled video body', async () => {
installReads({
result: (attempt, signal) => attempt < 3 ? stalledResponse(signal) : jsonResponse({ video: { url: videoUrl } }),