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: image edge inputs use step=1 so odd sizes pass native form validation (#2436 review)

Adam Eivy0e09d352dabb
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 874bd1ba28..c53c8b2e36 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -8,7 +8,7 @@
- **Shell page quick-command buttons trimmed to the interactive tools.** Dropped the four shell one-liner shortcuts (`git status`, `git pull`, `npm test`, `npm run dev`) that duplicated things you'd just type, renamed the `antigravity` button to its actual command `agy`, and added a `grok` button alongside the other coding-agent launchers.
-- **Image and video generators now share one resolution control (#2436).** The image (`ImageGenControls`) and video (`VideoGen`) size pickers had diverged into two separate "preset dropdown + custom W×H" implementations over the same helper tables — and VideoGen rendered its Width/Height inputs twice. Both now consume a single `components/media/ResolutionField.jsx` (preset `<select>` + a "Custom…" sentinel that reveals gated Width/Height inputs with a blur-snap), and `clampImageEdge` in `imageGenResolutions.js` is generalized to accept `{ min, max, step }` so video (64–2048, multiples of 64) reuses it instead of its own ad-hoc handler. Behavior-preserving cleanup deferred from the custom-image-dimensions slice.
+- **Image and video generators now share one resolution control (#2436).** The image (`ImageGenControls`) and video (`VideoGen`) size pickers had diverged into two separate "preset dropdown + custom W×H" implementations over the same helper tables — and VideoGen rendered its Width/Height inputs twice. Both now consume a single `components/media/ResolutionField.jsx` (preset `<select>` + a "Custom…" sentinel that reveals gated Width/Height inputs with a blur-clamp), and `clampImageEdge` in `imageGenResolutions.js` is generalized to accept `{ min, max, step }` so video reuses it (clamping to 64–2048 and snapping to the multiple-of-64 grid the server floors to). The controls mirror their routes: the image edge inputs use `step=1` (its route accepts any integer edge, so a hand-typed 705 no longer trips the form's native step validation), while video keeps `step=64` and snaps on blur. Cleanup deferred from the custom-image-dimensions slice.
## Fixes
diff --git a/client/src/components/imageGen/ImageGenControls.jsx b/client/src/components/imageGen/ImageGenControls.jsx
index 0db3a82be0..ccb5e06d6f 100644
--- a/client/src/components/imageGen/ImageGenControls.jsx
+++ b/client/src/components/imageGen/ImageGenControls.jsx
@@ -87,11 +87,13 @@ export default function ImageGenControls({
</FormField>
)}
- {/* Preset dropdown + arbitrary width/height. The server accepts any edge
- in [64, 3840] with total pixels ≤ 8.29M (imageEdgeSchema +
- refineImagePixelCap), so custom sizes like 704×1280 (9:16 portrait)
- work without a new preset. Step 8 keeps values latent-friendly for
- the local diffusion runners. */}
+ {/* Preset dropdown + arbitrary width/height. The image route accepts ANY
+ integer edge in [64, 3840] with total pixels ≤ 8.29M (imageEdgeSchema
+ is `z.number().int().min(64).max(3840)` + refineImagePixelCap), so
+ custom sizes like 704×1280 (9:16 portrait) work without a new preset.
+ step=1 (not 8) so a hand-typed non-multiple-of-8 edge isn't blocked by
+ the form's native stepMismatch validation before submit — the note
+ keeps "multiples of 8 render best" as advice, not a hard constraint. */}
<ResolutionField
presets={availableResolutions}
width={width}
@@ -99,10 +101,11 @@ export default function ImageGenControls({
onChange={onResolutionChange}
min={64}
max={MAX_IMAGE_EDGE}
- step={8}
+ step={1}
maxPixels={MAX_IMAGE_PIXELS}
disabled={disabled}
inputClassName={inputCls}
+ note={`Each edge 64–${MAX_IMAGE_EDGE}px, total ≤ ${MAX_IMAGE_PIXELS.toLocaleString()} px. Multiples of 8 render best on local models.`}
/>
{/* Codex's image_gen tool ignores seed/steps/guidance — only resolution
diff --git a/client/src/components/media/ResolutionField.jsx b/client/src/components/media/ResolutionField.jsx
index 1a023feaf7..ae90ecfa1d 100644
--- a/client/src/components/media/ResolutionField.jsx
+++ b/client/src/components/media/ResolutionField.jsx
@@ -78,7 +78,8 @@ export default function ResolutionField({
};
const pixelCount = (width || 0) * (height || 0);
const overPixelCap = maxPixels != null && pixelCount > maxPixels;
- const defaultNote = `Each edge ${min}–${max}px${maxPixels != null ? `, total ≤ ${maxPixels.toLocaleString()} px` : ''}. Multiples of ${step} render best on local models.`;
+ const stepClause = step > 1 ? ` Multiples of ${step} render best on local models.` : '';
+ const defaultNote = `Each edge ${min}–${max}px${maxPixels != null ? `, total ≤ ${maxPixels.toLocaleString()} px` : ''}.${stepClause}`;
return (
<>
diff --git a/client/src/components/media/ResolutionField.test.jsx b/client/src/components/media/ResolutionField.test.jsx
index 29f1c20c95..d568c3ca07 100644
--- a/client/src/components/media/ResolutionField.test.jsx
+++ b/client/src/components/media/ResolutionField.test.jsx
@@ -12,7 +12,9 @@ const VIDEO_PRESETS = [
{ label: '1024×576 (16:9)', w: 1024, h: 576 },
];
-const imageBounds = { min: 64, max: 3840, step: 8, maxPixels: 8_294_400 };
+// Image route accepts any integer edge → step 1, no blur snap. Video route
+// floors to 64 → step 64 + snapOnBlur.
+const imageBounds = { min: 64, max: 3840, step: 1, maxPixels: 8_294_400 };
const videoBounds = { min: 64, max: 2048, step: 64, snapOnBlur: true };
describe('ResolutionField — preset dropdown', () => {
@@ -72,14 +74,20 @@ 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)', () => {
+ it('preserves an exact odd image edge on blur (no snap, clamp only)', () => {
const onChange = vi.fn();
- // 705 is in-bounds and not a multiple of 8; image must preserve it exactly.
+ // 705 is in-bounds and not a multiple of 8; the image route accepts any
+ // integer, so it must survive blur unchanged.
render(<ResolutionField presets={IMAGE_PRESETS} width={705} height={1024} onChange={onChange} {...imageBounds} />);
fireEvent.blur(screen.getByLabelText('Width'));
expect(onChange).toHaveBeenLastCalledWith(705, 1024);
});
+ it('renders the image number inputs with step=1 so odd edges pass native validation', () => {
+ render(<ResolutionField presets={IMAGE_PRESETS} width={705} height={1024} onChange={vi.fn()} {...imageBounds} />);
+ expect(screen.getByLabelText('Width').getAttribute('step')).toBe('1');
+ });
+
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();