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: retain stitch tracking across temporary status failures

[._.]/ Adam Eivyc017e93d23b8
diff --git a/client/src/pages/MediaHistory.jsx b/client/src/pages/MediaHistory.jsx
index a6de7b744b..b97ade1f26 100644
--- a/client/src/pages/MediaHistory.jsx
+++ b/client/src/pages/MediaHistory.jsx
@@ -89,7 +89,7 @@ export default function MediaHistory() {
const recheckStitch = useCallback(async (jobId) => {
const current = await getMediaJob(jobId).catch(() => null);
if (!mounted.current) return;
- if (!current?.status && stitchJobsRef.current.delete(jobId)) {
+ if (!current?.status && stitchJobsRef.current.has(jobId)) {
toast('Stitch status unknown — check media history');
} else if (current?.status === 'completed' && settleStitch(jobId)) refresh();
else if (current?.status === 'failed' || current?.status === 'canceled') {
diff --git a/client/src/pages/MediaHistory.test.jsx b/client/src/pages/MediaHistory.test.jsx
index 744374f6f4..a08461ea01 100644
--- a/client/src/pages/MediaHistory.test.jsx
+++ b/client/src/pages/MediaHistory.test.jsx
@@ -176,12 +176,15 @@ describe('stitch job', () => {
fireEvent.click(screen.getByRole('button', { name: 'Stitch 2' }));
await waitFor(() => expect(toast).toHaveBeenCalledWith('Stitch status unknown — check media history'));
await act(async () => socketHandlers.get('video-gen:completed')({ generationId: 'unknown-job' }));
- expect(toast.success).toHaveBeenCalledTimes(1);
+ expect(toast.success).toHaveBeenCalledTimes(2);
+ await act(async () => socketHandlers.get('video-gen:completed')({ generationId: 'unknown-job' }));
+ expect(toast.success).toHaveBeenCalledTimes(2);
});
it('toasts success only when the job settles, and surfaces an enqueue failure', async () => {
rows = ['a', 'b'].map(id => ({ kind: 'video', data: { id, filename: `${id}.mp4`, prompt: `Clip ${id}`, createdAt: '2026-01-01' } }));
stitchVideos.mockResolvedValueOnce({ ok: true, job: { jobId: 'job-1', status: 'queued' } });
+ jobsApi.getMediaJob.mockRejectedValueOnce(new Error('Status unavailable'));
open();
await screen.findByText('Clip a');
fireEvent.click(screen.getByRole('button', { name: 'Stitch' }));
@@ -190,6 +193,7 @@ describe('stitch job', () => {
fireEvent.click(screen.getByRole('button', { name: 'Stitch 2' }));
await waitFor(() => expect(stitchVideos).toHaveBeenCalledWith(['a', 'b'], { silent: true }));
await waitFor(() => expect(toast).toHaveBeenCalled());
+ expect(toast).toHaveBeenCalledWith('Stitch status unknown — check media history');
expect(toast.success).not.toHaveBeenCalled();
await act(async () => socketHandlers.get('video-gen:completed')({ generationId: 'unrelated-job' }));
expect(toast.success).not.toHaveBeenCalled();