Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: show a music-library load error with Retry in the launch-video form (#12804)

[._.]/ Adam Eivy0d78241a26f0
diff --git a/client/src/components/apps/LaunchVideoPanel.jsx b/client/src/components/apps/LaunchVideoPanel.jsx
index 016c085dbd..5937ffff31 100644
--- a/client/src/components/apps/LaunchVideoPanel.jsx
+++ b/client/src/components/apps/LaunchVideoPanel.jsx
@@ -21,6 +21,7 @@ import { trackAudioUrl } from '../../services/apiTracks';
import { formatBytes, formatDateTime, formatDurationSec, formatLoudness } from '../../utils/formatters';
import toast from '../ui/Toast';
+const fetchTracks = () => listPipelineMusicLibrary({ silent: true }).then(result => result.tracks);
const fetchSkillPacks = () => getMotionToolkit({ silent: true }).then(result => result.skillPacks);
const inputClass = 'w-full rounded border border-port-border bg-port-bg p-2 text-port-text';
const buttonClass = 'rounded bg-port-accent px-3 py-2 text-white disabled:opacity-50';
@@ -64,7 +65,7 @@ function LaunchVideoForm({ appId, onQueued }) {
const [generateMusic, setGenerateMusic] = useState(false);
const [musicMethod, setMusicMethod] = useState('agent');
const [musicTrack, setMusicTrack] = useState('');
- const [tracks, setTracks] = useState(null);
+ const { items: tracks, state: tracksState, error: tracksError, retry: retryTracks } = useListResource(fetchTracks);
// A style reference (#8961): either an existing Media History image/video
// (`source: 'gallery'`) or a fresh upload into the generic uploads store
// (`source: 'upload'`) — kept out of the gallery so a one-off reference
@@ -77,13 +78,6 @@ function LaunchVideoForm({ appId, onQueued }) {
const submitting = useRef(false);
const picker = useRunWithPicker();
- useEffect(() => {
- let active = true;
- listPipelineMusicLibrary({ silent: true }).then(result => {
- if (active) setTracks(result.tracks);
- }).catch(err => { if (active) { setTracks([]); setError(err.message); } });
- return () => { active = false; };
- }, []);
const installedSkills = skillPacks.filter(pack => pack.found.length);
const consultSkills = motionSkills && installedSkills.length > 0;
@@ -226,9 +220,10 @@ function LaunchVideoForm({ appId, onQueued }) {
</div>}
{music && !generateMusic && <fieldset className="space-y-2">
<legend>Music-library track</legend>
- {tracks === null && <p className="text-sm text-port-text-muted">Loading tracks…</p>}
- {tracks?.length === 0 && <p>Add a track to the Music library first.</p>}
- {!!tracks?.length && <ul className="max-h-80 space-y-2 overflow-y-auto">
+ {tracksState === 'loading' && <p className="text-sm text-port-text-muted">Loading tracks…</p>}
+ {tracksState === 'error' && <ListLoadError what="the music library" error={tracksError} onRetry={retryTracks} />}
+ {tracksState === 'ready' && tracks.length === 0 && <p>Add a track to the Music library first.</p>}
+ {tracksState === 'ready' && tracks.length > 0 && <ul className="max-h-80 space-y-2 overflow-y-auto">
{tracks.map((track, index) => {
const id = `launch-track-${index}`;
const name = track.label || track.filename;
diff --git a/client/src/components/apps/LaunchVideoPanel.test.jsx b/client/src/components/apps/LaunchVideoPanel.test.jsx
index c320bfd80d..e9b6c34fb1 100644
--- a/client/src/components/apps/LaunchVideoPanel.test.jsx
+++ b/client/src/components/apps/LaunchVideoPanel.test.jsx
@@ -2,10 +2,12 @@ import { describe, it, expect, vi } from 'vitest';
import { render, screen, fireEvent, waitFor, within } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
import LaunchVideoPanel from './LaunchVideoPanel';
+import { listPipelineMusicLibrary } from '../../services/apiPipeline';
import { createAppLaunchVideo, getAppLaunchVideos, getMotionToolkit, installMotionSkills, publishAppLaunchVideo } from '../../services/apiApps';
vi.mock('../../services/apiApps', () => ({ getAppLaunchVideos: vi.fn(async () => ({ videos: [] })), createAppLaunchVideo: vi.fn(), publishAppLaunchVideo: vi.fn(),
getMotionToolkit: vi.fn(async () => ({ ffmpeg: true, skillPacks: [] })), installMotionSkills: vi.fn() }));
-vi.mock('../../services/apiPipeline', () => ({ listPipelineMusicLibrary: async () => ({ tracks: [{ filename: 'track-1a2b.wav', label: 'Example track', sizeBytes: 2048, updatedAt: '2026-01-01T00:00:00.000Z' }] }) }));
+const exampleTracks = { tracks: [{ filename: 'track-1a2b.wav', label: 'Example track', sizeBytes: 2048, updatedAt: '2026-01-01T00:00:00.000Z' }] };
+vi.mock('../../services/apiPipeline', () => ({ listPipelineMusicLibrary: vi.fn(async () => exampleTracks) }));
// The shared Film style picker reads the catalog through the api barrel.
vi.mock('../../services/api', () => ({
listFilmStyles: vi.fn(async () => [{ id: 'example-style', label: 'Example style', summary: 'A fixture style.', nativeMoves: [] }]),
@@ -102,6 +104,18 @@ describe('launch video drawer', () => {
expect(createAppLaunchVideo.mock.calls[0][1].format).toBeUndefined();
});
+ it('reports a failed music-library read with Retry instead of "Add a track first"', async () => {
+ listPipelineMusicLibrary.mockRejectedValueOnce(new Error('library unreachable'));
+ renderPanel('/?launchVideo=true');
+ fireEvent.click(screen.getByLabelText('Include music'));
+
+ expect(await screen.findByRole('alert')).toHaveTextContent(/could not load the music library.*library unreachable/i);
+ expect(screen.queryByText(/Add a track to the Music library first/)).toBeNull();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByRole('radio', { name: /Example track/ })).toBeTruthy();
+ });
+
it('sends the chosen film style grammar with the launch video and omits it when None', async () => {
createAppLaunchVideo.mockResolvedValue({ taskId: 'task-1' });
renderPanel();