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: normalize tiling when requeueing saved videos (#6291)

[._.]/ Adam Eivyf3c232ca571a
diff --git a/client/src/components/media/PromptRefineModal.test.jsx b/client/src/components/media/PromptRefineModal.test.jsx
new file mode 100644
index 0000000000..f6cf56170a
--- /dev/null
+++ b/client/src/components/media/PromptRefineModal.test.jsx
@@ -0,0 +1,65 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { fireEvent, render, screen, waitFor } from '@testing-library/react';
+import PromptRefineModal from './PromptRefineModal';
+import { normalizeVideo } from './normalize';
+import * as api from '../../services/api';
+
+vi.mock('../../hooks/useProviderModels', () => ({
+ default: () => ({
+ providers: [{ id: 'example-provider', name: 'Example Provider', enabled: true, defaultModel: 'example-model' }],
+ selectedProviderId: 'example-provider',
+ selectedModel: 'example-model',
+ availableModels: ['example-model'],
+ setSelectedProviderId: vi.fn(),
+ setSelectedModel: vi.fn(),
+ loading: false,
+ }),
+}));
+
+vi.mock('../../services/api', () => ({
+ generateImage: vi.fn(),
+ generateVideo: vi.fn(),
+ refineMediaPrompt: vi.fn(),
+}));
+
+const videoRecord = (tiling) => normalizeVideo({
+ id: 'example-video',
+ filename: 'example-video.mp4',
+ prompt: 'a paper boat',
+ modelId: 'example-model',
+ tiling,
+});
+
+describe('PromptRefineModal video queue payload', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ vi.mocked(api.refineMediaPrompt).mockResolvedValue({
+ prompt: 'a paper boat drifting downstream',
+ negativePrompt: '',
+ rationale: 'Added motion.',
+ });
+ vi.mocked(api.generateVideo).mockResolvedValue({ position: 1 });
+ });
+
+ async function refineAndQueue(item) {
+ render(<PromptRefineModal item={item} open onClose={vi.fn()} />);
+ fireEvent.change(screen.getByLabelText('Feedback'), { target: { value: 'Add motion' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Refine Prompt' }));
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Queue Render' })).toBeEnabled());
+ fireEvent.click(screen.getByRole('button', { name: 'Queue Render' }));
+ await waitFor(() => expect(api.generateVideo).toHaveBeenCalled());
+ }
+
+ it('omits legacy boolean tiling before queueing a refined saved video', async () => {
+ await refineAndQueue(videoRecord(true));
+
+ expect(api.generateVideo).toHaveBeenCalledWith(expect.not.objectContaining({ tiling: true }));
+ expect(api.generateVideo.mock.calls[0][0]).not.toHaveProperty('tiling');
+ });
+
+ it('retains a recognized tiling mode in the queue payload', async () => {
+ await refineAndQueue(videoRecord('spatial'));
+
+ expect(api.generateVideo).toHaveBeenCalledWith(expect.objectContaining({ tiling: 'spatial' }));
+ });
+});
diff --git a/client/src/components/media/normalize.js b/client/src/components/media/normalize.js
index f62a4bb8b5..7bf24582c3 100644
--- a/client/src/components/media/normalize.js
+++ b/client/src/components/media/normalize.js
@@ -1,4 +1,5 @@
import { IMAGE_GEN_MODE } from '../../lib/imageGenBackends';
+import { normalizeVideoTiling } from '../../lib/videoTilingOptions';
// Friendly display name for a LoRA basename. The on-disk filenames look like
// `lora-realstagram-v7.safetensors` — strip the `lora-` prefix, the version
@@ -193,7 +194,7 @@ export function getRenderConfigForItem(item) {
// video models and must survive the round-trip back into the queued payload.
guidanceScale: raw.guidanceScale ?? raw.guidance_scale ?? raw.guidance,
seed: raw.seed,
- tiling: raw.tiling,
+ tiling: normalizeVideoTiling(raw.tiling),
disableAudio: raw.disableAudio ?? raw.disable_audio,
textEncoderId: raw.textEncoderId,
// The named sampler schedule (#4875), when the record was rendered with
diff --git a/client/src/components/media/normalize.test.js b/client/src/components/media/normalize.test.js
index bef37cca85..478afc3776 100644
--- a/client/src/components/media/normalize.test.js
+++ b/client/src/components/media/normalize.test.js
@@ -246,7 +246,7 @@ describe('getRenderConfigForItem - video', () => {
steps: 30,
guidanceScale: 3.5,
seed: 100,
- tiling: true,
+ tiling: undefined,
disableAudio: false,
textEncoderId: 'example-encoder',
loraFilenames: ['lora-cinematic.safetensors'],
@@ -305,6 +305,12 @@ describe('getRenderConfigForItem - video', () => {
const cfg = getRenderConfigForItem(video);
expect(cfg.mode).toBe('text');
});
+
+ it('retains recognized tiling modes and omits legacy or unknown values', () => {
+ expect(getRenderConfigForItem(normalizeVideo({ id: 'v6', tiling: 'spatial' })).tiling).toBe('spatial');
+ expect(getRenderConfigForItem(normalizeVideo({ id: 'v7', tiling: false })).tiling).toBeUndefined();
+ expect(getRenderConfigForItem(normalizeVideo({ id: 'v8', tiling: 'invalid' })).tiling).toBeUndefined();
+ });
});
// @vitest-environment node
diff --git a/client/src/hooks/useMediaPreviewActions.js b/client/src/hooks/useMediaPreviewActions.js
index d05aca41d7..ee19c79b96 100644
--- a/client/src/hooks/useMediaPreviewActions.js
+++ b/client/src/hooks/useMediaPreviewActions.js
@@ -2,7 +2,7 @@ import { useCallback } from 'react';
import { useNavigate } from 'react-router';
import toast from '../components/ui/Toast';
import { cleanGalleryImage, extractLastFrame, removeImageWatermark } from '../services/apiImageVideo';
-import { VIDEO_TILING_ENUM_SET } from '../lib/videoTilingOptions';
+import { normalizeVideoTiling } from '../lib/videoTilingOptions';
// Common image render-setting params shared by the image branch of Remix and by
// Send-to-image-to-image — both open /media/image with these fields prefilled.
@@ -97,9 +97,8 @@ export default function useMediaPreviewActions({ onCleanComplete = null } = {})
// tiling must match the server's enum. Legacy sidecars sometimes store
// a boolean here — pass through only known-good string values so the
// remixed POST doesn't 400 on /api/video-gen validation.
- if (typeof raw.tiling === 'string' && VIDEO_TILING_ENUM_SET.has(raw.tiling)) {
- params.set('tiling', raw.tiling);
- }
+ const tiling = normalizeVideoTiling(raw.tiling);
+ if (tiling) params.set('tiling', tiling);
const disableAudio = raw.disableAudio ?? raw.disable_audio;
if (disableAudio === true) params.set('disableAudio', '1');
navigate(`/media/video?${params}`);
diff --git a/client/src/hooks/useVideoGenForm.js b/client/src/hooks/useVideoGenForm.js
index 2799e4b3da..c84a34841c 100644
--- a/client/src/hooks/useVideoGenForm.js
+++ b/client/src/hooks/useVideoGenForm.js
@@ -12,7 +12,7 @@ import { randomSeed } from '../lib/genUtils';
import {
resolutionOptionsForModel, defaultResolutionForModel, snapAspectToImage,
} from '../lib/videoGenResolutions';
-import { VIDEO_TILING_ENUM_SET } from '../lib/videoTilingOptions';
+import { normalizeVideoTiling } from '../lib/videoTilingOptions';
import {
MAX_CHUNKS,
videoModelMemoryGb, isModelAllowedForMode,
@@ -256,7 +256,8 @@ export function useVideoGenForm({
// VIDEO_TILING_OPTIONS so a hand-edited URL or stale link can't push the
// <select> into an invalid state and 400 the next POST.
const urlTiling = get('tiling');
- if (urlTiling && VIDEO_TILING_ENUM_SET.has(urlTiling)) setTiling(urlTiling);
+ const normalizedUrlTiling = normalizeVideoTiling(urlTiling);
+ if (normalizedUrlTiling) setTiling(normalizedUrlTiling);
// disableAudio is a boolean; accept the common encodings a hand-edited URL
// might carry ('1' from our own Remix builder, 'true' from a manual share).
// Anything else (absent, '0', 'false', garbage) means "default off".
@@ -1038,7 +1039,8 @@ export function useVideoGenForm({
// tiling must match the VIDEO_TILING_OPTIONS enum. Legacy sidecars sometimes
// store a boolean here — silently ignore unknown values so the <select>
// stays valid and the next POST doesn't 400.
- if (typeof item.tiling === 'string' && VIDEO_TILING_ENUM_SET.has(item.tiling)) setTiling(item.tiling);
+ const tiling = normalizeVideoTiling(item.tiling);
+ if (tiling) setTiling(tiling);
// ALWAYS set explicitly, like steps/guidanceScale above: history stamps the
// strength only when it applied, so a missing field means "the model default"
// and has to clear a leftover value rather than steer a render the user asked
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index 3720974533..18359b21a3 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -83,7 +83,7 @@ grep -i "what you want to do" client/src/lib/README.md
| `videoGenSubmission.js` | Builds the local, Grok, and federated video-generation request bodies from validated form state, including prompt envelopes and empty-value wire sentinels. |
| `videoReferenceModes.js` | Mirror of `server/lib/videoReferenceModes.js` (parity enforced by `server/lib/videoReferenceModes.mirror.test.js`) — the i2v reference-mode contract: `I2V_REFERENCE_MODES`, `I2V_REFERENCE_MODE_OPTIONS` (label + the promise sentence `AdvancedParamsPanel` and the source-frame note print), `runtimeSupportsI2vReferenceMode` (gates which options the picker offers), `resolveI2vReferenceStrength` (the effective strength the panel displays), and `i2vReferenceModeViolation` for pre-submit feedback. |
| `videoRenderPhase.js` | Video render phase → named progress step (#5872). `resolveVideoRenderSteps({ generating, phase, progressPct })` → `{ activeId, steps: [{ id, label, state: 'done'|'active'|'pending' }] }`, collapsing the runners' fine-grained `STAGE:` vocabulary (`load-transformer`, `encode-prompt`, `sampling`, `mux`, …) onto six steps a person can read — the queue's own `queued` is one of them, so a caller needs no separate flag. Family prefixes (`download-*`, `load-*`, `wan-*`, …) absorb markers a future runner adds; `videoRenderStepFor(phase)` returns `null` for a genuinely unknown one, never step 0. Consumed by `components/videoGen/RenderStatusCard.jsx`. |
-| `videoTilingOptions.js` | `VIDEO_TILING_OPTIONS` (the `<select>` rows) + `VIDEO_TILING_ENUM_SET` (the value-only Set). Single source consumed by `VideoGen.jsx` and the Remix URL builder in `useMediaPreviewActions`. Mirrors the server's `z.enum` in `server/routes/videoGen.js`. |
+| `videoTilingOptions.js` | `VIDEO_TILING_OPTIONS` (the `<select>` rows), `VIDEO_TILING_ENUM_SET` (the value-only Set), and `normalizeVideoTiling` (omit legacy/unknown values). Single source consumed by `VideoGen.jsx`, saved-video normalization, and Remix/requeue callers. Mirrors the server's `z.enum` in `server/routes/videoGen.js`. |
## Graph & sim
diff --git a/client/src/lib/videoTilingOptions.js b/client/src/lib/videoTilingOptions.js
index e04273f931..983c6cfb45 100644
--- a/client/src/lib/videoTilingOptions.js
+++ b/client/src/lib/videoTilingOptions.js
@@ -12,3 +12,7 @@ export const VIDEO_TILING_OPTIONS = [
];
export const VIDEO_TILING_ENUM_SET = new Set(VIDEO_TILING_OPTIONS.map((o) => o.value));
+
+export function normalizeVideoTiling(value) {
+ return typeof value === 'string' && VIDEO_TILING_ENUM_SET.has(value) ? value : undefined;
+}