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

feat: swap a parked music-video run's video model from Resume in the production and autonomous panels (#10499)

[._.]/ Adam Eivy02c0d4dbac5f
diff --git a/client/src/components/musicVideo/AutonomousRunPanel.jsx b/client/src/components/musicVideo/AutonomousRunPanel.jsx
index e7c8cb06d9..a1c52ab2b4 100644
--- a/client/src/components/musicVideo/AutonomousRunPanel.jsx
+++ b/client/src/components/musicVideo/AutonomousRunPanel.jsx
@@ -5,6 +5,8 @@ import {
AUTONOMOUS_CHECKPOINT_LABELS, AUTONOMOUS_LYRICS_STEP_LABELS, AUTONOMOUS_PRODUCE_STEP_LABELS, AUTONOMOUS_SONG_STEP_LABELS, AUTONOMOUS_STATUS_LABELS, AUTONOMOUS_VIEWABLE_STAGES,
autonomousStageOutput, autonomousStageRows, isAutonomousLive, isOrchestratedRun,
} from '../../lib/musicVideoAutonomous.js';
+import { MUSIC_VIDEO_AUTOMATION_TOOLS } from '../../lib/musicVideoAutomation.js';
+import { VideoModelField } from './ToolPicker.jsx';
import { productionReviewStopGuidance } from '../../lib/musicVideoStages.js';
import { formatCount, formatUsd } from '../../utils/formatters.js';
import AutoApproveFields from './AutoApproveFields.jsx';
@@ -67,6 +69,8 @@ export default function AutonomousRunPanel({ project, auto, readiness, selectedS
const [autoApproveEdit, setAutoApproveEdit] = useState(null);
const autoApprove = autoApproveEdit && autoApproveEdit.runId === run?.id ? autoApproveEdit.value : (run?.brief?.autoApprove || []).filter(stage => stage !== 'proof');
const [grantError, setGrantError] = useState(null);
+ // The video model swaps the director picked for a parked production stage: { runId, value: { 'video:<mode>': id } }.
+ const [videoSwapEdit, setVideoSwapEdit] = useState(null);
if (!run) return null;
const guidance = productionReviewStopGuidance(run, readiness);
const rows = autonomousStageRows(run);
@@ -81,6 +85,12 @@ export default function AutonomousRunPanel({ project, auto, readiness, selectedS
// A run canceled while waiting on production can resume: it adopts or restarts production.
const reopenable = run.status === 'canceled' && run.stage === 'produce';
const canRetry = ['needs-human', 'failed', 'stopped'].includes(run.status) || run.interrupted || reopenable;
+ // A run parked in production can swap its video model on Resume; the same production run carries on.
+ const videoTools = canRetry && !awaiting && run.stage === 'produce'
+ ? MUSIC_VIDEO_AUTOMATION_TOOLS.filter((tool) => tool.id.startsWith('video:') && (run.brief?.tools || []).includes(tool.id))
+ : [];
+ const videoSwaps = videoSwapEdit && videoSwapEdit.runId === run.id ? videoSwapEdit.value : {};
+ const modelsSwap = Object.fromEntries(Object.entries(videoSwaps).filter(([tool, id]) => id !== (run.brief?.models?.[tool] || '')).map(([tool, id]) => [tool, id || null]));
const orchestrator = isOrchestratedRun(run) ? run.brief.orchestrator : null;
const tone = STATUS_TONES[run.status] || '';
// #10157: what the production run has used against its limits (Suno is counted apart).
@@ -92,7 +102,8 @@ export default function AutonomousRunPanel({ project, auto, readiness, selectedS
const selectedRow = rows.find((row) => row.id === selectedStage && row.status === 'done' && AUTONOMOUS_VIEWABLE_STAGES.includes(row.id)) || null;
const selected = selectedRow?.id || null;
// Every resume path carries the selected grant and shows authorization failures inline.
- const resume = (edits = {}) => {
+ const resume = (rawEdits = {}) => {
+ const edits = Object.keys(modelsSwap).length && videoTools.length ? { ...rawEdits, models: modelsSwap } : rawEdits;
if (!autoApproveEdit || autoApproveEdit.runId !== run.id) return auto.resume(edits);
setGrantError(null);
return auto.resume({ ...edits, autoApprove }, { inline: true })
@@ -218,6 +229,20 @@ export default function AutonomousRunPanel({ project, auto, readiness, selectedS
/>
)}
+ {videoTools.length > 0 && (
+ <fieldset aria-label="Swap the video model" className="grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3">
+ {videoTools.map((tool) => (
+ <VideoModelField
+ key={tool.id}
+ id={`mv-run-video-model-${tool.id}`}
+ tool={tool}
+ value={tool.id in videoSwaps ? videoSwaps[tool.id] : run.brief?.models?.[tool.id] || ''}
+ onChange={(value) => setVideoSwapEdit({ runId: run.id, value: { ...videoSwaps, [tool.id]: value } })}
+ />
+ ))}
+ </fieldset>
+ )}
+
{live || run.status === 'failed' || reopenable ? (
<div className="flex flex-wrap gap-2">
{canRetry && !awaiting && (
diff --git a/client/src/components/musicVideo/AutonomousRunPanel.test.jsx b/client/src/components/musicVideo/AutonomousRunPanel.test.jsx
index 72722d58d9..f3c211db96 100644
--- a/client/src/components/musicVideo/AutonomousRunPanel.test.jsx
+++ b/client/src/components/musicVideo/AutonomousRunPanel.test.jsx
@@ -150,6 +150,36 @@ describe('AutonomousRunPanel', () => {
expect(screen.queryByRole('button', { name: /resume/i })).toBeNull();
});
+ it('swaps the video model on Resume of a run parked in production, offering only image-capable models', async () => {
+ getVideoGenModelContext.mockResolvedValueOnce({
+ models: [
+ { id: 'example-ltx', name: 'Example LTX', supportedModes: ['text', 'image'] },
+ { id: 'example-text-only', name: 'Example text only', supportedModes: ['text'] },
+ ],
+ defaultModel: 'example-ltx',
+ });
+ api.resumeAutonomousMusicVideo.mockResolvedValue({ project: { id: 'mv-1', autonomousRun: baseRun() }, run: baseRun() });
+ render(<Harness initial={baseRun({
+ status: 'needs-human', stage: 'produce', error: 'Video model refused',
+ brief: { origin: { kind: 'manual' }, tools: ['image:local', 'video:local'], models: { 'video:local': 'example-wan' } },
+ output: { productionRunId: 'prod-1' },
+ })} />);
+ const select = await screen.findByLabelText('Local video gen model');
+ await waitFor(() => expect(select.disabled).toBe(false));
+ expect(screen.queryByRole('option', { name: 'Example text only' })).toBeNull();
+ fireEvent.change(select, { target: { value: 'example-ltx' } });
+ fireEvent.click(screen.getByRole('button', { name: /resume/i }));
+ await waitFor(() => expect(api.resumeAutonomousMusicVideo).toHaveBeenCalledWith('mv-1', { models: { 'video:local': 'example-ltx' } }, { silent: true }));
+ });
+
+ it('sends no models on Resume when the video model was not changed', async () => {
+ api.resumeAutonomousMusicVideo.mockResolvedValue({ project: { id: 'mv-1', autonomousRun: baseRun() }, run: baseRun() });
+ render(<Harness initial={baseRun({ status: 'needs-human', stage: 'produce', brief: { origin: { kind: 'manual' }, tools: ['video:local'] } })} />);
+ await screen.findByLabelText('Local video gen model');
+ fireEvent.click(screen.getByRole('button', { name: /resume/i }));
+ await waitFor(() => expect(api.resumeAutonomousMusicVideo).toHaveBeenCalledWith('mv-1', {}, { silent: true }));
+ });
+
it('offers a retry for a run that needs the director, and shows why', async () => {
api.resumeAutonomousMusicVideo.mockResolvedValue({ project: { id: 'mv-1', autonomousRun: baseRun() }, run: baseRun() });
render(<Harness initial={baseRun({ status: 'needs-human', stage: 'song', error: 'Sign in to Suno in the PortOS Browser' })} />);
diff --git a/client/src/components/musicVideo/AutopilotPanel.jsx b/client/src/components/musicVideo/AutopilotPanel.jsx
index 8b0cceaefd..d7c7511fa0 100644
--- a/client/src/components/musicVideo/AutopilotPanel.jsx
+++ b/client/src/components/musicVideo/AutopilotPanel.jsx
@@ -7,6 +7,7 @@ import { supportsToolFreeOneShot, toolFreeOneShotSelectionPolicy } from '../../u
import useProviderModels from '../../hooks/useProviderModels.js';
import ProviderModelSelector from '../ProviderModelSelector.jsx';
import ToggleChip from '../ui/ToggleChip.jsx';
+import { VideoModelField } from './ToolPicker.jsx';
import MediumPlanSummary from './MediumPlanSummary.jsx';
import { codeFirstProductionAssets } from '../../../../server/lib/musicVideoMediumPlan.js';
import {
@@ -62,6 +63,8 @@ function StepRow({ step }) {
function RunView({ run, production, codeFirst, project, readiness }) {
const [budget, setBudget] = useState(null);
+ // The video model the director picked for a refused clip: { [route index]: model id ('' = install default) }.
+ const [videoSwaps, setVideoSwaps] = useState({});
const live = RESUMABLE_RUN_STATUSES.has(run.status);
const steps = run.steps || [];
const failures = steps.filter((s) => s.error);
@@ -71,6 +74,16 @@ function RunView({ run, production, codeFirst, project, readiness }) {
&& Number.isInteger(budget.maxReviewAttempts) && budget.maxReviewAttempts >= run.limits.maxReviewAttempts && budget.maxReviewAttempts <= 10
&& (budget.spendCapUsd == null || (Number.isFinite(budget.spendCapUsd) && budget.spendCapUsd >= cap && budget.spendCapUsd <= 100000)));
const guidance = productionReviewStopGuidance(run, readiness, 'storyboard');
+ // A refused clip only blocks while its route is still allowed, so a parked run can swap the video model and continue.
+ const swappable = run.status === 'blocked' && steps.some((step) => step.kind === 'clip' && step.retryBlocked);
+ const videoRoutes = swappable ? (run.pool || []).map((route, index) => ({ route, index })).filter(({ route }) => route.kind === 'video') : [];
+ const swappedPool = Object.keys(videoSwaps).length
+ ? (run.pool || []).map((route, index) => {
+ if (!(index in videoSwaps)) return route;
+ const { model: _previous, ...rest } = route;
+ return videoSwaps[index] ? { ...rest, model: videoSwaps[index] } : rest;
+ })
+ : null;
const hint = run.interrupted
? 'The server restarted — nothing is running. Resume to continue.'
: guidance?.current || run.stopReason;
@@ -112,7 +125,14 @@ function RunView({ run, production, codeFirst, project, readiness }) {
</div>}
{guidance?.historical && <p className="text-port-text-muted break-words">Historical stop reason: {guidance.historical}</p>}
{hint && <p className="text-port-warning break-words">{hint}</p>}
- {steps.some((step) => step.retryBlocked) && <p className="text-port-warning">Terminal refusal recorded: unchanged inputs will not be submitted again on Resume. Repair the shot or cancel and choose another supported route. No new spend is reserved while blocked.</p>}
+ {steps.some((step) => step.retryBlocked) && <p className="text-port-warning">Terminal refusal recorded: unchanged inputs will not be submitted again on Resume. {videoRoutes.length > 0 ? 'Repair the shot or pick another video model below and Resume.' : 'Repair the shot or cancel and choose another supported route.'} No new spend is reserved while blocked.</p>}
+ {videoRoutes.length > 0 && <fieldset aria-label="Swap the video model" className="grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3">
+ {videoRoutes.map(({ route, index }) => (
+ <VideoModelField key={index} id={`production-video-model-${run.id}-${index}`} tool={{ id: `video:${route.mode}`, label: toolLabel.get(`video:${route.mode}`) || `video ${route.mode}` }}
+ value={index in videoSwaps ? videoSwaps[index] : route.model || ''}
+ onChange={(value) => setVideoSwaps((cur) => ({ ...cur, [index]: value }))} />
+ ))}
+ </fieldset>}
{run.error && <p role="status" className="text-port-error break-words">{run.error}</p>}
{failures.length > 0 && <p className="text-port-error">{failures.length} step{failures.length === 1 ? '' : 's'} failed — see the list below.</p>}
{steps.length > 0 && (
@@ -143,7 +163,7 @@ function RunView({ run, production, codeFirst, project, readiness }) {
)}
{live && (!codeFirst || run.authoring) && (run.status !== 'running' || run.interrupted) && (
<button type="button" disabled={production.busy || !resumeValid}
- onClick={() => production.resume(run.id, { ...(needsReplan ? { acceptBasis: true } : {}), ...(budget ? { limits: budget } : {}) })}
+ onClick={() => production.resume(run.id, { ...(needsReplan ? { acceptBasis: true } : {}), ...(budget ? { limits: budget } : {}), ...(swappedPool ? { pool: swappedPool } : {}) })}
className="flex items-center gap-1 bg-port-accent text-white rounded px-3 py-2 min-h-[44px] sm:min-h-0 sm:px-2 sm:py-1 disabled:opacity-50">
<Play size={12} /> {needsReplan ? 'Resume with the new setup' : 'Resume'}
</button>
diff --git a/client/src/components/musicVideo/AutopilotPanel.test.jsx b/client/src/components/musicVideo/AutopilotPanel.test.jsx
index d87bde1f0c..6dfa6fc0c3 100644
--- a/client/src/components/musicVideo/AutopilotPanel.test.jsx
+++ b/client/src/components/musicVideo/AutopilotPanel.test.jsx
@@ -22,6 +22,15 @@ vi.mock('../../services/apiMusicVideo.js', () => ({
stopMusicVideoProduction: vi.fn(),
cancelMusicVideoProduction: vi.fn(),
}));
+vi.mock('../../services/apiImageVideo.js', () => ({
+ getVideoGenModelContext: vi.fn(async () => ({
+ models: [
+ { id: 'example-ltx', name: 'Example LTX', supportedModes: ['text', 'image'] },
+ { id: 'example-text-only', name: 'Example text only', supportedModes: ['text'] },
+ ],
+ defaultModel: 'example-ltx',
+ })),
+}));
vi.mock('../ui/Toast', () => ({ default: { success: vi.fn(), info: vi.fn(), error: vi.fn() } }));
const authorProvider = vi.hoisted(() => ({ type: 'api', toolFreeOneShot: true }));
vi.mock('../../hooks/useProviderModels.js', () => ({
@@ -315,6 +324,30 @@ describe('AutopilotPanel production run', () => {
expect(api.resumeMusicVideoProduction).not.toHaveBeenCalled();
});
+ it('swaps the refused video model and resumes the same run with the new pool', async () => {
+ api.resumeMusicVideoProduction.mockResolvedValue({});
+ const blocked = run({
+ status: 'blocked',
+ pool: [{ kind: 'image', mode: 'local', model: null }, { kind: 'video', mode: 'local', model: 'example-text-only' }],
+ steps: [{ key: 'clip:a:1', kind: 'clip', route: { kind: 'video', mode: 'local', model: 'example-text-only' }, status: 'refused', error: 'Unsupported request', retryBlocked: true }],
+ });
+ render(<ProductionHarness initial={{ id: 'p1', productionRuns: [blocked] }} />);
+ expect(screen.getByText(/pick another video model below/)).toBeTruthy();
+ const select = screen.getByLabelText('Local video gen model');
+ await waitFor(() => expect(select.disabled).toBe(false));
+ expect(screen.queryByRole('option', { name: 'Example text only' })).toBeNull();
+ fireEvent.change(select, { target: { value: 'example-ltx' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Resume' }));
+ await waitFor(() => expect(api.resumeMusicVideoProduction).toHaveBeenCalledWith('p1', 'run-1', {
+ pool: [{ kind: 'image', mode: 'local', model: null }, { kind: 'video', mode: 'local', model: 'example-ltx' }],
+ }, { silent: true }));
+ });
+
+ it('offers no video model swap for a blocked run without a refused clip', () => {
+ render(<ProductionHarness initial={{ id: 'p1', productionRuns: [run({ status: 'blocked' })] }} />);
+ expect(screen.queryByLabelText('Local video gen model')).toBeNull();
+ });
+
it('shows an interrupted run and resumes it only on request; pushed projects update it', async () => {
api.resumeMusicVideoProduction.mockResolvedValue({ project: { id: 'p1', productionRuns: [run()] }, run: run() });
render(<ProductionHarness initial={{ id: 'p1', productionRuns: [run({ interrupted: true })] }} />);
diff --git a/client/src/components/musicVideo/ToolPicker.jsx b/client/src/components/musicVideo/ToolPicker.jsx
index 77d8c9c963..2075f4601d 100644
--- a/client/src/components/musicVideo/ToolPicker.jsx
+++ b/client/src/components/musicVideo/ToolPicker.jsx
@@ -171,3 +171,34 @@ export default function ToolPicker({ idPrefix = 'mv-auto', tools, models, onChan
</>
);
}
+
+/**
+ * One video tool's model swap, for a parked run's Resume. Local video gen picks from the
+ * same image-capable catalog the start drawer uses (text-only models are hidden);
+ * other tools take a model id. A blank value is the install default.
+ */
+export function VideoModelField({ id, tool, value, onChange }) {
+ const local = tool.id === LOCAL_VIDEO_TOOL_ID;
+ const { catalog, failed } = useLocalVideoModels(local);
+ const label = `${tool.label} model`;
+ if (!local) {
+ return (
+ <div className="min-w-0">
+ <label htmlFor={id} className="block text-xs text-port-text-muted mb-1">{label}</label>
+ <input id={id} value={value} onChange={(e) => onChange(e.target.value)} placeholder="Install default" maxLength={200} className={inputClass} />
+ </div>
+ );
+ }
+ const select = localModelSelectState({ catalog, failed, pinned: value, kind: 'video' });
+ const statusId = `${id}-status`;
+ return (
+ <div className="min-w-0">
+ <label htmlFor={id} className="block text-xs text-port-text-muted mb-1">{label}</label>
+ <select id={id} value={value} disabled={select.disabled} aria-describedby={select.status ? statusId : undefined} onChange={(e) => onChange(e.target.value)} className={inputClass}>
+ <option value="">{select.blankLabel}</option>
+ {select.options.map((model) => <option key={model.id} value={model.id}>{model.name}</option>)}
+ </select>
+ {select.status && <p id={statusId} role="status" className="text-[11px] text-port-warning mt-1">{select.status}</p>}
+ </div>
+ );
+}