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([issue-3718]): open music-video frames, clips, and final render in MediaLightbox
[._.]/ Adam Eivy201b38270839
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 509c188db3..27599446d7 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -1,5 +1,9 @@# Unreleased+## Music Video++- **[issue-3718] Scene frames, scene clips, and the final render open full-size in the shared media lightbox.** The scene board no longer traps generated media at thumbnail size — click a reference frame, or the expand control on a clip or the finished render, to inspect it full-size with prev/next across every asset in the project and a deep-linkable URL. Clip and final-render expand controls sit in the corner so the inline players' play/pause still work; the final render uses its real resolved filename so a `music-video-*.mp4` plays instead of a 404.+## Stability- **[issue-3703] A worktree agent is no longer failed for commits it didn't write.** The primary-checkout guard used to fail any worktree agent whose run window overlapped commits landing on the shared primary checkout — but a concurrent coding-on-main agent, your own terminal, or `update.sh`'s pull can move it too, so read-only reasoners and correctly-behaved agents were being blamed and escalated to you. The guard now attributes the stranded commits by patch-id (`git cherry`, so a cherry-picked or rebased copy still counts) to the agent's own branch: only commits actually traceable to that agent fail the run. Everything else is warn-logged — the unreviewed commits on the primary are still surfaced — but a run that didn't cause them stays a success.diff --git a/client/src/components/musicVideo/RenderStatusPanel.jsx b/client/src/components/musicVideo/RenderStatusPanel.jsxindex 31b63bf733..0240060471 100644--- a/client/src/components/musicVideo/RenderStatusPanel.jsx+++ b/client/src/components/musicVideo/RenderStatusPanel.jsx@@ -1,11 +1,19 @@-import { Film, Download } from 'lucide-react';-import { useVideoFileSrc } from '../../hooks/useVideoFileSrc.js';+import { Film, Download, Maximize2 } from 'lucide-react';// The final-render surface: a progress bar while the assemble job runs, and the// finished MP4 (inline player + download + Media History deep link) once the// project carries a renderHistoryId.-export default function RenderStatusPanel({ rendering, progress, renderHistoryId }) {- const finalVideo = useVideoFileSrc(renderHistoryId, { enabled: !!renderHistoryId });+//+// `finalVideo` is resolved by the page (`useVideoFileSrc`) so MusicVideo can+// also build the lightbox item from the real filename — the final render's+// history id is NOT its filename stem (`music-video-*.mp4`), so reconstructing+// `/data/videos/<id>.mp4` 404s. `onOpenPreview(key)` opens the page-level+// MediaLightbox; the expand control sits in the player corner so native+// play/pause keeps working. "Open in Media History →" stays — it goes to the+// full history grid, not the same-page lightbox.+export default function RenderStatusPanel({+ rendering, progress, renderHistoryId, finalVideo, onOpenPreview,+}) {if (rendering) {return (<div className="mt-2">@@ -24,7 +32,7 @@ export default function RenderStatusPanel({ rendering, progress, renderHistoryId<Film size={15} className="text-port-success" /> Final music video</span><div className="flex items-center gap-2 text-xs">- {finalVideo.src && (+ {finalVideo?.src && (<ahref={finalVideo.src}download@@ -37,22 +45,33 @@ export default function RenderStatusPanel({ rendering, progress, renderHistoryIdclassName="text-port-accent">Open in Media History →</a></div></div>- {finalVideo.resolving && <p className="text-xs text-port-text-muted">Loading final video…</p>}- {finalVideo.src && (+ {finalVideo?.resolving && <p className="text-xs text-port-text-muted">Loading final video…</p>}+ {finalVideo?.src && (// aspect-video reserves the box before the video's intrinsic dimensions// resolve, so the actions above it don't jump — same as the scene// thumbnails below. The render inherits its first scene clip's// dimensions, which are not always 16:9, so object-contain is explicit:// a 3:2 cut letterboxes inside the reserved box (against the player's// own black) instead of being stretched to fill it.- <video- src={finalVideo.src}- controls- playsInline- preload="metadata"- className="w-full aspect-video max-h-[65vh] object-contain rounded bg-black border border-port-border"- aria-label="Play final music video"- />+ <div className="relative">+ <video+ src={finalVideo.src}+ controls+ playsInline+ preload="metadata"+ className="w-full aspect-video max-h-[65vh] object-contain rounded bg-black border border-port-border"+ aria-label="Play final music video"+ />+ <button+ type="button"+ onClick={() => onOpenPreview?.(`mv-render:${renderHistoryId}`)}+ aria-label="View final video full size"+ title="View final video full size"+ className="absolute top-2 right-2 p-1.5 rounded bg-black/50 text-white hover:bg-black/80 focus:outline-none focus:ring-2 focus:ring-port-accent"+ >+ <Maximize2 className="w-3.5 h-3.5" />+ </button>+ </div>)}</div>);diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex 6980103f53..3a541a1844 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -1,4 +1,4 @@-import { Trash2, Activity, ArrowUp, ArrowDown, Image as ImageIcon, Video } from 'lucide-react';+import { Trash2, Activity, ArrowUp, ArrowDown, Image as ImageIcon, Video, Maximize2 } from 'lucide-react';import { formatDurationSec } from '../../utils/formatters.js';// The two timeline-bound scene fields rendered as identical number inputs.@@ -8,12 +8,18 @@ const SCENE_TIME_FIELDS = [['Start', 'startSec'], ['End', 'endSec']];* One scene on the board: ordering/delete, the shot + reference-frame prompts* (optimistic local edit, PATCH on blur), the authored timeline span, and the* per-scene reference-frame / clip render controls.+ *+ * `onOpenPreview(key)` opens the page-level MediaLightbox for a frame+ * (`mv-frame:<id>`) or clip (`mv-clip:<id>`). The frame thumb is the whole+ * button; the clip keeps native play/pause and uses a corner expand control+ * so the open handler never fights the player.*/export default function SceneCard({scene, index, isLast, generatingFrame, generatingVideo,settingsSaving, videoBlocked, canContinueShot,onMove, onDelete, onEditLocal, onSave,onGenerateFrame, onGenerateVideo, onContinueVideo,+ onOpenPreview,}) {return (<div className="bg-port-card border border-port-border rounded-lg p-3 space-y-2">@@ -72,8 +78,19 @@ export default function SceneCard({/><div className="flex items-center gap-2">{scene.referenceImageId && (- <img src={`/data/images/${scene.referenceImageId}`} alt="Reference frame"- className="w-32 aspect-video object-cover rounded border border-port-border" />+ <button+ type="button"+ onClick={() => onOpenPreview?.(`mv-frame:${scene.referenceImageId}`)}+ aria-label="View reference frame full size"+ title="View reference frame full size"+ className="shrink-0 rounded border border-port-border overflow-hidden focus:outline-none focus:ring-2 focus:ring-port-accent"+ >+ <img+ src={`/data/images/${scene.referenceImageId}`}+ alt=""+ className="w-32 aspect-video object-cover block"+ />+ </button>)}<button onClick={() => onGenerateFrame(scene)} disabled={!!generatingFrame}className="flex items-center gap-1 bg-port-border hover:bg-port-border/70 disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0 whitespace-nowrap"@@ -86,9 +103,28 @@ export default function SceneCard({{/* Scene clip — i2v video generated from the reference frame (Phase 1) */}<div className="flex items-center gap-2 flex-wrap">{scene.videoHistoryId && (- <video src={`/data/videos/${scene.videoHistoryId}.mp4`}- className="w-40 aspect-video object-cover rounded border border-port-border bg-black"- muted playsInline preload="metadata" controls />+ <div className="relative w-40 shrink-0">+ <video+ src={`/data/videos/${scene.videoHistoryId}.mp4`}+ className="w-full aspect-video object-cover rounded border border-port-border bg-black"+ muted+ playsInline+ preload="metadata"+ controls+ />+ {/* Corner expand — do not put the open handler on <video> itself;+ that would fight native play/pause controls. Shape matches+ ScenePreview's open-in-new-tab overlay. */}+ <button+ type="button"+ onClick={() => onOpenPreview?.(`mv-clip:${scene.videoHistoryId}`)}+ aria-label="View clip full size"+ title="View clip full size"+ className="absolute top-1 right-1 p-1 rounded bg-black/50 text-white hover:bg-black/80 focus:outline-none focus:ring-2 focus:ring-port-accent"+ >+ <Maximize2 className="w-3 h-3" />+ </button>+ </div>)}<button onClick={() => onGenerateVideo(scene)}disabled={settingsSaving || !scene.referenceImageId || !!generatingVideo || videoBlocked}diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex cc6c8eb801..e9246dcfee 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -1,4 +1,4 @@-import { useEffect, useState, useCallback } from 'react';+import { useEffect, useState, useCallback, useMemo } from 'react';import { useParams, useNavigate } from 'react-router';import { Plus, Film } from 'lucide-react';import toast from '../components/ui/Toast';@@ -23,6 +23,9 @@ import useMusicVideoRenderJob from '../hooks/useMusicVideoRenderJob.js';import useMusicVideoModelSettings from '../hooks/useMusicVideoModelSettings.js';import useMusicVideoManualTempo from '../hooks/useMusicVideoManualTempo.js';import useMusicVideoSceneMedia from '../hooks/useMusicVideoSceneMedia.js';+import usePreviewRoute from '../hooks/usePreviewRoute.js';+import { useVideoFileSrc } from '../hooks/useVideoFileSrc.js';+import MediaPreview from '../components/media/MediaPreview.jsx';import MidiInstallModal from '../components/install/MidiInstallModal.jsx';import MidiGatedModal from '../components/install/MidiGatedModal.jsx';import { listTracks } from '../services/apiTracks.js';@@ -34,6 +37,7 @@ import RenderStatusPanel from '../components/musicVideo/RenderStatusPanel.jsx';import AnalysisPanel from '../components/musicVideo/AnalysisPanel.jsx';import SceneCard from '../components/musicVideo/SceneCard.jsx';import { autoArrangeScenes } from '../lib/beatGrid.js';+import { videoSrcForJob, videoPosterForJob } from '../lib/creativeDirectorPreview.js';const STATUS_COLORS = {draft: 'bg-port-border text-port-text',@@ -354,10 +358,65 @@ export default function MusicVideo() {&& videoSettings.activeModel?.runtime === 'ltx2';const videoBlocked = videoSettings.audioReactiveSelected && !videoSettings.audioReactiveReady;+ // Final render filename is NOT the history id — resolve once at page level so+ // the lightbox item and the inline player share the same lookup (#3718).+ const finalVideo = useVideoFileSrc(selected?.renderHistoryId, {+ enabled: !!selected?.renderHistoryId,+ });++ // Shared lightbox: final render first (it sits above the board), then each+ // scene's frame then clip in board order. Keys are stable deep-link ids+ // (`?preview=mv-frame:…` / `mv-clip:…` / `mv-render:…`).+ const previewItems = useMemo(() => {+ if (!selected) return [];+ const items = [];+ if (selected.renderHistoryId && finalVideo.src) {+ items.push({+ key: `mv-render:${selected.renderHistoryId}`,+ kind: 'video',+ filename: finalVideo.src.split('/').pop() || selected.renderHistoryId,+ downloadUrl: finalVideo.src,+ previewUrl: videoPosterForJob(selected.renderHistoryId),+ prompt: `Music Video: ${selected.name}`,+ });+ }+ for (const scene of selected.scenes || []) {+ if (scene.referenceImageId) {+ const imgUrl = `/data/images/${scene.referenceImageId}`;+ items.push({+ key: `mv-frame:${scene.referenceImageId}`,+ kind: 'image',+ filename: scene.referenceImageId,+ previewUrl: imgUrl,+ downloadUrl: imgUrl,+ prompt: scene.framePrompt || scene.prompt || '',+ });+ }+ if (scene.videoHistoryId) {+ items.push({+ key: `mv-clip:${scene.videoHistoryId}`,+ kind: 'video',+ filename: `${scene.videoHistoryId}.mp4`,+ downloadUrl: videoSrcForJob(scene.videoHistoryId),+ previewUrl: videoPosterForJob(scene.videoHistoryId),+ prompt: scene.prompt || '',+ });+ }+ }+ return items;+ }, [selected, finalVideo.src]);+ const [preview, setPreview] = usePreviewRoute(previewItems);+ const openPreview = useCallback((key) => {+ if (!key) return;+ const match = previewItems.find((i) => i.key === key);+ if (match) setPreview(match);+ }, [previewItems, setPreview]);+return (<div className="space-y-4"><MidiInstallModal {...midi.installGate} /><MidiGatedModal {...midi.gatedGate} />+ <MediaPreview preview={preview} setPreview={setPreview} items={previewItems} /><PageHeader icon={Film} title="Music Video" subtitle="Director-controlled, beat-aware music videos" /><CreateProjectDrawer@@ -479,6 +538,8 @@ export default function MusicVideo() {rendering={!!renderJob.job}progress={renderJob.progress}renderHistoryId={selected.renderHistoryId}+ finalVideo={finalVideo}+ onOpenPreview={openPreview}/><AnalysisPanelaudioAnalysis={selected.audioAnalysis}@@ -518,6 +579,7 @@ export default function MusicVideo() {onGenerateFrame={sceneMedia.generateFrame}onGenerateVideo={sceneMedia.generateSceneVideo}onContinueVideo={sceneMedia.continueSceneVideo}+ onOpenPreview={openPreview}/>))}</div>diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 6988ac66b1..1259762135 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -759,3 +759,59 @@ describe('MusicVideo YouTube audio import (#1945)', () => {expect(editInput).toHaveProperty('disabled', true);});});++// Shared MediaLightbox for scene frames, scene clips, and the final render (#3718).+// View-only — no remix/clean action handlers. Keys are deep-linkable via ?preview=.+describe('MusicVideo media lightbox (#3718)', () => {+ const renderMVAt = (path) => render(+ <MemoryRouter initialEntries={[path]}>+ <Routes>+ <Route path="/music-video" element={<MusicVideo />} />+ <Route path="/music-video/:projectId" element={<MusicVideo />} />+ </Routes>+ </MemoryRouter>,+ );++ it('opens the lightbox from a reference-frame thumbnail click', async () => {+ await openProject(PROJECT_WITH_CLIP);+ fireEvent.click(await screen.findByRole('button', { name: 'View reference frame full size' }));+ const dialog = await screen.findByRole('dialog', { name: /Media viewer/i });+ expect(dialog).toBeTruthy();+ // Image uses previewUrl (/data/images/<id>); img may be MediaImage-wrapped.+ expect(dialog.querySelector('img')?.getAttribute('src') || dialog.innerHTML)+ .toMatch(/\/data\/images\/img1/);+ });++ it('opens the lightbox from a scene-clip expand control without hijacking play/pause', async () => {+ await openProject(PROJECT_WITH_CLIP);+ // Inline thumb keeps its own controls attribute for native play/pause.+ const inlineVideo = document.querySelector('video[src="/data/videos/h1.mp4"]');+ expect(inlineVideo).toBeTruthy();+ expect(inlineVideo.hasAttribute('controls')).toBe(true);++ fireEvent.click(await screen.findByRole('button', { name: 'View clip full size' }));+ const dialog = await screen.findByRole('dialog', { name: /Media viewer/i });+ const lightboxVideo = dialog.querySelector('video');+ expect(lightboxVideo?.getAttribute('src')).toBe('/data/videos/h1.mp4');+ });++ it('opens the final render from the resolved filename, not the history-id reconstruction', async () => {+ // listVideoHistory is mocked → { id: 'rh-9', filename: 'final.mp4' }; the+ // final-render id is NOT its filename stem, so /data/videos/rh-9.mp4 404s.+ await openProject({ ...PROJECT_WITH_CLIP, renderHistoryId: 'rh-9' });+ const expand = await screen.findByRole('button', { name: 'View final video full size' });+ fireEvent.click(expand);+ const dialog = await screen.findByRole('dialog', { name: /Media viewer/i });+ const lightboxVideo = dialog.querySelector('video');+ expect(lightboxVideo?.getAttribute('src')).toBe('/data/videos/final.mp4');+ expect(lightboxVideo?.getAttribute('src')).not.toBe('/data/videos/rh-9.mp4');+ });++ it('opens the lightbox from a ?preview= deep link on mount', async () => {+ listMusicVideoProjects.mockResolvedValue([PROJECT_WITH_CLIP]);+ renderMVAt('/music-video/mv-1?preview=mv-frame%3Aimg1');+ await screen.findByRole('heading', { level: 2, name: PROJECT_WITH_CLIP.name });+ const dialog = await screen.findByRole('dialog', { name: /Media viewer/i });+ expect(dialog.getAttribute('aria-label')).toMatch(/img1|mv-frame:img1/);+ });+});