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: scene attention chips, Board filter and Produce shot strip for music video (#10152)
Adam Eivyd2606ab7d9ba
diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex 575346407b..5235a803cf 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -18,6 +18,7 @@ import {} from '../../lib/musicVideoShotTiming.js';import SceneRenderProgress from './SceneRenderProgress.jsx';import { getFalVideoModel } from '../../lib/falVideoModels.js';+import { COVERAGE_TOLERANCE_SEC, SCENE_ATTENTION_LABELS, sceneAttention } from '../../lib/musicVideoSceneAttention.js';// "est. $0.81 (5.05s at 1080P)" — or null when the take cannot be priced.const falEstimate = (take) => (take?.costUsd == null ? null@@ -25,9 +26,6 @@ const falEstimate = (take) => (take?.costUsd == null ? null// The two timeline-bound scene fields rendered as identical number inputs.const SCENE_TIME_FIELDS = [['Start', 'startSec'], ['End', 'endSec']];-// Mirrors render.js COVERAGE_TOLERANCE_SEC: a non-looping shot may run this far-// past its clip (the last frame holds); beyond it the render refuses (#8964).-const COVERAGE_TOLERANCE_SEC = 0.25;/*** One scene on the board: ordering/delete, the shot + reference-frame prompts@@ -73,7 +71,7 @@ export default function SceneCard({onGenerateFrame, onGenerateVideo, onContinueVideo,onOpenPreview, onSelectTake, onReviewTake, onImportTake, onImportClipTake, takeBusy = false, layered = false,lipSyncBackend = '', songDurationSec = null, onSplit, falVideoSettings = null, onSeek, performanceReview = null, onRepairPerformance, repairBusy = false,- expanded, onToggleExpand,+ expanded, onToggleExpand, footageOptional = false, failedScenes = null,}) {const detailsRef = useRef(null);@@ -135,6 +133,9 @@ export default function SceneCard({const repairPlan = planPerformanceRepair({ scene, temporal: performanceReview?.shot,excerptStartSec: performanceReview?.excerptStartSec, backend: lipSyncBackend, videoSettings: falVideoSettings || {} });const shotModeId = `mv-shot-mode-${scene.sceneId}`;+ // #10152: what needs the director's attention, visible without opening the card.+ const attention = sceneAttention(scene, { layered, footageOptional, lipSyncBackend, songDurationSec, clipSec, failed: failedScenes || {} });+ const generatingLane = generatingFrame && generatingVideo ? 'Frame + clip' : generatingFrame ? 'Frame' : generatingVideo ? 'Clip' : null;return (<detailsref={detailsRef}@@ -171,9 +172,21 @@ export default function SceneCard({{clipSec != null ? ` · clip ${clipSec.toFixed(1)}s` : ''}</div>{scene.lyricText && <div className="truncate text-[11px] italic text-port-text-muted">♪ {scene.lyricText}</div>}+ {attention.length > 0 && (+ <ul aria-label="Needs attention" className="mt-0.5 flex flex-wrap gap-1">+ {attention.map((code) => (+ <li key={code} data-attention={code} className="rounded border border-port-warning/40 bg-port-warning/10 px-1.5 text-[10px] text-port-warning">+ {SCENE_ATTENTION_LABELS[code]}+ </li>+ ))}+ </ul>+ )}</div>- {(generatingFrame || generatingVideo) && (- <Activity size={14} className="shrink-0 animate-spin text-port-accent" aria-label="Generating" />+ {generatingLane && (+ <span className="flex shrink-0 items-center gap-1 text-[11px] text-port-accent">+ <Activity size={14} className="animate-spin" aria-label="Generating" />+ {generatingLane}+ </span>)}<SceneRenderProgress kind="Frame" generating={generatingFrame} progress={frameProgress} /><SceneRenderProgress kind="Video" generating={generatingVideo} progress={videoProgress} />diff --git a/client/src/components/musicVideo/ShotStatusStrip.jsx b/client/src/components/musicVideo/ShotStatusStrip.jsxnew file mode 100644index 0000000000..7f8397054b--- /dev/null+++ b/client/src/components/musicVideo/ShotStatusStrip.jsx@@ -0,0 +1,32 @@+import { Link } from 'react-router';+import { SCENE_ATTENTION_LABELS, sceneAttention } from '../../lib/musicVideoSceneAttention.js';++/**+ * One compact cell per shot, from the same `sceneAttention` answer the Board's+ * scene rows use: green when nothing needs doing, amber otherwise, with the+ * reasons in the tooltip. Each cell opens that scene on the Board.+ */+export default function ShotStatusStrip({ projectId, scenes, ctx }) {+ if (!scenes?.length) return null;+ const cells = scenes.map((scene) => ({ scene, codes: sceneAttention(scene, ctx) }));+ return (+ <ul aria-label="Shot status" className="flex flex-wrap gap-1">+ {cells.map(({ scene, codes }) => {+ const label = codes.map((code) => SCENE_ATTENTION_LABELS[code]).join(', ');+ return (+ <li key={scene.sceneId}>+ <Link+ to={`/music-video/${encodeURIComponent(projectId)}/board/scene/${encodeURIComponent(scene.sceneId)}`}+ data-status={codes.length ? 'attention' : 'ready'}+ title={`Scene ${scene.order + 1}: ${label || 'ready'}`}+ aria-label={`Scene ${scene.order + 1}: ${label || 'ready'}`}+ className={`flex min-h-[44px] min-w-[44px] items-center justify-center rounded border text-[11px] sm:min-h-0 sm:min-w-[28px] sm:px-1 sm:py-0.5 ${codes.length ? 'border-port-warning/40 bg-port-warning/10 text-port-warning' : 'border-port-success/40 bg-port-success/10 text-port-success'}`}+ >+ {scene.order + 1}+ </Link>+ </li>+ );+ })}+ </ul>+ );+}diff --git a/client/src/components/musicVideo/stages/BoardStage.jsx b/client/src/components/musicVideo/stages/BoardStage.jsxindex 1bc5380654..ebbd655887 100644--- a/client/src/components/musicVideo/stages/BoardStage.jsx+++ b/client/src/components/musicVideo/stages/BoardStage.jsx@@ -1,3 +1,5 @@+import { useEffect } from 'react';+import { useSearchParams } from 'react-router';import { Plus } from 'lucide-react';import BeatTimeline from '../BeatTimeline.jsx';import ContactSheetButton from '../ContactSheetButton.jsx';@@ -6,6 +8,11 @@ import TreatmentPanel, { treatmentSummary } from '../TreatmentPanel.jsx';import StageSection from '../StageSection.jsx';import { PlanActions } from '../ProjectActionGroups.jsx';import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';+import { FOOTAGE_OPTIONAL_MODES } from '../../../lib/musicVideoStages.js';+import { parseSceneFilter, sceneAttention, sceneMatchesFilter } from '../../../lib/musicVideoSceneAttention.js';++const FILTER_LABELS = [['all', 'All'], ['attention', 'Needs attention'], ['missing', 'Missing footage']];+const isTypingTarget = (el) => !!el && (el.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(el.tagName));/*** Board: plan and arrange the shots, the beat timeline, and the scene cards —@@ -16,6 +23,41 @@ import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';export default function BoardStage({ board }) {const { project, locked, busy, sceneMedia, videoSettings, takes, treatment, activeSceneId, onToggleSceneExpand } = board;const scenes = project.scenes || [];+ const [searchParams, setSearchParams] = useSearchParams();+ const filter = parseSceneFilter(searchParams.get('scenes'));+ const setFilter = (next) => setSearchParams((prev) => {+ const params = new URLSearchParams(prev);+ if (next === 'all') params.delete('scenes'); else params.set('scenes', next);+ return params;+ }, { replace: true });+ const layered = isLayeredComposition(project);+ const lipSyncBackend = videoSettings.audioReactiveSelected ? 'local' : videoSettings.settings.backend;+ const songDurationSec = project.audioAnalysis?.durationSec ?? null;+ const attentionCtx = {+ layered, lipSyncBackend, songDurationSec, failed: sceneMedia.failedScenes,+ footageOptional: FOOTAGE_OPTIONAL_MODES.has(project.composition?.mode || 'concat'),+ };+ const codesById = new Map(scenes.map((scene) => [scene.sceneId, sceneAttention(scene, attentionCtx)]));+ const counts = { all: scenes.length, attention: 0, missing: 0 };+ for (const codes of codesById.values()) {+ if (sceneMatchesFilter(codes, 'attention')) counts.attention += 1;+ if (sceneMatchesFilter(codes, 'missing')) counts.missing += 1;+ }+ // The open scene stays listed while it is edited, even once fixing it drops it from the filter.+ const visible = scenes.filter((scene) => scene.sceneId === activeSceneId || sceneMatchesFilter(codesById.get(scene.sceneId), filter));+ const visibleIds = visible.map((scene) => scene.sceneId).join('\n');+ // j / k step through the listed scenes (opening one, which also routes to it).+ useEffect(() => {+ const ids = visibleIds ? visibleIds.split('\n') : [];+ const onKey = (e) => {+ if ((e.key !== 'j' && e.key !== 'k') || e.metaKey || e.ctrlKey || e.altKey || isTypingTarget(e.target) || !ids.length) return;+ const at = ids.indexOf(activeSceneId);+ const next = e.key === 'j' ? Math.min(at + 1, ids.length - 1) : Math.max(at === -1 ? 0 : at - 1, 0);+ if (ids[next] !== activeSceneId) { e.preventDefault(); onToggleSceneExpand?.(ids[next], true); }+ };+ window.addEventListener('keydown', onKey);+ return () => window.removeEventListener('keydown', onKey);+ }, [visibleIds, activeSceneId, onToggleSceneExpand]);const performanceReviews = new Map();const attempts = (project.autoReviews || []).flatMap((run) => run.attempts || []).slice().reverse();for (const attempt of attempts) {@@ -44,7 +86,7 @@ export default function BoardStage({ board }) {onSeek={(startSec) => board.seekToScene({ startSec })} onCommit={board.commitSceneTiming} />)}- <div className="flex items-center justify-between">+ <div id="mv-scene-board" className="flex items-center justify-between"><h3 className="text-sm font-medium">Scene board</h3><div className="flex items-center gap-2"><ContactSheetButton onOpen={board.openContactSheet} />@@ -55,9 +97,23 @@ export default function BoardStage({ board }) {</div>{scenes.length === 0 && <p className="text-sm text-port-text-muted">No scenes yet — add one to start the board.</p>}+ {scenes.length > 0 && (+ <div role="group" aria-label="Filter scenes" className="flex flex-wrap items-center gap-1.5 text-xs">+ {FILTER_LABELS.map(([id, label]) => (+ <button key={id} type="button" aria-pressed={filter === id} onClick={() => setFilter(id)}+ className={`min-h-[44px] rounded border px-2 py-1 sm:min-h-0 ${filter === id ? 'border-port-accent bg-port-accent/10 text-port-accent' : 'border-port-border text-port-text-muted'}`}>+ {label} ({counts[id]})+ </button>+ ))}+ <span className="hidden text-port-text-muted sm:inline">j / k to move between scenes</span>+ </div>+ )}+ {scenes.length > 0 && visible.length === 0 && (+ <p className="text-sm text-port-text-muted">No scenes match this filter.</p>+ )}<div className="@container"><div className="grid grid-cols-1 items-start gap-3 @2xl:grid-cols-2 @5xl:grid-cols-3">- {scenes.map((scene, idx) => (+ {scenes.map((scene, idx) => !visible.includes(scene) ? null : (<SceneCardkey={scene.sceneId}scene={scene}@@ -72,8 +128,10 @@ export default function BoardStage({ board }) {videoProgress={sceneMedia.videoSceneProgress?.[scene.sceneId]}settingsSaving={videoSettings.saving}videoBlockedReason={videoSettings.videoBlockedReason}- lipSyncBackend={videoSettings.audioReactiveSelected ? 'local' : videoSettings.settings.backend}- songDurationSec={project.audioAnalysis?.durationSec ?? null}+ lipSyncBackend={lipSyncBackend}+ songDurationSec={songDurationSec}+ footageOptional={attentionCtx.footageOptional}+ failedScenes={sceneMedia.failedScenes}falVideoSettings={videoSettings.settings}canContinueShot={board.canContinueShot}onMove={board.moveScene}@@ -93,7 +151,7 @@ export default function BoardStage({ board }) {onReviewTake={takes.reviewTake}onImportTake={(target) => board.setPickerTarget({ type: 'take', sceneId: target.sceneId })}onImportClipTake={(target) => board.setPickerTarget({ type: 'clip', sceneId: target.sceneId })}- layered={isLayeredComposition(project)}+ layered={layered}/>))}</div>diff --git a/client/src/components/musicVideo/stages/BoardStage.test.jsx b/client/src/components/musicVideo/stages/BoardStage.test.jsxnew file mode 100644index 0000000000..63471cd9ff--- /dev/null+++ b/client/src/components/musicVideo/stages/BoardStage.test.jsx@@ -0,0 +1,54 @@+// @vitest-environment happy-dom+import { describe, it, expect, vi } from 'vitest';+import { fireEvent, render, screen } from '@testing-library/react';+import { MemoryRouter, useLocation } from 'react-router';+import BoardStage from './BoardStage.jsx';++vi.mock('../../../hooks/useVideoFileSrc.js', () => ({ useVideoFileSrc: () => ({}) }));+vi.mock('../BeatTimeline.jsx', () => ({ default: () => null }));+vi.mock('../ContactSheetButton.jsx', () => ({ default: () => null }));+vi.mock('../TreatmentPanel.jsx', () => ({ default: () => null, treatmentSummary: () => '' }));+vi.mock('../ProjectActionGroups.jsx', () => ({ PlanActions: () => null }));++const scene = (n, extra = {}) => ({ sceneId: `s${n}`, order: n - 1, label: `Shot ${n}`, referenceImageId: 'f.png', videoHistoryId: 'v', startSec: 0, endSec: 3, takes: [], ...extra });+const board = (scenes, over = {}) => ({+ project: { id: 'p', scenes, composition: { mode: 'concat' } }, locked: false, busy: {},+ sceneMedia: { genScenes: {}, genVideoScenes: {}, failedScenes: { frame: {}, video: {} } },+ videoSettings: { settings: { backend: 'local' } }, takes: {}, treatment: {}, activeSceneId: null, onToggleSceneExpand: vi.fn(), ...over,+});+const Search = () => <output data-testid="search">{useLocation().search}</output>;+const renderBoard = (b, url = '/') => render(<MemoryRouter initialEntries={[url]}><BoardStage board={b} /><Search /></MemoryRouter>);++describe('BoardStage scene filter', () => {+ const scenes = [scene(1), scene(2, { videoHistoryId: null }), scene(3)];++ it('shows chips and counts, and lists only affected scenes from ?scenes=missing', () => {+ renderBoard(board(scenes), '/?scenes=missing');+ expect(screen.getByRole('button', { name: 'Needs attention (1)' })).toBeTruthy();+ expect(screen.getByRole('button', { name: 'Missing footage (1)' }).getAttribute('aria-pressed')).toBe('true');+ expect(screen.getAllByText('Shot 2').length).toBeGreaterThan(0);+ expect(screen.queryByText('Shot 1')).toBeNull();+ expect(screen.getByText('No clip')).toBeTruthy();+ });++ it('writes the filter to the URL and removes it for All', () => {+ renderBoard(board(scenes));+ expect(screen.getByText('Shot 1')).toBeTruthy();+ fireEvent.click(screen.getByRole('button', { name: 'Needs attention (1)' }));+ expect(screen.getByTestId('search').textContent).toBe('?scenes=attention');+ expect(screen.queryByText('Shot 1')).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'All (3)' }));+ expect(screen.getByTestId('search').textContent).toBe('');+ });++ it('j and k step through the listed scenes', () => {+ const b = board(scenes);+ renderBoard(b);+ fireEvent.keyDown(window, { key: 'j' });+ expect(b.onToggleSceneExpand).toHaveBeenLastCalledWith('s1', true);+ const second = board(scenes, { activeSceneId: 's2' });+ renderBoard(second);+ fireEvent.keyDown(window, { key: 'k' });+ expect(second.onToggleSceneExpand).toHaveBeenLastCalledWith('s1', true);+ });+});diff --git a/client/src/components/musicVideo/stages/ProduceStage.jsx b/client/src/components/musicVideo/stages/ProduceStage.jsxindex 9e35b67ee9..89949858ce 100644--- a/client/src/components/musicVideo/stages/ProduceStage.jsx+++ b/client/src/components/musicVideo/stages/ProduceStage.jsx@@ -3,6 +3,9 @@ import ContactSheetButton from '../ContactSheetButton.jsx';import HandoffControls from '../HandoffControls.jsx';import StageSection from '../StageSection.jsx';import { GenerationActions } from '../ProjectActionGroups.jsx';+import ShotStatusStrip from '../ShotStatusStrip.jsx';+import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';+import { FOOTAGE_OPTIONAL_MODES } from '../../../lib/musicVideoStages.js';/*** Produce: the autopilot (brief, allowed routes, generation and spend caps,@@ -26,6 +29,17 @@ export default function ProduceStage({ board }) {kickoffStep={kickoff.stepLabel}kickoffBlockedReason={board.autopilotBlockedReason}/>+ {(project.scenes || []).length > 0 && (+ <StageSection title="Shot status" defaultOpen summary="Which shots still need work — tap one to open it on the Board">+ <ShotStatusStrip projectId={project.id} scenes={project.scenes} ctx={{+ layered: isLayeredComposition(project),+ footageOptional: FOOTAGE_OPTIONAL_MODES.has(project.composition?.mode || 'concat'),+ lipSyncBackend: videoSettings.audioReactiveSelected ? 'local' : videoSettings.settings.backend,+ songDurationSec: project.audioAnalysis?.durationSec ?? null,+ failed: sceneMedia.failedScenes,+ }} />+ </StageSection>+ )}<StageSection title="Generation" defaultOpen summary="Generate the frames and clips that are missing"><div className="mb-2 flex justify-end"><ContactSheetButton onOpen={board.openContactSheet} /></div><GenerationActions project={project} videoSettings={videoSettings} sceneMedia={sceneMedia} onEditServices={() => board.goToStage('setup', 'mv-setup-options')} />diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.jsindex a46a94b3ed..e473d19fc2 100644--- a/client/src/hooks/useMusicVideoSceneMedia.js+++ b/client/src/hooks/useMusicVideoSceneMedia.js@@ -116,6 +116,7 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS});const genScenes = frameLane.genScenes;const genVideoScenes = videoLane.genScenes;+ const failedScenes = { frame: frameLane.failedScenes, video: videoLane.failedScenes };const style = project?.concept?.style?.trim();const direction = [musicVideoCreativeContext(project?.concept), visualDirection(project?.visualSpec)].filter(Boolean).join('; ');@@ -383,6 +384,7 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applySreturn {genScenes,genVideoScenes,+ failedScenes,sceneProgress: frameLane.sceneProgress,videoSceneProgress: videoLane.sceneProgress,frameBatch,diff --git a/client/src/hooks/useSceneRenderLifecycle.js b/client/src/hooks/useSceneRenderLifecycle.jsindex 9add6da2b3..3e53653e56 100644--- a/client/src/hooks/useSceneRenderLifecycle.js+++ b/client/src/hooks/useSceneRenderLifecycle.js@@ -47,9 +47,10 @@ import toast from '../components/ui/Toast';* (functional setProjects update); called on `attachEvent`.* - `failMessage` — the toast string for a confirmed render failure.*- * Returns `{ genScenes, sceneProgress, startScene, clearScene, trackJob }`+ * Returns `{ genScenes, sceneProgress, failedScenes, startScene, clearScene, trackJob }`* (`sceneProgress`: sceneId → `{ progress }` once a job reports running; a scene- * in `genScenes` with no entry is still queued):+ * in `genScenes` with no entry is still queued;+ * `failedScenes` — sceneId → true after a confirmed render failure this session, until that scene renders again):* - `startScene(sceneId)` — light the spinner before the kickoff request.* - `clearScene(sceneId)` — drop the spinner (sync-lane finish, or a kickoff* that returns no trackable job id).@@ -71,6 +72,14 @@ export default function useSceneRenderLifecycle({}) {const [genScenes, setGenScenes] = useState({});const [sceneProgress, setSceneProgress] = useState({});+ // sceneId → true once a render for it failed this session (cleared when the scene renders again or succeeds).+ const [failedScenes, setFailedScenes] = useState({});+ const markFailed = useCallback((sceneId, failed) => setFailedScenes((prev) => {+ if (!!prev[sceneId] === failed) return prev;+ const next = { ...prev };+ if (failed) next[sceneId] = true; else delete next[sceneId];+ return next;+ }), []);// jobId → sceneId for renders this lane is awaiting.const pendingRef = useRef(new Map());// jobId → outcome ('completed' | 'failed' | 'canceled') for terminal events that beat their kickoff's@@ -84,8 +93,8 @@ export default function useSceneRenderLifecycle({cfgRef.current = { apply, failMessage, onSettled };const startScene = useCallback(- (sceneId) => setGenScenes((prev) => ({ ...prev, [sceneId]: true })),- [],+ (sceneId) => { markFailed(sceneId, false); setGenScenes((prev) => ({ ...prev, [sceneId]: true })); },+ [markFailed],);const clearScene = useCallback((sceneId) => setGenScenes((prev) => {@@ -110,12 +119,15 @@ export default function useSceneRenderLifecycle({orphanRef.current.delete(jobId);clearScene(sceneId);clearProgress(sceneId);- if (outcome === 'failed') toast.error(cfgRef.current.failMessage);+ if (outcome === 'failed') {+ markFailed(sceneId, true);+ toast.error(cfgRef.current.failMessage);+ }cfgRef.current.onSettled?.({ jobId, sceneId, outcome });return;}pendingRef.current.set(jobId, sceneId);- }, [clearScene, clearProgress]);+ }, [clearScene, clearProgress, markFailed]);useEffect(() => {const onAttach = (data) => cfgRef.current.apply(data);@@ -143,7 +155,10 @@ export default function useSceneRenderLifecycle({pendingRef.current.delete(jobId);clearScene(sceneId);clearProgress(sceneId);- if (failed) toast.error(cfgRef.current.failMessage);+ if (failed) {+ markFailed(sceneId, true);+ toast.error(cfgRef.current.failMessage);+ }cfgRef.current.onSettled?.({ jobId, sceneId, outcome });};const onCompleted = (data) => settle(data, false, 'completed');@@ -168,7 +183,7 @@ export default function useSceneRenderLifecycle({// the failure transition) hasn't landed yet, so it re-polls a bounded number// of times rather than toasting prematurely (the spinner is already cleared,// so giving up silently never strands the UI).- const armFailToast = (jobId, attempt = 0) => {+ const armFailToast = (jobId, sceneId, attempt = 0) => {failTimers.set(jobId, setTimeout(() => {failTimers.delete(jobId);if (!mounted) return; // navigated away before the timer fired@@ -177,10 +192,10 @@ export default function useSceneRenderLifecycle({if (!mounted) return; // unmounted while the status fetch was in flightconst status = job?.status;if (status === 'canceled') return; // user cancel — never a failure toast- if (status === 'failed' || status === 'error') { toast.error(cfgRef.current.failMessage); return; }- if (attempt < 2) armFailToast(jobId, attempt + 1); // non-terminal: wait, don't toast yet+ if (status === 'failed' || status === 'error') { markFailed(sceneId, true); toast.error(cfgRef.current.failMessage); return; }+ if (attempt < 2) armFailToast(jobId, sceneId, attempt + 1); // non-terminal: wait, don't toast yet})- .catch(() => { if (mounted) toast.error(cfgRef.current.failMessage); });+ .catch(() => { if (mounted) { markFailed(sceneId, true); toast.error(cfgRef.current.failMessage); } });}, 800));};const onFailed = (data) => {@@ -192,9 +207,10 @@ export default function useSceneRenderLifecycle({// orphan WITH the failure bit so a fast-fail that raced ahead of its own// kickoff registration is toasted by the kickoff reconciliation; an// unrelated job is simply capped/evicted from the orphan map unseen.- const owned = pendingRef.current.has(jobId);+ const ownedScene = pendingRef.current.get(jobId);+ const owned = !!ownedScene;settle(data, !owned, 'failed');- if (owned && !failTimers.has(jobId)) armFailToast(jobId);+ if (owned && !failTimers.has(jobId)) armFailToast(jobId, ownedScene);};// Queued-cancel emits no `failedEvent`; running-cancel emits failed then this.// Either way clear the spinner and cancel any pending failure toast.@@ -224,7 +240,7 @@ export default function useSceneRenderLifecycle({for (const t of failTimers.values()) clearTimeout(t);failTimers.clear();};- }, [attachEvent, completedEvent, failedEvent, canceledEvent, startedEvent, progressEvent, clearScene, clearProgress]);+ }, [attachEvent, completedEvent, failedEvent, canceledEvent, startedEvent, progressEvent, clearScene, clearProgress, markFailed]);- return { genScenes, sceneProgress, startScene, clearScene, trackJob };+ return { genScenes, sceneProgress, failedScenes, startScene, clearScene, trackJob };}diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex 9a268f80c2..42b6e7e0bf 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -64,6 +64,7 @@ grep -i "what you want to do" client/src/lib/README.md| `musicVideoBatchPlan.js` | Pure helpers for the Music Video missing-frame / missing-clip batches (#10153): `videoBatchPreview` (count + fal estimate summed from `falSceneTake`, unpriced count), `scenesWaitingForFrame`, `videosButtonLabel`, `batchSummary`, `batchActive`, `batchSceneName`. Used by `components/musicVideo/ProjectActionGroups.jsx`. || `musicVideoLayers.js` | Music-video per-scene visual layers (#8985), re-exported from `server/lib/musicVideoLayers.js`: `MUSIC_VIDEO_VISUAL_LAYERS`, `MUSIC_VIDEO_STILL_MOVES`, `sceneVisualLayer(scene, { layered })`, `sceneHasAuthoredSpan`, `sceneRenderReady(scene, { layered })`. Used by `components/musicVideo/SceneCard.jsx`, `ProjectActionGroups.jsx` and `hooks/useMusicVideoSceneMedia.js`. || `musicVideoTakes.js` | Music-video scene takes view helpers (#8965): `sceneTakeList(scene, kind)` lists a scene's image/video takes with an un-materialized pre-takes selection appended as a read-only `legacy` take; `takePreviewKey`, `takeThumbUrl`, `takeClipUrl` (hover-preview clip), `sceneHasPendingDecision` (contact-sheet filter), `takeProvenance`; `TAKE_SLOT` maps a take kind to its selection field. Used by `components/musicVideo/SceneTakeStrip.jsx` and `pages/MusicVideo.jsx`. |+| `musicVideoSceneAttention.js` | Music Video per-scene attention model (#10152): `sceneAttention(scene, ctx)` returns the codes (`missing-frame`, `missing-clip`, `under-covered`, `contract-problem`, `perf-blocked`, `candidates-pending`, `plate-unverified`, `no-span`, `last-failure`) behind the collapsed scene-row chips, the Board `?scenes=attention\|missing\|all` filter (`parseSceneFilter`, `sceneMatchesFilter`) and the Produce per-shot strip; `SCENE_ATTENTION_LABELS`. Used by `components/musicVideo/SceneCard.jsx`, `stages/BoardStage.jsx` and `stages/ProduceStage.jsx`. || `musicVideoShotTiming.js` | Re-export of `server/lib/musicVideoShotTiming.js` (#8977) — shot modes, the verified source-audio lip-sync capability table, `performanceBlockedReason`, `planPerformanceRepair` (measured accepted-prefix boundary, suffix interval and next spend), `planPerformanceWindow`, `grokCoverage`, `approximateMotionCues`, `shotSplitLimit` (when a scene offers a lyric-boundary split), `falSceneTake` (a fal take's model, length, resolution and estimated cost). Used by `hooks/useMusicVideoSceneMedia.js` and `components/musicVideo/SceneCard.jsx`. || `musicVideoStages.js` | Music Video page stage model: `MUSIC_VIDEO_STAGES` (setup → cast-sets → board → produce → compose → review), `resolveStageParam(value)` for the `:stage` route param, `deriveStages(project)` (per-stage `done`/`active`/`blocked`/`todo` + `current`, the first incomplete stage; a live production run pins Produce), `deriveNextAction(project, ctx)` (the one primary action the sticky header offers — approve Cast & Sets, stop/resume production, render final, …), `projectSpend(project)` (paid generation used vs. cap), `projectShotSummary(project)` (document shots or scene counts), `stageChecklist(stageId, project, readiness)` (what one stage tab still needs, with the open approval's reason and a scroll anchor), `projectServicesSummary(project)` (the saved image/video render services), `compareMusicVideoProjectsNewestFirst(a, b)` (sort projects newest created / updated first for project cards and pickers), and `currentProductionRun`; `productionReviewStopGuidance` separates current approval blockers from historical run stops. Used by `components/musicVideo/MusicVideoLayout.jsx` and `pages/MusicVideo.jsx`. || `musicVideoAttention.js` | Music Video "Needs attention" model (#9940): `deriveAttentionItems(project, live)` returns the banner rows for server-held states a client-orchestrated workflow can strand — an open/rendering revision, an interrupted Cast & Sets stage, a running auto-review waiting on its revised sections, a final render nobody is watching — derived from the persisted record so they survive a reload (healthy work this tab can see progressing is not flagged); `openRevisionOf(project)`; `ATTENTION_ANCHOR_ID` + `revealAttention()` scroll a refusal toast to the banner. Used by `components/musicVideo/NeedsAttentionBanner.jsx` and `pages/MusicVideo.jsx`. |diff --git a/client/src/lib/index.js b/client/src/lib/index.jsindex 61b074b4f4..c45f46844a 100644--- a/client/src/lib/index.js+++ b/client/src/lib/index.js@@ -74,6 +74,7 @@ export * from './musicVideoLayers.js';export * from './musicVideoAspect.js';export * from './musicVideoMotion.js';export * from './musicVideoTakes.js';+export * from './musicVideoSceneAttention.js';export * from './musicVideoShotTiming.js';export * from './musicVideoStages.js';export * from './musicVideoAttention.js';diff --git a/client/src/lib/musicVideoSceneAttention.js b/client/src/lib/musicVideoSceneAttention.jsnew file mode 100644index 0000000000..34eb3b55e6--- /dev/null+++ b/client/src/lib/musicVideoSceneAttention.js@@ -0,0 +1,81 @@+/**+ * Music Video per-scene "what is wrong with this shot" model (#10152).+ *+ * One pure answer shared by the collapsed scene row (chips), the Board filter+ * (counts and the `?scenes=` view) and the Produce status strip, so the three+ * never disagree about which shots need work. Each code names a condition the+ * expanded card already surfaced; this lifts them to where the director scans.+ */+import { shotActionContractProblem } from '../../../server/lib/musicVideoActionContract.js';+import { currentPlateEvidence } from '../../../server/lib/musicVideoPlateEvidence.js';+import { sceneVisualLayer, sceneHasAuthoredSpan } from './musicVideoLayers.js';+import { performanceBlockedReason, performanceCapability, planPerformanceWindow, isPerformanceScene } from './musicVideoShotTiming.js';+import { sceneHasPendingDecision, sceneTakeList } from './musicVideoTakes.js';++// Mirrors render.js COVERAGE_TOLERANCE_SEC (#8964): a non-looping shot may run this far past its clip.+export const COVERAGE_TOLERANCE_SEC = 0.25;++export const SCENE_ATTENTION_LABELS = Object.freeze({+ 'missing-frame': 'No frame',+ 'missing-clip': 'No clip',+ 'under-covered': 'Clip too short',+ 'contract-problem': 'Shot intent problem',+ 'perf-blocked': 'Performance blocked',+ 'candidates-pending': 'Takes to review',+ 'plate-unverified': 'Plate unverified',+ 'no-span': 'No time span',+ 'last-failure': 'Last render failed',+});++/** Codes that mean the shot still lacks material a render needs (the `missing` filter). */+export const SCENE_MISSING_CODES = Object.freeze(['missing-frame', 'missing-clip', 'no-span']);++export const SCENE_FILTERS = Object.freeze(['all', 'attention', 'missing']);++/** The `?scenes=` value as a filter id; anything unknown is `all`. */+export const parseSceneFilter = (value) => (SCENE_FILTERS.includes(value) ? value : 'all');++function performanceBlocked(scene, { lipSyncBackend, songDurationSec }) {+ const capability = performanceCapability(lipSyncBackend);+ if (!capability) return performanceBlockedReason(lipSyncBackend);+ const plan = planPerformanceWindow({ startSec: scene.startSec, endSec: scene.endSec, songDurationSec: songDurationSec ?? Infinity, capability });+ return plan.ok ? null : plan.message;+}++/**+ * The attention codes for one scene, in display order (empty = nothing to do).+ * ctx: `layered`, `footageOptional` (a mode whose shots need no clip),+ * `lipSyncBackend`, `songDurationSec`, `clipSec` (the measured clip length —+ * only a mounted card knows it, so board-level counts omit `under-covered`),+ * and `failed: { frame: {sceneId: true}, video: {sceneId: true} }` for renders+ * that failed this session.+ */+export function sceneAttention(scene, ctx = {}) {+ if (!scene) return [];+ const { layered = false, footageOptional = false, lipSyncBackend = '', songDurationSec = null, clipSec = null, failed = {} } = ctx;+ const layer = sceneVisualLayer(scene, { layered });+ const codes = [];+ if (layer !== 'card' && !scene.referenceImageId) codes.push('missing-frame');+ if (layer === 'footage' && !footageOptional && !scene.videoHistoryId) codes.push('missing-clip');+ if (layer !== 'footage' && !sceneHasAuthoredSpan(scene)) codes.push('no-span');+ if (layer === 'footage' && scene.loop === false && scene.beatAligned && clipSec != null+ && typeof scene.startSec === 'number' && typeof scene.endSec === 'number'+ && scene.endSec - scene.startSec - clipSec > COVERAGE_TOLERANCE_SEC) codes.push('under-covered');+ const contract = scene.direction?.actionContract;+ if (contract && shotActionContractProblem(contract, scene)) codes.push('contract-problem');+ if (layer === 'footage' && isPerformanceScene(scene) && performanceBlocked(scene, { lipSyncBackend, songDurationSec })) codes.push('perf-blocked');+ if (sceneHasPendingDecision(scene)) codes.push('candidates-pending');+ if (contract && scene.referenceImageId) {+ const selected = sceneTakeList(scene, 'image').find((take) => take.assetId === scene.referenceImageId);+ if (currentPlateEvidence(scene, selected)?.verdict !== 'pass') codes.push('plate-unverified');+ }+ if (failed.frame?.[scene.sceneId] || failed.video?.[scene.sceneId]) codes.push('last-failure');+ return codes;+}++/** Does `scene` belong in the given board filter? `codes` is its `sceneAttention` result. */+export function sceneMatchesFilter(codes, filter) {+ if (filter === 'attention') return codes.length > 0;+ if (filter === 'missing') return codes.some((code) => SCENE_MISSING_CODES.includes(code));+ return true;+}diff --git a/client/src/lib/musicVideoSceneAttention.test.js b/client/src/lib/musicVideoSceneAttention.test.jsnew file mode 100644index 0000000000..d05a212523--- /dev/null+++ b/client/src/lib/musicVideoSceneAttention.test.js@@ -0,0 +1,52 @@+import { describe, expect, it } from 'vitest';+import { parseSceneFilter, sceneAttention, sceneMatchesFilter } from './musicVideoSceneAttention.js';++const ready = { sceneId: 's', order: 0, referenceImageId: 'f.png', videoHistoryId: 'v1', startSec: 0, endSec: 4, takes: [] };++describe('sceneAttention', () => {+ it('is empty for a shot with its frame and clip', () => {+ expect(sceneAttention(ready)).toEqual([]);+ });++ it('flags missing frame and clip, but not a clip in a footage-optional mode', () => {+ expect(sceneAttention({ sceneId: 's' })).toEqual(['missing-frame', 'missing-clip']);+ expect(sceneAttention({ sceneId: 's', referenceImageId: 'f.png' }, { footageOptional: true })).toEqual([]);+ });++ it('flags a still or card with no span only in a layered composition', () => {+ const still = { ...ready, visualLayer: 'still', startSec: null, endSec: null };+ expect(sceneAttention(still, { layered: true })).toEqual(['no-span']);+ expect(sceneAttention(still, { layered: false })).toEqual([]);+ expect(sceneAttention({ sceneId: 's', visualLayer: 'card', startSec: 1, endSec: 3 }, { layered: true })).toEqual([]);+ });++ it('flags a non-looping beat-aligned shot longer than its measured clip', () => {+ const shot = { ...ready, loop: false, beatAligned: true, endSec: 10 };+ expect(sceneAttention(shot, { clipSec: 5 })).toEqual(['under-covered']);+ expect(sceneAttention(shot, { clipSec: 9.9 })).toEqual([]);+ expect(sceneAttention(shot)).toEqual([]);+ expect(sceneAttention({ ...shot, loop: true }, { clipSec: 5 })).toEqual([]);+ });++ it('flags a blocked performance, pending candidates, failures and an unverified plate', () => {+ const performance = { ...ready, shotMode: 'performance' };+ expect(sceneAttention(performance, { lipSyncBackend: 'local' })).toContain('perf-blocked');+ expect(sceneAttention({ ...ready, takes: [{ takeId: 't1', kind: 'image', assetId: 'g.png', status: 'candidate' }] })).toEqual(['candidates-pending']);+ expect(sceneAttention(ready, { failed: { video: { s: true } } })).toEqual(['last-failure']);+ const withIntent = { ...ready, direction: { actionContract: { purpose: 'Singer turns toward the door' } },+ takes: [{ takeId: 't1', kind: 'image', assetId: 'f.png', status: 'selected' }] };+ expect(sceneAttention(withIntent)).toContain('plate-unverified');+ });+});++describe('scene filters', () => {+ it('parses unknown values as all and splits missing from other attention', () => {+ expect(parseSceneFilter('nope')).toBe('all');+ expect(parseSceneFilter('missing')).toBe('missing');+ expect(sceneMatchesFilter(['last-failure'], 'attention')).toBe(true);+ expect(sceneMatchesFilter(['last-failure'], 'missing')).toBe(false);+ expect(sceneMatchesFilter(['missing-clip'], 'missing')).toBe(true);+ expect(sceneMatchesFilter([], 'attention')).toBe(false);+ expect(sceneMatchesFilter([], 'all')).toBe(true);+ });+});diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.jsindex feef9ecb5b..123b154ab7 100644--- a/client/src/lib/musicVideoStages.js+++ b/client/src/lib/musicVideoStages.js@@ -239,7 +239,7 @@ export function publishPlatformProgress(project, publish = {}) {export const resolveStageParam = (value) => (isStageId(value) ? value : null);// Footage-optional modes draw their own picture, so scene footage never gates Produce.-const FOOTAGE_OPTIONAL_MODES = new Set(['code', 'document', 'eidoverse']);+export const FOOTAGE_OPTIONAL_MODES = new Set(['code', 'document', 'eidoverse']);// A code video is composed once it was generated or the director holds sections to render.const codeComposed = (project) => {@@ -556,7 +556,7 @@ export function stageChecklist(stageId, project, readiness = project?.productionconst ready = scenes.filter((scene) => sceneRenderReady(scene, { layered })).length;const footageDone = scenes.length > 0 && ready === scenes.length;return [{ id: 'footage', label: `Footage for every shot (${formatCount(ready)} of ${formatCount(scenes.length)})`, done: footageDone,- action: footageDone ? null : { label: 'Set up production', anchor: 'mv-production-start' } }];+ action: footageDone ? null : { label: 'Show shots missing footage', stage: 'board', params: { scenes: 'missing' }, anchor: 'mv-scene-board' } }];}case 'compose': {// The proof closes Compose: it is judged over the finished composition (see deriveStages).diff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.jsindex 91fcdb968c..fc42498bb1 100644--- a/client/src/lib/musicVideoStages.test.js+++ b/client/src/lib/musicVideoStages.test.js@@ -408,7 +408,8 @@ describe('stageChecklist', () => {expect(stageChecklist('board', castProject({ scenes: [scene()] }), NOT_APPROVED).map((i) => [i.id, i.done])).toEqual([['shots', true], ['board-art', false], ['approve-storyboard', false]]);expect(stageChecklist('produce', castProject({ scenes: [scene(), scene({ sceneId: 's2', videoHistoryId: null })] }), APPROVED)[0])- .toMatchObject({ id: 'footage', label: 'Footage for every shot (1 of 2)', done: false });+ .toMatchObject({ id: 'footage', label: 'Footage for every shot (1 of 2)', done: false,+ action: { stage: 'board', params: { scenes: 'missing' } } });// A code render draws its own picture: no footage to wait on.expect(stageChecklist('produce', castProject({ composition: { mode: 'code' } }), APPROVED).map((i) => [i.id, i.done])).toEqual([['footage', true]]);// The proof closes Compose, after the composition work it is judged over.diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 24004044f5..c03db069a8 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -936,9 +936,11 @@ export default function MusicVideo() {const focusable = el.matches('[tabindex], button, input, select, textarea, a') ? el : el.querySelector('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a');focusable?.focus?.({ preventScroll: true });}, [activeStage, location.key, selectedId, !!selected]);- const goToStage = (stage, anchor = null) => {- // Preserve search params (e.g. ?play=, ?new=, ?sheet=) across tabs.- const search = searchParams.toString();+ const goToStage = (stage, anchor = null, params = null) => {+ // Preserve search params (e.g. ?play=, ?new=, ?sheet=) across tabs; `params` sets more (e.g. ?scenes=missing).+ const next = new URLSearchParams(searchParams);+ for (const [key, value] of Object.entries(params || {})) next.set(key, value);+ const search = next.toString();navigate(`/music-video/${encodeURIComponent(selected.id)}/${stage}${search ? `?${search}` : ''}${anchor ? `#${anchor}` : ''}`, { replace: activeStage === stage });};@@ -1441,7 +1443,7 @@ export default function MusicVideo() {><StageChecklistitems={stageChecklist(activeStage, selected, productionReview.readiness, publish)}- onAction={(action) => goToStage(action.stage || activeStage, action.anchor)}+ onAction={(action) => goToStage(action.stage || activeStage, action.anchor, action.params)}headerAnchor={nextAction?.kind === 'goto' ? nextAction.anchor : null}/>{APPROVAL_STAGE_BY_TAB[activeStage] && (