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
fix: video history offset needs limit; remix lookup distinguishes 404 from failure (#12996)
[._.]/ Adam Eivy2087fd217ee4
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsxindex 37b3458556..5122e43fff 100644--- a/client/src/pages/VideoGen.jsx+++ b/client/src/pages/VideoGen.jsx@@ -587,9 +587,17 @@ export default function VideoGen() {const id = remixHandoffId;const current = () => settledRemixHandoffRef.current === id;getVideoHistoryItem(id, { silent: true })- .then((older) => { if (current()) { applyRemix(older); setRemixHandoffProblem(null); } })- .catch(() => { if (current()) setRemixHandoffProblem('missing'); })- .finally(() => { if (current()) consumeRemixHandoff(); });+ .then((older) => {+ if (!current()) return;+ applyRemix(older);+ setRemixHandoffProblem(null);+ consumeRemixHandoff();+ })+ .catch((err) => {+ if (!current()) return;+ // Only a 404 means the clip is gone; any other failure keeps the param so Retry resolves it.+ if (err?.status === 404) { setRemixHandoffProblem('missing'); consumeRemixHandoff(); } else setRemixHandoffProblem('error');+ });}, [remixHandoffId, historyLoad, history, applyRemix, consumeRemixHandoff]);// Back to 'loading' first, so a retry that fails again still moves the state// ('loading' → 'error') and re-runs the effect above.diff --git a/client/src/test/videoGenPageMocks.jsx b/client/src/test/videoGenPageMocks.jsxindex 0119a1b756..e7508766ff 100644--- a/client/src/test/videoGenPageMocks.jsx+++ b/client/src/test/videoGenPageMocks.jsx@@ -125,7 +125,7 @@ export function resetVideoGenMockState() {state.runtimeStatus = { installed: true, ready: true, current: true };for (const key of SPIES) state[key].mockReset();state.listVideoHistory.mockResolvedValue([]);- state.getVideoHistoryItem.mockRejectedValue(new Error('Video history entry not found'));+ state.getVideoHistoryItem.mockRejectedValue(Object.assign(new Error('Video history entry not found'), { status: 404 }));state.previewVideoPrompt.mockResolvedValue(null);state.listLorasFull.mockImplementation(async () => state.availableLoras);}diff --git a/server/services/videoGen/historyList.js b/server/services/videoGen/historyList.jsindex 14b40b7ab2..2372174894 100644--- a/server/services/videoGen/historyList.js+++ b/server/services/videoGen/historyList.js@@ -5,16 +5,18 @@ import { z } from 'zod';import { compactGalleryRecord } from '../mediaAssetIndex/logic.js';import { withMediaFileSizes } from '../../lib/mediaFileInfo.js';-export const historyListQuerySchema = z.object({+const queryShape = {limit: z.coerce.number().int().min(1).max(200).optional(),- offset: z.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER).default(0),+ offset: z.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER).optional(),q: z.string().max(500).default(''),hidden: z.enum(['true', 'false']).optional().transform(v => v === undefined ? undefined : v === 'true'),compact: z.enum(['true', 'false']).optional().transform(v => v === 'true'),-});+};++export const historyListQuerySchema = z.object(queryShape).refine(v => v.offset === undefined || v.limit !== undefined, { message: 'offset requires limit', path: ['offset'] });export const isHistoryListQuery = query =>- Object.keys(historyListQuerySchema.shape).some(key => query[key] !== undefined);+ Object.keys(queryShape).some(key => query[key] !== undefined);// The shared card projection plus the two lineage/ownership scalars the timeline// surfaces read (the gallery's compact source drops them).@@ -44,7 +46,7 @@ const time = value => Date.parse(value) || 0;* (callers that need every clip, e.g. the timeline editor). Only the returned* rows are `stat`ed, and compact rows are never `stat`ed.*/-export async function listVideoHistoryQuery({ limit, offset, q, hidden, compact }, history) {+export async function listVideoHistoryQuery({ limit, offset = 0, q, hidden, compact }, history) {const tokens = q.trim().toLowerCase().split(/\s+/).filter(Boolean);const matching = (Array.isArray(history) ? history : []).filter(entry => entry&& (hidden === undefined || !!entry.hidden === hidden)diff --git a/server/services/videoGen/historyList.test.js b/server/services/videoGen/historyList.test.jsindex d4cb462759..f4f818bb45 100644--- a/server/services/videoGen/historyList.test.js+++ b/server/services/videoGen/historyList.test.js@@ -50,5 +50,6 @@ describe('listVideoHistoryQuery', () => {it('rejects an oversized page', () => {expect(() => parse({ limit: '500' })).toThrow();+ expect(() => parse({ offset: '5' })).toThrow();});});