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: scope the Remix retry-block to its own handoff, and prove the legacy reset

[._.]/ Adam Eivy35d8613a9184
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index 3703029e54..430511d3ee 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -449,11 +449,12 @@ export default function VideoGen() {
// null while nothing is wrong; otherwise 'error' (the history fetch failed,
// retryable) or 'missing' (history loaded and holds no such record).
const [remixHandoffProblem, setRemixHandoffProblem] = useState(null);
- // Set when the fetch failed under a pending handoff. The restore then waits
- // for an explicit Retry instead of riding in on the next background refresh:
- // a render completing minutes later would otherwise replay the handoff over
- // a form the user has been editing since the banner appeared.
- const [remixHandoffBlocked, setRemixHandoffBlocked] = useState(false);
+ // The handoff id whose fetch failed. That restore then waits for an explicit
+ // Retry instead of riding in on the next background refresh: a render
+ // completing minutes later would otherwise replay it over a form the user has
+ // been editing since the banner appeared. Holding the ID rather than a flag
+ // keeps the block on that one handoff — a later one resolves normally.
+ const [blockedRemixHandoffId, setBlockedRemixHandoffId] = useState(null);
const consumeRemixHandoff = useCallback(() => {
setSearchParams((prev) => {
const next = new URLSearchParams(prev);
@@ -466,15 +467,16 @@ export default function VideoGen() {
// Clearing the settled id here is what lets the NEXT handoff through, even
// when it names the same record.
if (!remixHandoffId) { settledRemixHandoffRef.current = null; return; }
- if (settledRemixHandoffRef.current === remixHandoffId || remixHandoffBlocked) return;
+ if (settledRemixHandoffRef.current === remixHandoffId || blockedRemixHandoffId === remixHandoffId) return;
// Still fetching: say nothing. Reporting "no such record" here would be a
// lie every time the page is opened faster than the history round trip.
- if (historyLoad === 'loading') return;
+ // Any banner still up belongs to a previous handoff, so it goes.
+ if (historyLoad === 'loading') { setRemixHandoffProblem(null); return; }
if (historyLoad === 'error') {
// Keep the param so Retry can resolve it, and leave the handoff unsettled
// so that retry actually re-runs this effect.
setRemixHandoffProblem('error');
- setRemixHandoffBlocked(true);
+ setBlockedRemixHandoffId(remixHandoffId);
return;
}
const record = history.find((v) => String(v.id) === remixHandoffId);
@@ -486,19 +488,19 @@ export default function VideoGen() {
setRemixHandoffProblem('missing');
}
consumeRemixHandoff();
- }, [remixHandoffId, historyLoad, history, remixHandoffBlocked, applyRemix, consumeRemixHandoff]);
+ }, [remixHandoffId, historyLoad, history, blockedRemixHandoffId, applyRemix, consumeRemixHandoff]);
// Back to 'loading' first, so a retry that fails again still moves the state
// ('loading' → 'error') and re-runs the effect above.
const retryRemixHandoff = useCallback(() => {
setHistoryLoad('loading');
setRemixHandoffProblem(null);
- setRemixHandoffBlocked(false);
+ setBlockedRemixHandoffId(null);
refreshHistory();
}, [refreshHistory]);
const dismissRemixHandoff = useCallback(() => {
settledRemixHandoffRef.current = remixHandoffId;
setRemixHandoffProblem(null);
- setRemixHandoffBlocked(false);
+ setBlockedRemixHandoffId(null);
consumeRemixHandoff();
}, [remixHandoffId, consumeRemixHandoff]);
diff --git a/client/src/pages/VideoGen.remix.test.jsx b/client/src/pages/VideoGen.remix.test.jsx
index 5bff54922a..25f31082fb 100644
--- a/client/src/pages/VideoGen.remix.test.jsx
+++ b/client/src/pages/VideoGen.remix.test.jsx
@@ -147,8 +147,16 @@ describe('VideoGen cross-page Remix handoff', () => {
expect(readRestoredForm()).toEqual(fromHistory);
});
- it('resets the optional controls to their sentinels for a legacy record', async () => {
- await renderVideoGenPage(`/media/video?remix=${LEGACY_RECORD.id}`);
+ it('clears the optional controls when a legacy record follows a configured one', async () => {
+ // The configured record first, so every control under test holds a
+ // NON-default value. Asserting the sentinels on a freshly mounted form
+ // would pass even if the restore stopped clearing them at all.
+ await renderVideoGenPage(`/media/video?remix=${RECORD.id}`);
+ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(RECORD.prompt));
+ expect(readRestoredForm().speedProfileId).toBe('turbo');
+
+ // A second handoff arriving in place, with the page already mounted.
+ await act(async () => { state.navigate(`/media/video?remix=${LEGACY_RECORD.id}`); });
await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(LEGACY_RECORD.prompt));
const restored = readRestoredForm();
@@ -156,9 +164,11 @@ describe('VideoGen cross-page Remix handoff', () => {
expect(restored.speedProfileId).toBe('quality');
expect(restored.draftDecode).toBe('full');
expect(restored.loras).toEqual([]);
+ expect(restored.negativePrompt).toBe('');
expect(restored.steps).toBe('');
expect(restored.guidanceScale).toBe('');
expect(restored.chunks).toBe(1);
+ expect(restored.chunkPrompts).toEqual([]);
});
it('says nothing about a missing record while the history fetch is still in flight', async () => {
@@ -200,12 +210,19 @@ describe('VideoGen cross-page Remix handoff', () => {
// The banner can sit for as long as the user leaves it there, and the form
// is live the whole time. A render finishing in the background re-fetches
// history — the stranded handoff must not ride in on it and wipe the form.
- fireEvent.change(screen.getByLabelText('Prompt'), { target: { value: 'a kite over a field' } });
- state.listVideoHistory.mockResolvedValue([RECORD]);
+ fireEvent.change(screen.getByLabelText('Prompt'), { target: { value: 'a half-typed idea' } });
+ state.listVideoHistory.mockResolvedValue([RECORD, LEGACY_RECORD]);
await act(async () => { await state.completionRefresh.onVideoCompleted(); });
- expect(screen.getByLabelText('Prompt')).toHaveValue('a kite over a field');
+ expect(screen.getByLabelText('Prompt')).toHaveValue('a half-typed idea');
expect(screen.getByRole('button', { name: 'Retry' })).toBeInTheDocument();
+
+ // The wait belongs to THAT handoff, not to the page: a different record
+ // arriving afterwards must resolve against the history that has since
+ // loaded rather than inherit the stranded one's block.
+ await act(async () => { state.navigate(`/media/video?remix=${LEGACY_RECORD.id}`); });
+ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(LEGACY_RECORD.prompt));
+ expect(screen.queryByText(/Couldn't load your render history/)).toBeNull();
});
it('reports an actionable missing-record state when the load holds no such record', async () => {
diff --git a/client/src/test/videoGenPageMocks.jsx b/client/src/test/videoGenPageMocks.jsx
index b178de87ec..cf7666554b 100644
--- a/client/src/test/videoGenPageMocks.jsx
+++ b/client/src/test/videoGenPageMocks.jsx
@@ -23,7 +23,7 @@
*/
import { act, render } from '@testing-library/react';
-import { MemoryRouter } from 'react-router';
+import { MemoryRouter, useNavigate } from 'react-router';
import { vi } from 'vitest';
/** Universe style the stub picker hands to the page when its button is clicked. */
@@ -80,6 +80,12 @@ export const state = {
completionRefresh: null,
/** `listLorasFull` — the installed library the LoRA picker resolves names against. */
availableLoras: [],
+ /**
+ * The mounted router's `navigate`, for a suite that needs a SECOND in-place
+ * navigation — a URL handoff arriving while the page is already mounted,
+ * which is a different code path from a fresh mount on that URL.
+ */
+ navigate: null,
};
const SPIES = ['getVideoGenStatus', 'getVideoGenModelContext', 'generateVideo', 'attach', 'start', 'startWhenIdle', 'repair', 'cancel', 'refresh', 'listVideoHistory'];
@@ -99,6 +105,7 @@ export function resetVideoGenMockState() {
state.galleryProps = null;
state.completionRefresh = null;
state.availableLoras = [];
+ state.navigate = null;
for (const key of SPIES) state[key].mockReset();
state.listVideoHistory.mockResolvedValue([]);
}
@@ -273,6 +280,12 @@ vi.mock('../components/media/ResolutionField', () => ({ default: () => null }));
let VideoGen = null;
+/** Publishes the router's `navigate` on `state`. Renders nothing. */
+function NavigateProbe() {
+ state.navigate = useNavigate();
+ return null;
+}
+
/**
* Import the page under the mocks above. Every suite loads it dynamically at
* module scope so the registrations are in place first; the component is kept
@@ -293,6 +306,7 @@ export async function renderVideoGenPage(entry = '/media/video') {
await act(async () => {
view = render(
<MemoryRouter initialEntries={[entry]}>
+ <NavigateProbe />
<VideoGen />
</MemoryRouter>,
);