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
feat: count manual and auto-review fal spend, show run spend and size the autopilot limit to the board (#10157)
Adam Eivy0cf05e0e6a70
diff --git a/client/src/components/musicVideo/AutonomousRunPanel.jsx b/client/src/components/musicVideo/AutonomousRunPanel.jsxindex c9ab34817f..9a73096d57 100644--- a/client/src/components/musicVideo/AutonomousRunPanel.jsx+++ b/client/src/components/musicVideo/AutonomousRunPanel.jsx@@ -6,6 +6,7 @@ import {autonomousStageOutput, autonomousStageRows, isAutonomousLive,} from '../../lib/musicVideoAutonomous.js';import { productionReviewStopGuidance } from '../../lib/musicVideoStages.js';+import { formatCount, formatUsd } from '../../utils/formatters.js';import AutoApproveFields from './AutoApproveFields.jsx';// The stages that report a sub-step while they run (the server's `stages[id].step`).@@ -78,6 +79,9 @@ export default function AutonomousRunPanel({ project, auto, readiness, selectedSconst changed = editable && draft !== editable.value;const canRetry = ['needs-human', 'failed', 'stopped'].includes(run.status) || run.interrupted;const tone = STATUS_TONES[run.status] || '';+ // #10157: what the production run has used against its limits (Suno is counted apart).+ const spendRun = run.output?.productionRunId ? (project.productionRuns || []).find((r) => r.id === run.output.productionRunId) : null;+ const sunoCount = Array.isArray(run.output?.sunoSongIds) ? run.output.sunoSongIds.length : 0;// A failed run that only has the final render left retries just that.const retryLabel = run.status === 'failed' && run.stage === 'produce' && (run.output?.renderJobId || run.output?.productionDone) ? 'Retry render' : run.status === 'failed' ? 'Retry' : 'Resume';// A stale or hand-edited `?run-stage=` that names no finished, viewable stage opens nothing.@@ -139,6 +143,15 @@ export default function AutonomousRunPanel({ project, auto, readiness, selectedS})}</ol>+ {spendRun && (+ <p aria-label="Run spend" className="text-xs text-port-text-muted break-words">+ {formatCount(spendRun.usage?.generations ?? 0)}/{formatCount(spendRun.limits?.maxGenerations ?? 0)} generations+ {' · '}{formatUsd(spendRun.usage?.spentUsd ?? 0)}{spendRun.limits?.spendCapUsd != null ? ` of ${formatUsd(spendRun.limits.spendCapUsd)} video budget` : ' video spend (no cap)'}+ {sunoCount > 0 && ` · ${formatCount(sunoCount)} Suno generation${sunoCount === 1 ? '' : 's'} (separate)`}+ {' · '}<Link to={`/music-video/${encodeURIComponent(project.id)}/produce`} className="text-port-accent hover:underline">View production run</Link>+ </p>+ )}+{selectedRow && <StageOutput run={run} row={selectedRow} editableBelow={!!editable && awaiting === selectedRow.id} />}{run.error && (diff --git a/client/src/components/musicVideo/AutonomousRunPanel.test.jsx b/client/src/components/musicVideo/AutonomousRunPanel.test.jsxindex 944a85dd5f..7a0218016e 100644--- a/client/src/components/musicVideo/AutonomousRunPanel.test.jsx+++ b/client/src/components/musicVideo/AutonomousRunPanel.test.jsx@@ -266,7 +266,7 @@ describe('AutonomousStartDrawer', () => {fireEvent.click(screen.getByLabelText('Lyrics', { selector: '#mv-auto-checkpoint-lyrics' }));await waitFor(() => expect(screen.getByRole('option', { name: 'Example image' })).toBeTruthy());fireEvent.change(screen.getByLabelText(/local image gen model/i), { target: { value: 'example-image' } });- fireEvent.change(screen.getByLabelText(/budget cap/i), { target: { value: '12' } });+ fireEvent.change(screen.getByLabelText(/video generation budget/i), { target: { value: '12' } });await waitFor(() => expect(screen.getByRole('option', { name: 'Neon Rain' })).toBeTruthy());fireEvent.change(screen.getByLabelText('Mood board'), { target: { value: 'mb-1' } });fireEvent.change(screen.getByLabelText('Code authoring provider'), { target: { value: 'fixture-api' } });diff --git a/client/src/components/musicVideo/AutonomousStartDrawer.jsx b/client/src/components/musicVideo/AutonomousStartDrawer.jsxindex cc78fc2964..84826efe58 100644--- a/client/src/components/musicVideo/AutonomousStartDrawer.jsx+++ b/client/src/components/musicVideo/AutonomousStartDrawer.jsx@@ -152,8 +152,9 @@ export default function AutonomousStartDrawer({ open, onClose, onStarted }) {<div className="grid grid-cols-[repeat(auto-fit,minmax(min(100%,12rem),16rem))] gap-3"><div>- <label htmlFor="mv-auto-budget" className="block text-xs text-port-text-muted mb-1">Budget cap (USD)</label>- <input id="mv-auto-budget" type="number" min="0" step="1" value={draft.budget} onChange={(e) => patch({ budget: e.target.value })} placeholder="No cap" className={inputClass} />+ <label htmlFor="mv-auto-budget" className="block text-xs text-port-text-muted mb-1">Video generation budget (USD)</label>+ <input id="mv-auto-budget" type="number" min="0" step="1" value={draft.budget} onChange={(e) => patch({ budget: e.target.value })} placeholder="No cap" aria-describedby="mv-auto-budget-hint" className={inputClass} />+ <p id="mv-auto-budget-hint" className="text-[11px] text-port-text-muted mt-1">Caps paid video and image generation only. Suno credits and LLM usage are separate.</p></div><div><label htmlFor="mv-auto-generations" className="block text-xs text-port-text-muted mb-1">Max generations</label>diff --git a/client/src/components/musicVideo/AutopilotPanel.jsx b/client/src/components/musicVideo/AutopilotPanel.jsxindex c7f1dbf3f5..c7f628670c 100644--- a/client/src/components/musicVideo/AutopilotPanel.jsx+++ b/client/src/components/musicVideo/AutopilotPanel.jsx@@ -11,7 +11,7 @@ import { codeFirstProductionAssets } from '../../../../server/lib/musicVideoMediimport {DEFAULT_AUTOMATION_TOOLS, MUSIC_VIDEO_AUTOMATION_TOOLS, MUSIC_VIDEO_LLM_STAGES, MUSIC_VIDEO_LLM_STAGE_LABELS, automationDraftFrom, automationFromDraft, llmRouteLabel,} from '../../lib/musicVideoAutomation.js';-import { RESUMABLE_RUN_STATUSES, currentProductionRun, productionReviewStopGuidance } from '../../lib/musicVideoStages.js';+import { RESUMABLE_RUN_STATUSES, boardJobEstimate, currentProductionRun, productionReviewStopGuidance } from '../../lib/musicVideoStages.js';import { formatCount, formatUsd } from '../../utils/formatters.js';const POOL_TOOLS = MUSIC_VIDEO_AUTOMATION_TOOLS.filter((t) => t.group === 'image' || t.group === 'video');@@ -164,13 +164,14 @@ function StartForm({ project, production }) {const [authorEffort, setAuthorEffort] = useState('');const [pool, setPool] = useState(() => initialPool(project));const [directive, setDirective] = useState('');- const [maxGenerations, setMaxGenerations] = useState(12);+ const [maxGenerations, setMaxGenerations] = useState(() => boardJobEstimate(project).suggestedMaxGenerations);const [maxReviewAttempts, setMaxReviewAttempts] = useState(3);const [spendCap, setSpendCap] = useState('');const {providers, selectedProviderId, selectedModel, availableModels, setSelectedProviderId, setSelectedModel,} = useProviderModels({ allowDefault: true, silent: true });const idFor = (s) => `mv-production-${project?.id}-${s}`;+ const estimate = boardJobEstimate(project);const picked = new Set(pool);const capValue = spendCap === '' ? null : Number(spendCap);const hasImage = pool.some((id) => id.startsWith('image:'));@@ -228,6 +229,11 @@ function StartForm({ project, production }) {<input id={idFor('generations')} type="number" min={1} max={500} step={1} value={maxGenerations} disabled={production.busy}onChange={(e) => setMaxGenerations(Number(e.target.value))} className={inputCls} /></div>+ {estimate.jobs > 0 && (+ <p className="basis-full text-port-text-muted">+ This board needs ~{formatCount(estimate.jobs)} jobs · est. {formatUsd(estimate.knownUsd)} known{estimate.unpriced > 0 ? ` + ${formatCount(estimate.unpriced)} unpriced` : ''}. The default limit adds a 25% review allowance.+ </p>+ )}<div><label htmlFor={idFor('attempts')} className="block text-[10px] text-port-text-muted">Max reviews</label><input id={idFor('attempts')} type="number" min={1} max={10} step={1} value={maxReviewAttempts} disabled={production.busy}diff --git a/client/src/components/musicVideo/MusicVideoLayout.jsx b/client/src/components/musicVideo/MusicVideoLayout.jsxindex 6ee0179d0a..1c55bc6445 100644--- a/client/src/components/musicVideo/MusicVideoLayout.jsx+++ b/client/src/components/musicVideo/MusicVideoLayout.jsx@@ -138,7 +138,7 @@ export default function MusicVideoLayout({</span>{showSpend && (<Pill size="xs" tone={spend.capUsd != null && spend.spentUsd >= spend.capUsd ? 'warning' : 'muted'}>- <span title="Paid generation used across this project's production runs, against the cap">+ <span title={`Paid generation used, against the cap. Autopilot ${formatUsd(spend.autopilot ?? 0)} · manual takes ${formatUsd(spend.manual ?? 0)} · auto-review ${formatUsd(spend.autoReview ?? 0)} (estimates)`}>{formatUsd(spend.spentUsd)}{spend.capUsd != null ? ` / ${formatUsd(spend.capUsd)}` : ' · no cap'}</span></Pill>diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.jsindex 6a3f35c857..3143ada538 100644--- a/client/src/lib/musicVideoStages.js+++ b/client/src/lib/musicVideoStages.js@@ -11,6 +11,7 @@ import {import { formatCount, formatTimecode } from '../utils/formatters.js';import { isNonBlankStr } from './textUtils';import { modeLabel } from './imageGenModes.js';+import { falSceneTake } from './musicVideoShotTiming.js';export const MUSIC_VIDEO_STAGES = [{ id: 'setup', label: 'Setup', title: 'Setup' },@@ -74,15 +75,47 @@ export const projectServicesSummary = (project) => [*/export function projectSpend(project) {const runs = Array.isArray(project?.productionRuns) ? project.productionRuns : [];- const spentUsd = runs.reduce((sum, run) => {- const spent = Number(run?.usage?.spentUsd);- return sum + (Number.isFinite(spent) ? spent : 0);- }, 0);+ const num = (v) => (Number.isFinite(Number(v)) ? Number(v) : 0);+ const autopilot = runs.reduce((sum, run) => sum + num(run?.usage?.spentUsd), 0);+ // #10157: board-started fal takes record the estimate they were priced at.+ let manual = 0;+ let autoReview = 0;+ for (const scene of Array.isArray(project?.scenes) ? project.scenes : []) {+ for (const take of Array.isArray(scene?.takes) ? scene.takes : []) {+ if (take?.spendKind === 'autoReview') autoReview += num(take.costUsd);+ else if (take?.spendKind === 'manual') manual += num(take.costUsd);+ }+ }+ const spentUsd = autopilot + manual + autoReview;const run = currentProductionRun(project);const runCap = run?.limits?.spendCapUsd;const briefCap = project?.automation?.budgetUsd;const capUsd = runCap != null ? runCap : (briefCap != null ? briefCap : null);- return { spentUsd, capUsd };+ return { spentUsd, capUsd, autopilot, manual, autoReview, total: spentUsd };+}++/**+ * What generating the rest of the board takes (#10157): scenes still missing a+ * frame or a clip, the generation limit that covers them plus a 25% review+ * allowance, and the known fal.ai price of the missing clips. A frame, or a+ * clip on a route with no quote, counts as unpriced.+ */+export function boardJobEstimate(project) {+ const scenes = Array.isArray(project?.scenes) ? project.scenes : [];+ const settings = project?.videoSettings || {};+ const missingFrames = scenes.filter((scene) => !scene?.referenceImageId).length;+ const missingClips = scenes.filter((scene) => !scene?.videoHistoryId);+ let knownUsd = 0;+ let unpriced = missingFrames;+ for (const scene of missingClips) {+ const cost = settings.backend === 'fal'+ ? falSceneTake({ scene, videoSettings: settings, songDurationSec: project?.audioAnalysis?.durationSec ?? null }).costUsd+ : null;+ if (Number.isFinite(cost)) knownUsd += cost;+ else unpriced += 1;+ }+ const jobs = missingFrames + missingClips.length;+ return { jobs, knownUsd, unpriced, suggestedMaxGenerations: Math.min(500, Math.max(1, Math.ceil(jobs * 1.25))) };}/**diff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.jsindex d051f9613d..0a997adc88 100644--- a/client/src/lib/musicVideoStages.test.js+++ b/client/src/lib/musicVideoStages.test.js@@ -1,6 +1,6 @@import { describe, it, expect } from 'vitest';import {- MUSIC_VIDEO_STAGES, currentProductionRun, deriveNextAction, deriveStages, projectSpend, listPreviewSources, describeProjectStatus, resolveStageParam, stageChecklist, compareMusicVideoProjectsNewestFirst,+ MUSIC_VIDEO_STAGES, currentProductionRun, deriveNextAction, deriveStages, projectSpend, boardJobEstimate, listPreviewSources, describeProjectStatus, resolveStageParam, stageChecklist, compareMusicVideoProjectsNewestFirst,} from './musicVideoStages.js';const APPROVED = { art: { approved: true }, storyboard: { approved: true }, proof: { approved: true }, readyForProduction: true };@@ -172,9 +172,29 @@ describe('projectSpend', () => {automation: { budgetUsd: 50 },productionRuns: [run({ id: 'a', status: 'completed', usage: { spentUsd: 1.25 } }), run({ id: 'b', status: 'running', usage: { spentUsd: 2 }, limits: { spendCapUsd: 10 } })],};- expect(projectSpend(project)).toEqual({ spentUsd: 3.25, capUsd: 10 });- expect(projectSpend({ automation: { budgetUsd: 50 }, productionRuns: [] })).toEqual({ spentUsd: 0, capUsd: 50 });- expect(projectSpend({})).toEqual({ spentUsd: 0, capUsd: null });+ expect(projectSpend(project)).toMatchObject({ spentUsd: 3.25, capUsd: 10, autopilot: 3.25, manual: 0, autoReview: 0 });+ expect(projectSpend({ automation: { budgetUsd: 50 }, productionRuns: [] })).toMatchObject({ spentUsd: 0, capUsd: 50 });+ expect(projectSpend({})).toMatchObject({ spentUsd: 0, capUsd: null });+ });++ it('counts manual and auto-review take estimates beside autopilot spend (#10157)', () => {+ const project = {+ productionRuns: [run({ usage: { spentUsd: 2 } })],+ scenes: [scene({ takes: [+ { takeId: 'a', spendKind: 'manual', costUsd: 0.5 },+ { takeId: 'b', spendKind: 'autoReview', costUsd: 0.25 },+ { takeId: 'c' },+ ] })],+ };+ expect(projectSpend(project)).toMatchObject({ autopilot: 2, manual: 0.5, autoReview: 0.25, total: 2.75, spentUsd: 2.75 });+ });+});++describe('boardJobEstimate', () => {+ it('sizes the generation limit to missing frames and clips plus a 25% allowance', () => {+ const scenes = [scene({ sceneId: 'a', referenceImageId: null, videoHistoryId: null }), scene({ sceneId: 'b', videoHistoryId: null }), scene({ sceneId: 'c' })];+ expect(boardJobEstimate({ scenes })).toMatchObject({ jobs: 3, unpriced: 3, knownUsd: 0, suggestedMaxGenerations: 4 });+ expect(boardJobEstimate({ scenes: [scene()] })).toMatchObject({ jobs: 0, suggestedMaxGenerations: 1 });});});diff --git a/server/lib/musicVideoSummary.js b/server/lib/musicVideoSummary.jsindex 0e657623aa..baf01a166d 100644--- a/server/lib/musicVideoSummary.js+++ b/server/lib/musicVideoSummary.js@@ -24,12 +24,19 @@ const currentRun = (project) => {function projectSpend(project, run) {const runs = Array.isArray(project.productionRuns) ? project.productionRuns : [];- const spentUsd = runs.reduce((sum, r) => {- const spent = Number(r?.usage?.spentUsd);- return sum + (Number.isFinite(spent) ? spent : 0);- }, 0);+ const num = (v) => (Number.isFinite(Number(v)) ? Number(v) : 0);+ const autopilot = runs.reduce((sum, r) => sum + num(r?.usage?.spentUsd), 0);+ let manual = 0;+ let autoReview = 0;+ for (const scene of Array.isArray(project.scenes) ? project.scenes : []) {+ for (const take of Array.isArray(scene?.takes) ? scene.takes : []) {+ if (take?.spendKind === 'autoReview') autoReview += num(take.costUsd);+ else if (take?.spendKind === 'manual') manual += num(take.costUsd);+ }+ }+ const spentUsd = autopilot + manual + autoReview;const capUsd = run?.limits?.spendCapUsd ?? project.automation?.budgetUsd ?? null;- return { spentUsd, capUsd };+ return { spentUsd, capUsd, autopilot, manual, autoReview, total: spentUsd };}function composeDone(project, mode) {diff --git a/server/routes/musicVideo.test.js b/server/routes/musicVideo.test.jsindex 11d8d8536c..fb4e991504 100644--- a/server/routes/musicVideo.test.js+++ b/server/routes/musicVideo.test.js@@ -181,7 +181,7 @@ describe('musicVideo routes', () => {expect(first.stage).toBe('produce');expect(first.status).toBe('draft');expect(first.runStatus).toBe('running');- expect(first.spend).toEqual({ spentUsd: 0.5, capUsd: 5.0 });+ expect(first.spend).toMatchObject({ spentUsd: 0.5, capUsd: 5.0, autopilot: 0.5, manual: 0, autoReview: 0 });expect(first.updatedAt).toBe('2026-02-01T00:00:00Z');expect(first.scenes).toBeUndefined();diff --git a/server/services/musicVideo/takes.js b/server/services/musicVideo/takes.jsindex afeb85afe6..9421721763 100644--- a/server/services/musicVideo/takes.js+++ b/server/services/musicVideo/takes.js@@ -41,7 +41,7 @@ const clip = (v, max) => (isNonBlankStr(v) ? trimTo(v, max) : null);// A basename only — an imported file's name is provenance, never a path.const takeOriginalName = (name) => (isNonBlankStr(name) ? clip(name.split(/[\\/]/).pop(), 200) : null);-function buildTake({ kind, assetId, source, provider = null, jobId = null, prompt = null, sourceImageId = null, originalName = null, shotInstruction = null, use = 'final', dependencies = null, inputAssets = null, now }) {+function buildTake({ kind, assetId, source, provider = null, jobId = null, prompt = null, sourceImageId = null, originalName = null, shotInstruction = null, use = 'final', dependencies = null, inputAssets = null, costUsd = null, spendKind = null, now }) {return {takeId: `mvt-${randomUUID()}`,kind,@@ -59,6 +59,8 @@ function buildTake({ kind, assetId, source, provider = null, jobId = null, prompuse: use === 'motion-reference' ? 'motion-reference' : 'final',note: null,createdAt: now,+ // #10157: the quoted generation cost, present only on a priced paid take.+ ...(Number.isFinite(costUsd) && costUsd >= 0 ? { costUsd, spendKind: spendKind === 'autoReview' ? 'autoReview' : 'manual' } : {}),// #8977: the immutable record of what a performance take was generated// against (audio revision, song interval, edit in/out, cues, capability).// Present only on takes that carry one, so other takes keep their shape.diff --git a/server/services/musicVideo/takes.test.js b/server/services/musicVideo/takes.test.jsnew file mode 100644index 0000000000..3efb14b755--- /dev/null+++ b/server/services/musicVideo/takes.test.js@@ -0,0 +1,20 @@+import { describe, expect, it } from 'vitest';+import { appendSceneTakes } from './takes.js';++const project = () => ({ id: 'mv-1', scenes: [{ sceneId: 's1' }] });++describe('take generation cost (#10157)', () => {+ it('stores a finite quote and its spend kind, and omits both when unpriced or invalid', () => {+ const input = { kind: 'video', source: 'generated' };+ const { appended } = appendSceneTakes(project(), 's1', [+ { ...input, assetId: 'a', costUsd: 0.4, spendKind: 'autoReview' },+ { ...input, assetId: 'b', costUsd: 0.1 },+ { ...input, assetId: 'c', costUsd: null },+ { ...input, assetId: 'd', costUsd: -3, spendKind: 'manual' },+ ]);+ expect(appended[0]).toMatchObject({ costUsd: 0.4, spendKind: 'autoReview' });+ expect(appended[1]).toMatchObject({ costUsd: 0.1, spendKind: 'manual' });+ expect(appended[2]).not.toHaveProperty('costUsd');+ expect(appended[3]).not.toHaveProperty('costUsd');+ });+});diff --git a/server/services/musicVideoSceneVideoHook.js b/server/services/musicVideoSceneVideoHook.jsindex 7de940ec7d..c9849dfe1d 100644--- a/server/services/musicVideoSceneVideoHook.js+++ b/server/services/musicVideoSceneVideoHook.js@@ -76,6 +76,10 @@ const hook = createMediaJobImageHook({// renderer places the take by it, so a later retime can't misalign lips.shotInstruction: job.params?.shotInstruction ?? null,dependencies: job.params?.musicVideoDependencies ?? null,+ // #10157: the estimate this clip was priced at; a revision-tagged job is+ // an auto-review generation, the rest are manual takes.+ costUsd: job.params?.musicVideoCostUsd ?? null,+ spendKind: job.params?.musicVideo?.revisionId ? 'autoReview' : 'manual',}]),onAttached: ({ projectId, sceneId, videoHistoryId }, { scene, appended }) => {musicVideoEvents.emit('scene-video', {diff --git a/server/services/videoGen/submitJob.js b/server/services/videoGen/submitJob.jsindex 4e386715a6..ccc963cd6a 100644--- a/server/services/videoGen/submitJob.js+++ b/server/services/videoGen/submitJob.js@@ -244,6 +244,18 @@ const submitValidatedVideoGenJob = async (body, uploads) => {const { captureTakeDependencies } = await import('../../lib/musicVideoDependencies.js');const { basename } = await import('path');if (scene) params.musicVideoDependencies = captureTakeDependencies(scene, prepared.sourceImagePath ? basename(prepared.sourceImagePath) : null);+ // #10157: a board-started (manual or auto-review) fal clip records the+ // estimate it was priced at so project spend counts it. A production-run+ // step is already charged to the run's own usage, so it is skipped.+ if (scene && backend === VIDEO_GEN_MODE.FAL && !body.musicVideo.productionRunId) {+ const { falSceneTake } = await import('../../lib/musicVideoShotTiming.js');+ const { costUsd } = falSceneTake({+ scene,+ videoSettings: { falModelId: body.falModelId, falDuration: body.falDuration, falResolution: body.falResolution, falLipSyncResolution: body.falResolution },+ songDurationSec: project.audioAnalysis?.durationSec ?? null,+ });+ if (Number.isFinite(costUsd)) params.musicVideoCostUsd = costUsd;+ }}// Selective section revision (#9011): checked as the LAST step before the// actual queue write (staging, FableLoom compilation and the performance-diff --git a/server/services/videoGen/submitJob.test.js b/server/services/videoGen/submitJob.test.jsindex c7bd8a6115..a618bd2ad7 100644--- a/server/services/videoGen/submitJob.test.js+++ b/server/services/videoGen/submitJob.test.js@@ -280,6 +280,15 @@ describe('submitVideoGenJob', () => {}});+ it('records the quoted fal estimate on a board-started clip but not on a production-run step (#10157)', async () => {+ mocks.prepareVideoGenParams.mockResolvedValue(falPrepared());+ mocks.getMusicVideoProject.mockResolvedValue({ id: 'mv-1', scenes: [{ sceneId: 'mvs-1', startSec: 0, endSec: 5 }] });+ await submitVideoGenJob({ prompt: 'selected shot', backend: 'fal', musicVideo }, {});+ expect(mocks.enqueueJob.mock.calls.at(-1)[0].params.musicVideoCostUsd).toBeGreaterThan(0);+ await submitVideoGenJob({ prompt: 'selected shot', backend: 'fal', musicVideo: { ...musicVideo, productionRunId: 'mvpr-1', productionStepKey: 'k' } }, {});+ expect(mocks.enqueueJob.mock.calls.at(-1)[0].params).not.toHaveProperty('musicVideoCostUsd');+ });+it('checks the current production policy after video preparation, before queueing', async () => {const changed = Object.assign(new Error('The approved plan changed'), { status: 409, code: 'PRODUCTION_BASIS_CHANGED' });const prepared = falPrepared();