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: preserve exact image edges + guard video 0-dim submit (#2436 review)

Adam Eivy333a915aa526
diff --git a/client/src/components/media/ResolutionField.jsx b/client/src/components/media/ResolutionField.jsx
index 9f24741b80..1a023feaf7 100644
--- a/client/src/components/media/ResolutionField.jsx
+++ b/client/src/components/media/ResolutionField.jsx
@@ -25,9 +25,13 @@ export default function ResolutionField({
presets = [],
width, height, onChange,
// Per-edge bounds mirroring the server: image = [64, 3840] step 8, video =
- // [64, 2048] step 64. `step` drives both the number-input spinner and the
- // blur-snap.
+ // [64, 2048] step 64. `step` sets the number-input spinner increment.
min = 64, max = MAX_IMAGE_EDGE, step = 8,
+ // Whether the blur handler snaps each edge DOWN to a multiple of `step`.
+ // Video opts in because the server floors both dims to 64 — showing the
+ // floored value up front is honest. Image leaves it off: its route accepts
+ // any integer edge (imageEdgeSchema), so a hand-typed 705 must stay 705.
+ snapOnBlur = false,
// When set, shows a total-pixel-cap warning + note (image only). Omit for
// video, whose per-tier budget is enforced elsewhere.
maxPixels = null,
@@ -53,7 +57,8 @@ export default function ResolutionField({
if (!matched && width && height) setCustomOpen(true);
}, [matched, width, height]);
- const bounds = { min, max, step };
+ // Clamp always enforces [min, max]; step-snapping is opt-in per snapOnBlur.
+ const bounds = snapOnBlur ? { min, max, step } : { min, max };
const handleResolution = (e) => {
if (e.target.value === CUSTOM_RESOLUTION_VALUE) { setCustomOpen(true); return; }
const r = presets.find((opt) => opt.label === e.target.value);
diff --git a/client/src/components/media/ResolutionField.test.jsx b/client/src/components/media/ResolutionField.test.jsx
index 314e72309d..29f1c20c95 100644
--- a/client/src/components/media/ResolutionField.test.jsx
+++ b/client/src/components/media/ResolutionField.test.jsx
@@ -13,7 +13,7 @@ const VIDEO_PRESETS = [
];
const imageBounds = { min: 64, max: 3840, step: 8, maxPixels: 8_294_400 };
-const videoBounds = { min: 64, max: 2048, step: 64 };
+const videoBounds = { min: 64, max: 2048, step: 64, snapOnBlur: true };
describe('ResolutionField — preset dropdown', () => {
it('renders every preset plus a Custom… sentinel option', () => {
@@ -64,7 +64,7 @@ describe('ResolutionField — custom W×H', () => {
expect(onChange).toHaveBeenLastCalledWith(64, 1280);
});
- it('snaps a video edge down to the step multiple on blur', () => {
+ it('snaps a video edge down to the step multiple on blur (snapOnBlur)', () => {
const onChange = vi.fn();
render(<ResolutionField presets={VIDEO_PRESETS} width={700} height={512} onChange={onChange} {...videoBounds} />);
fireEvent.blur(screen.getByLabelText('Width'));
@@ -72,6 +72,14 @@ describe('ResolutionField — custom W×H', () => {
expect(onChange).toHaveBeenLastCalledWith(640, 512);
});
+ it('does NOT snap an image edge to the step multiple on blur (clamp only)', () => {
+ const onChange = vi.fn();
+ // 705 is in-bounds and not a multiple of 8; image must preserve it exactly.
+ render(<ResolutionField presets={IMAGE_PRESETS} width={705} height={1024} onChange={onChange} {...imageBounds} />);
+ fireEvent.blur(screen.getByLabelText('Width'));
+ expect(onChange).toHaveBeenLastCalledWith(705, 1024);
+ });
+
it('warns when total pixels exceed the cap (image only)', () => {
render(<ResolutionField presets={IMAGE_PRESETS} width={3840} height={3840} onChange={vi.fn()} {...imageBounds} />);
expect(screen.getByText(/exceeds the .* px cap/i)).toBeTruthy();
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index b975b27063..0d952d6999 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -69,6 +69,7 @@ import LoraPicker from '../components/imageGen/LoraPicker';
import { videoLoraFamily, VIDEO_LORA_FAMILIES } from '../lib/runnerFamilies';
import { randomSeed } from '../lib/genUtils';
import { VIDEO_RESOLUTIONS, snapAspectToImage } from '../lib/videoGenResolutions';
+import { clampImageEdge } from '../lib/imageGenResolutions';
import ResolutionField from '../components/media/ResolutionField';
import { VIDEO_TILING_OPTIONS, VIDEO_TILING_ENUM_SET } from '../lib/videoTilingOptions';
@@ -101,6 +102,12 @@ const videoModelMemoryGb = (model) => {
return match ? Number(match[1]) : Number.POSITIVE_INFINITY;
};
+// Per-edge bounds for video: mirrors the videoGen route (64..2048) and the
+// server's floor-to-multiple-of-64 (generateVideo in local.js). Shared by the
+// ResolutionField control and the submit-time clamp so a hand-typed / mid-edit
+// value can never POST an out-of-range or 0 dimension.
+const VIDEO_EDGE_BOUNDS = { min: 64, max: 2048, step: 64 };
+
// Mirror of server computeFflfSafeFrames (server/services/videoGen/local.js):
// the largest numFrames that fits the FFLF/ltx2 stage-2 pixel-frame budget at
// this resolution, rounded down to the LTX 8k+1 latent boundary. The budget
@@ -1092,7 +1099,11 @@ export default function VideoGen() {
prompt: promptOut,
negativePrompt: composed.negativePrompt,
modelId,
- width, height,
+ // Clamp/floor to the runner's edge bounds so a transient 0 (field cleared
+ // mid-edit) or off-grid value can't 400 the server — mirrors ImageGen's
+ // submit-time clampImageEdge guard.
+ width: clampImageEdge(width, VIDEO_EDGE_BOUNDS),
+ height: clampImageEdge(height, VIDEO_EDGE_BOUNDS),
numFrames,
fps,
steps: steps || '',
@@ -1715,9 +1726,8 @@ export default function VideoGen() {
width={width}
height={height}
onChange={handleResolutionChange}
- min={64}
- max={2048}
- step={64}
+ {...VIDEO_EDGE_BOUNDS}
+ snapOnBlur
note="Each edge 64–2048px; the server rounds each down to the nearest multiple of 64."
/>