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: surface failed stop, cancel and background-save requests (#12963) (#13085)

[._.]/eaa570fda35d
diff --git a/client/src/components/dashboard/ActiveProcessingWidget.jsx b/client/src/components/dashboard/ActiveProcessingWidget.jsx
index f25ed93891..f78cc4b671 100644
--- a/client/src/components/dashboard/ActiveProcessingWidget.jsx
+++ b/client/src/components/dashboard/ActiveProcessingWidget.jsx
@@ -97,7 +97,7 @@ function ActiveProcessingWidget() {
{ enabled: visible, compare: sameGpuSample },
);
const data = snapshot;
- const cancel = (id) => api.cancelMediaJob(id, { silent: true }).catch(() => undefined);
+ const cancel = (id) => api.cancelMediaJob(id).catch(() => undefined);
const jobs = data?.jobs || [];
const gpu = telemetry?.gpu;
const imageTo3d = data?.extras?.imageTo3d || [];
diff --git a/client/src/components/dashboard/ActiveProcessingWidget.test.jsx b/client/src/components/dashboard/ActiveProcessingWidget.test.jsx
index a74f58de01..dcbcc8ed89 100644
--- a/client/src/components/dashboard/ActiveProcessingWidget.test.jsx
+++ b/client/src/components/dashboard/ActiveProcessingWidget.test.jsx
@@ -148,7 +148,22 @@ describe('ActiveProcessingWidget', () => {
const user = userEvent.setup();
renderWidget();
await user.click(await screen.findByRole('button', { name: 'Cancel Example image' }));
- expect(mockCancelMediaJob).toHaveBeenCalledWith('image-1', { silent: true });
+ expect(mockCancelMediaJob).toHaveBeenCalledWith('image-1');
+ });
+
+ it('keeps Cancel usable for a retry when the cancel request fails', async () => {
+ mockGetSystemActivity.mockResolvedValue({
+ jobs: [{ id: 'image-1', kind: 'image', status: 'running', progress: 0.5, startedAt: new Date().toISOString(), params: { prompt: 'Example image' } }],
+ extras: {},
+ agents: {},
+ activity: { idle: false, activeCount: 1, queuedCount: 0, blockers: [] },
+ });
+ mockCancelMediaJob.mockRejectedValueOnce(new Error('GPU busy'));
+ const user = userEvent.setup();
+ renderWidget();
+ await user.click(await screen.findByRole('button', { name: 'Cancel Example image' }));
+ await user.click(screen.getByRole('button', { name: 'Cancel Example image' }));
+ expect(mockCancelMediaJob).toHaveBeenCalledTimes(2);
});
it('does not sample the GPU while the inspector is off screen', async () => {
diff --git a/client/src/components/media/MediaPreview.jsx b/client/src/components/media/MediaPreview.jsx
index c412949a86..11b9d26f12 100644
--- a/client/src/components/media/MediaPreview.jsx
+++ b/client/src/components/media/MediaPreview.jsx
@@ -120,10 +120,12 @@ export default function MediaPreview({
if (!nextItem) return;
setPreview(nextItem);
}, [setPreview]);
- const savePrompt = useCallback(async (item, prompt) => {
+ // Lightbox Save already shows its own inline error, so it stays silent; the
+ // analysis path has no error UI of its own and passes { silent: false } to toast.
+ const savePrompt = useCallback(async (item, prompt, { silent = true } = {}) => {
const result = item.kind === 'image'
- ? await updateImagePrompt(item.filename, prompt, { silent: true })
- : await updateVideoPrompt(item.id, prompt, { silent: true });
+ ? await updateImagePrompt(item.filename, prompt, { silent })
+ : await updateVideoPrompt(item.id, prompt, { silent });
const nextPrompt = result?.prompt || '(no prompt)';
setPromptOverride({ key: item.key, prompt: nextPrompt });
onPromptSaved?.(item, nextPrompt);
@@ -131,7 +133,7 @@ export default function MediaPreview({
}, [onPromptSaved]);
const handlePromptAnalysis = useCallback((item, result) => {
const prompt = item.kind === 'video' ? result?.videoPrompt : result?.imagePrompt;
- if (prompt) savePrompt(item, prompt).catch(() => {});
+ if (prompt) savePrompt(item, prompt, { silent: false }).catch(() => {});
}, [savePrompt]);
return (
<MediaLightbox
diff --git a/client/src/components/media/MediaPreview.test.jsx b/client/src/components/media/MediaPreview.test.jsx
index 59dd3b2272..a985d461a7 100644
--- a/client/src/components/media/MediaPreview.test.jsx
+++ b/client/src/components/media/MediaPreview.test.jsx
@@ -19,9 +19,10 @@ vi.mock('../../services/apiImageVideo', () => ({
// its own interaction coverage; this stub exposes the item it receives and
// invokes the same callback the real Save prompt button uses.
vi.mock('./MediaLightbox', () => ({
- default: ({ item, onPromptChange, onPosterChange, onTrimStart, variantGroup, onSelectVariant }) => item ? (
+ default: ({ item, onPromptChange, onPromptAnalysis, onPosterChange, onTrimStart, variantGroup, onSelectVariant }) => item ? (
<div data-testid="lightbox">
{onTrimStart && <button type="button" onClick={() => onTrimStart(item, 1.25)}>Start clip here</button>}
+ <button type="button" onClick={() => onPromptAnalysis(item, { videoPrompt: 'analysed prompt' })}>Analyze prompt</button>
<span data-testid="lightbox-poster">{item.previewUrl}</span>
<button onClick={() => onPosterChange(item, 12.4)}>Save poster</button>
<span data-testid="lightbox-prompt">{item.prompt}</span>
@@ -105,6 +106,21 @@ describe('MediaPreview prompt saving', () => {
expect(screen.getByTestId('location')).toHaveTextContent('preview=video%3Avideo-1');
});
+ it('saves an analysed prompt non-silently so a failure reaches the user', async () => {
+ render(
+ <MemoryRouter>
+ <PromptSaveHarness />
+ </MemoryRouter>,
+ );
+
+ fireEvent.click(screen.getByRole('button', { name: 'Open video' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Analyze prompt' }));
+
+ await waitFor(() => {
+ expect(updateVideoPrompt).toHaveBeenCalledWith('video-1', 'analysed prompt', { silent: false });
+ });
+ });
+
it('keeps the saved prompt visible when the host has no card-state callback', async () => {
render(
<MemoryRouter>
diff --git a/client/src/components/musicVideo/ShotFinalRender.jsx b/client/src/components/musicVideo/ShotFinalRender.jsx
index 45117f1e31..006391d7ae 100644
--- a/client/src/components/musicVideo/ShotFinalRender.jsx
+++ b/client/src/components/musicVideo/ShotFinalRender.jsx
@@ -71,7 +71,7 @@ export default function ShotFinalRender({ project, scene, onChange, fieldId }) {
)}
<span className="ml-auto flex flex-wrap items-center gap-2">
{rendering ? (
- <button type="button" className={BUTTON} onClick={() => cancelMusicVideoShotRender(projectId, sceneId, { silent: true }).catch(() => {})}>
+ <button type="button" className={BUTTON} onClick={() => cancelMusicVideoShotRender(projectId, sceneId).catch(() => {})}>
<Square size={12} aria-hidden="true" /> Stop
</button>
) : shot && !rendered ? (
diff --git a/client/src/components/musicVideo/ShotFinalRender.test.jsx b/client/src/components/musicVideo/ShotFinalRender.test.jsx
index 44b86d3f6f..49eba8df18 100644
--- a/client/src/components/musicVideo/ShotFinalRender.test.jsx
+++ b/client/src/components/musicVideo/ShotFinalRender.test.jsx
@@ -16,7 +16,7 @@ vi.mock('../../services/apiMusicVideo.js', () => ({
import ShotFinalRender from './ShotFinalRender.jsx';
import { filmLookPreset } from '../../lib/filmLook.js';
-import { getMusicVideoShotRenders, renderMusicVideoShot } from '../../services/apiMusicVideo.js';
+import { cancelMusicVideoShotRender, getMusicVideoShotRenders, renderMusicVideoShot } from '../../services/apiMusicVideo.js';
const project = { id: 'mv-1', composition: { mode: 'composed' }, filmLook: { preset: 'vhs' }, scenes: [{ sceneId: 'a' }, { sceneId: 'b' }] };
const fieldId = (name) => `f-${name}`;
@@ -59,6 +59,16 @@ describe('ShotFinalRender', () => {
expect(onChange).toHaveBeenLastCalledWith({ filmLook: null });
});
+ it('keeps Stop available for a retry when the stop request fails', async () => {
+ getMusicVideoShotRenders.mockResolvedValue({ available: true, shots: [{ ...shot('a', 'stale'), rendering: true }], ready: 0, total: 1 });
+ cancelMusicVideoShotRender.mockRejectedValueOnce(new Error('render server down'));
+ render(<ShotFinalRender project={project} scene={project.scenes[0]} onChange={() => {}} fieldId={fieldId} />);
+ fireEvent.click(await screen.findByRole('button', { name: /Stop/ }));
+ await waitFor(() => expect(cancelMusicVideoShotRender).toHaveBeenCalledTimes(1));
+ fireEvent.click(screen.getByRole('button', { name: /Stop/ }));
+ expect(cancelMusicVideoShotRender).toHaveBeenCalledTimes(2);
+ });
+
it('offers the saved looks, sets one on the shot, and shows it as picked', async () => {
savedLooks.push({ id: 'dusk-1', label: 'Dusk', look: { preset: 'custom', warmth: 0.4, grain: 0.2 } });
getMusicVideoShotRenders.mockResolvedValue({ available: true, shots: [shot('a', 'rendered', ['a.mp4'])], ready: 1, total: 1 });
diff --git a/client/src/components/storyboards/PlotBeatsDrawer.jsx b/client/src/components/storyboards/PlotBeatsDrawer.jsx
index 615b3e1cfc..23f9382df1 100644
--- a/client/src/components/storyboards/PlotBeatsDrawer.jsx
+++ b/client/src/components/storyboards/PlotBeatsDrawer.jsx
@@ -32,7 +32,7 @@ export default function PlotBeatsDrawer({ open, board, onClose, onBoard }) {
}, [board.plot]);
const savePlot = () => {
- if (plot !== (board.plot || '')) updateStoryboard(board.id, { plot }, { silent: true }).then(onBoard).catch(() => {});
+ if (plot !== (board.plot || '')) updateStoryboard(board.id, { plot }).then(onBoard).catch(() => {});
};
const extract = async () => {
diff --git a/client/src/components/storyboards/PlotBeatsDrawer.test.jsx b/client/src/components/storyboards/PlotBeatsDrawer.test.jsx
new file mode 100644
index 0000000000..95e3571491
--- /dev/null
+++ b/client/src/components/storyboards/PlotBeatsDrawer.test.jsx
@@ -0,0 +1,42 @@
+import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
+import { fireEvent, render, screen, waitFor } from '@testing-library/react';
+
+// Real request() from services/apiCore runs here (no api mock), so the toast
+// count below is the one the user would see for a failed background save.
+vi.mock('../ui/Toast', () => {
+ const toastFn = vi.fn();
+ toastFn.error = vi.fn();
+ return { default: toastFn };
+});
+vi.mock('../musicVideo/MusicVideoLlmPicker', () => ({ default: () => null }));
+vi.mock('../media/SentPromptPanel', () => ({ default: () => null }));
+
+import toast from '../ui/Toast';
+import PlotBeatsDrawer from './PlotBeatsDrawer';
+
+const board = { id: 'sb-1', name: 'Board', plot: 'Saved plot', plotLlm: null };
+
+describe('PlotBeatsDrawer plot save', () => {
+ beforeEach(() => {
+ global.fetch = vi.fn(async () => ({
+ status: 500,
+ ok: false,
+ json: async () => ({ error: 'disk full' }),
+ }));
+ toast.mockReset();
+ toast.error.mockReset();
+ });
+ afterEach(() => { delete global.fetch; });
+
+ it('reports a failed blur save once and keeps the typed plot on screen', async () => {
+ const onBoard = vi.fn();
+ render(<PlotBeatsDrawer open board={board} onClose={() => {}} onBoard={onBoard} />);
+ const textarea = screen.getByLabelText('Plot summary');
+ fireEvent.change(textarea, { target: { value: 'A new plot' } });
+ fireEvent.blur(textarea);
+ await waitFor(() => expect(toast.error).toHaveBeenCalledTimes(1));
+ expect(toast.error).toHaveBeenCalledWith('disk full');
+ expect(onBoard).not.toHaveBeenCalled();
+ expect(textarea).toHaveValue('A new plot');
+ });
+});