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

address review (claude): sticky auto-engaged custom mode + clamp dims at submit

Adam Eivye58b5965c80e
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 018def0cf2..dd5aec8041 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -12,7 +12,7 @@
- **Code Review Defaults can now gate merges on arbitrary GitHub reviewer usernames (e.g. `@CodeReviewbot`).** The Review Loop was limited to a fixed set of reviewer kinds (Copilot, the Claude/Antigravity/Codex CLIs, and the local LM Studio/Ollama backends); there was no way to require a specific GitHub bot or teammate as a PR reviewer. The reviewer picker (AI Providers → Code Review Defaults, plus per-task in the task form and per-task-type in the Schedule config) grows a **"GitHub reviewers (gate merge)"** row where you type any GitHub username or `org/team` slug. Those usernames are appended to slashdo's `--review-with` as `@user` tokens after the keyed reviewers, and the review-loop follow-up agent is instructed to request each as a PR reviewer (`gh pr edit … --add-reviewer`), wait for their review, and treat their approval as a merge gate — end to end through the original-agent completion prompt, the follow-up loop, and the `/do:next` claim flow. Usernames are stored without the `@`, validated against a shell-safe GitHub-username charset (1–39 chars, alphanumeric/hyphen, optional `/team`), case-insensitively deduped, and capped at 20, so a hand-edited `settings.json` can't smuggle in an unsafe or oversized token. They're a distinct class from the behavior reviewers — external PR reviewers that gate the merge, not CLIs that apply fixes — so `--reviewer-applies` never turns on for a username-only addition, and a username reviewer is forge-agnostic (kept even when Copilot is stripped on a non-GitHub forge, and able to drive the loop on its own). New config key: `settings.codeReview.usernames` (+ per-task `metadata.usernames`); no migration needed (absent = none).
-- **Image Gen now supports arbitrary (larger) output dimensions, not just the fixed preset list.** The resolution dropdown gained a **Custom…** entry that reveals Width and Height number inputs, so sizes the presets never covered — e.g. 704×1280 (9:16 portrait) for Z-Image — no longer require adding a new preset. Any edge in 64–3840px is accepted as long as the total stays ≤ 8,294,400px (the same `imageEdgeSchema` + pixel cap the server already enforced); a below-minimum edge snaps up to 64 on blur, and an over-cap total shows an inline warning before you submit. Custom mode also auto-engages whenever the current size matches no preset (a remix, an uploaded init image, or a stale off-backend size), so the exact dimensions stay visible and editable instead of collapsing to a read-only "(custom)" label. The inputs live in the shared `ImageGenControls`, so the Image Gen page, Universe Builder batch render, and the pipeline image-gen drawers all get custom dimensions at once.
+- **Image Gen now supports arbitrary (larger) output dimensions, not just the fixed preset list.** The resolution dropdown gained a **Custom…** entry that reveals Width and Height number inputs, so sizes the presets never covered — e.g. 704×1280 (9:16 portrait) for Z-Image — no longer require adding a new preset. Any edge in 64–3840px is accepted as long as the total stays ≤ 8,294,400px (the same `imageEdgeSchema` + pixel cap the server already enforced); a below-minimum edge snaps up to 64 (on blur, and again at submit so an Enter-key submit can't slip a sub-64 value through), and an over-cap total shows an inline warning before you submit. Custom mode also auto-engages whenever the current size matches no preset (a remix, an uploaded init image, or a stale off-backend size), so the exact dimensions stay visible and editable instead of collapsing to a read-only "(custom)" label. The inputs live in the shared `ImageGenControls`, so the Image Gen page, Universe Builder batch render, and the pipeline image-gen drawers all get custom dimensions at once.
- **Layered Intelligence now learns from its own results — the feedback loop is closed (#2428).** The LI reasoner used to file improvement proposals as tracker issues and then never read back whether they were merged, rejected, or abandoned, so it proposed in a vacuum (re-suggesting scopes with a 0% adoption rate). LI now records every filed proposal in a lightweight per-app outcome store (`data/cos/li-outcomes/`, a `createCollectionStore` collection with per-slug records and 30-day auto-GC), reconciles each proposal's outcome from the live tracker state on the next run (GitHub `stateReason` maps *not-planned* → rejected, any other close → merged; still-open stays unresolved), and folds a merge-rate report — totals, per-scope adoption, common rejection reasons — back into the reasoning prompt with guidance to prefer higher-merge scopes and justify low-merge ones. Gated behind a new `Proposal outcomes` telemetry source toggle in the per-app LI config (default **on** for the PortOS install, **off** for managed apps). No migration needed — the store is created on first use and existing LI behavior is unchanged when the toggle is off.
diff --git a/client/src/components/imageGen/ImageGenControls.jsx b/client/src/components/imageGen/ImageGenControls.jsx
index e2c7834788..acc6cb67e0 100644
--- a/client/src/components/imageGen/ImageGenControls.jsx
+++ b/client/src/components/imageGen/ImageGenControls.jsx
@@ -8,7 +8,7 @@
// reshaping. `mode` drives which knobs are visible: codex hides everything except
// resolution; external swaps guidance for cfgScale; local shows guidance + quantize.
-import { useState } from 'react';
+import { useState, useEffect } from 'react';
import { Dice5 } from 'lucide-react';
import {
filterResolutions, resolveResolutionLabel, clampImageEdge,
@@ -72,6 +72,14 @@ export default function ImageGenControls({
const [customOpen, setCustomOpen] = useState(false);
const isCustom = customOpen || (!matched && !!width && !!height);
const selectValue = isCustom ? CUSTOM_RESOLUTION_VALUE : (matched?.label ?? '');
+ // Latch custom mode stickily once a non-preset size appears (remix, uploaded
+ // photo, stale off-backend size). Without this, clearing a Width/Height field
+ // to a transient 0 mid-edit would flip `!matched && width && height` false and
+ // unmount the inputs the user is typing into — which also skips the blur-snap.
+ // `handleResolution` still clears the latch when a preset is explicitly picked.
+ useEffect(() => {
+ if (!matched && width && height) setCustomOpen(true);
+ }, [matched, width, height]);
const handleResolution = (e) => {
if (e.target.value === CUSTOM_RESOLUTION_VALUE) { setCustomOpen(true); return; }
const r = availableResolutions.find((opt) => opt.label === e.target.value);
diff --git a/client/src/components/imageGen/ImageGenControls.test.jsx b/client/src/components/imageGen/ImageGenControls.test.jsx
index 59a56273fc..3368761f6d 100644
--- a/client/src/components/imageGen/ImageGenControls.test.jsx
+++ b/client/src/components/imageGen/ImageGenControls.test.jsx
@@ -1,3 +1,4 @@
+import { useState } from 'react';
import { describe, it, expect, vi } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/react';
import ImageGenControls from './ImageGenControls';
@@ -52,4 +53,31 @@ describe('ImageGenControls — custom dimensions', () => {
render(<ImageGenControls {...baseProps({ width: 3840, height: 3840 })} />);
expect(screen.getByText(/exceeds the .* px cap/i)).toBeTruthy();
});
+
+ // Regression: an auto-engaged (non-preset) size must stay in custom mode when a
+ // field is cleared to a transient 0 mid-edit — otherwise the inputs unmount
+ // mid-keystroke and the blur-snap never fires. Uses a stateful harness so the
+ // cleared value actually re-renders the component.
+ it('keeps the custom inputs mounted when a dimension is cleared mid-edit', () => {
+ function Harness() {
+ const [dims, setDims] = useState({ width: 704, height: 1280 });
+ return (
+ <ImageGenControls
+ {...baseProps({
+ width: dims.width,
+ height: dims.height,
+ onResolutionChange: (w, h) => setDims({ width: w, height: h }),
+ })}
+ />
+ );
+ }
+ render(<Harness />);
+ // Auto-engaged (704×1280 matches no preset) → inputs visible.
+ expect(screen.getByLabelText('Height')).toBeTruthy();
+ // Clear Height → emits 0 → re-render with height=0.
+ fireEvent.change(screen.getByLabelText('Height'), { target: { value: '' } });
+ // Sticky latch keeps both inputs mounted despite height=0.
+ expect(screen.getByLabelText('Width')).toBeTruthy();
+ expect(screen.getByLabelText('Height')).toBeTruthy();
+ });
});
diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsx
index e5c3507cc8..ee9c8002d3 100644
--- a/client/src/pages/ImageGen.jsx
+++ b/client/src/pages/ImageGen.jsx
@@ -38,7 +38,7 @@ import {
} from 'lucide-react';
import { composeStyledPrompt } from '../lib/composeStyledPrompt';
import { deriveAvailableBackends, IMAGE_GEN_MODE, isI2iCapableMode, pickI2iMode } from '../lib/imageGenBackends';
-import { clampImageDimensions } from '../lib/imageGenResolutions';
+import { clampImageDimensions, clampImageEdge } from '../lib/imageGenResolutions';
import { DEFAULT_NEGATIVE_PROMPT } from '../lib/imageGenDefaults';
import { resolveCleanersFromConfig } from '../lib/imageCleaners';
import toast from '../components/ui/Toast';
@@ -717,17 +717,23 @@ export default function ImageGen() {
// sits in the server queue until the active one finishes.
const submitGenerationPayload = async () => {
const composed = composeStyledPrompt(prompt, negativePrompt, stylePreset);
+ // Custom-dimension inputs emit raw values for smooth typing and snap on blur;
+ // an Enter-submit (or a field cleared to 0) can bypass that blur, so clamp to
+ // the server's per-edge bounds here too — the last line of defense before the
+ // payload hits imageEdgeSchema.
+ const w = clampImageEdge(width);
+ const h = clampImageEdge(height);
const payload = isCodexMode ? {
prompt: composed.prompt,
negativePrompt: composed.negativePrompt || undefined,
- width, height,
+ width: w, height: h,
mode: IMAGE_GEN_MODE.CODEX,
cleanC2PA, denoise,
} : {
prompt: composed.prompt,
negativePrompt: composed.negativePrompt || undefined,
modelId: modelId || undefined,
- width, height,
+ width: w, height: h,
steps: steps ? Number(steps) : undefined,
guidance: guidance ? Number(guidance) : undefined,
seed: seed && Number(seed) >= 0 ? Number(seed) : undefined,
@@ -839,6 +845,13 @@ export default function ImageGen() {
if (editImageMissing || codexNeedsPrompt) return;
const batchN = isAsyncMode ? Math.max(1, batchCount) : 1;
if (generating) return queueAdditional(batchN);
+ // Snap the custom-dimension state to the server's per-edge bounds up front
+ // (an Enter-submit can beat the input's blur-snap), and reflect the clamp in
+ // the form so the displayed size matches what gets rendered.
+ const clampedW = clampImageEdge(width);
+ const clampedH = clampImageEdge(height);
+ if (clampedW !== width) setWidth(clampedW);
+ if (clampedH !== height) setHeight(clampedH);
setGenerating(true);
setStatusMsg('Starting...');
setError(null);
@@ -863,7 +876,7 @@ export default function ImageGen() {
const payload = {
prompt: composed.prompt,
negativePrompt: composed.negativePrompt || undefined,
- width, height,
+ width: clampedW, height: clampedH,
steps: steps ? Number(steps) : 25,
cfgScale,
mode: IMAGE_GEN_MODE.EXTERNAL,
@@ -871,7 +884,7 @@ export default function ImageGen() {
};
if (seed && Number(seed) >= 0) payload.seed = Number(seed);
const data = await generateImage(payload);
- setResult({ ...data, prompt: payload.prompt, negativePrompt: payload.negativePrompt, width, height, steps: payload.steps, cfgScale });
+ setResult({ ...data, prompt: payload.prompt, negativePrompt: payload.negativePrompt, width: clampedW, height: clampedH, steps: payload.steps, cfgScale });
}
toast.success('Image generated');
refreshGallery();