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
address review (codex): source-authoritative i2i prompt + synchronous codex t2i guard
[._.]/ Adam Eivyd64d0f65b5fb
diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsxindex 68e455619d..c898877b39 100644--- a/client/src/pages/ImageGen.jsx+++ b/client/src/pages/ImageGen.jsx@@ -507,7 +507,11 @@ export default function ImageGen() {// — gallery PNGs are already baked correct.const handlePickGalleryInitImage = (item) => {if (!item?.filename) return;- if (item.raw) handleRemix(item.raw, { applyModel: false });+ if (item.raw) {+ handleRemix(item.raw, { applyModel: false });+ // Source-authoritative prompt: clear the form when the source has none.+ setPrompt(item.raw.prompt || '');+ }revokeIfBlob(initImage.previewUrl);setInitImage({ source: 'gallery', file: null, name: item.filename, previewUrl: item.previewUrl || `/data/images/${item.filename}` });};@@ -1018,6 +1022,9 @@ export default function ImageGen() {const handleSendToImage = (img) => {if (!img?.filename) return;handleRemix(img, { applyModel: false });+ // i2i is source-authoritative: an empty source prompt must clear the form, not+ // leave stale text conditioning the render (handleRemix only sets when truthy).+ setPrompt(img.prompt || '');ensureI2iCapableMode();revokeIfBlob(initImage.previewUrl);setInitImage({ source: 'gallery', file: null, name: img.filename, previewUrl: `/data/images/${img.filename}` });diff --git a/server/routes/imageGen.js b/server/routes/imageGen.jsindex 51af44e201..1c4b3dff52 100644--- a/server/routes/imageGen.js+++ b/server/routes/imageGen.js@@ -316,6 +316,13 @@ router.post('/generate', imageGenUploads, asyncHandler(async (req, res) => {data.referenceImagePaths = referenceImagePaths;data.referenceImageStrengths = referenceImageStrengths;}+ // Empty prompt is allowed for i2i / local / external, but Codex text-to-image+ // (no init image) still needs one — reject synchronously here so direct API+ // callers get a 400 instead of a 200-then-async-job-failure. Mirrors the guard+ // in codex.js and the client's codexNeedsPrompt gate.+ if (mode === IMAGE_GEN_MODE.CODEX && !initImagePath && !data.prompt?.trim()) {+ throw new ServerError('Prompt is required for Codex text-to-image', { status: 400, code: 'VALIDATION_ERROR' });+ }if (data.guidance == null && data.cfgScale != null) {data.guidance = data.cfgScale;}diff --git a/server/routes/imageGen.test.js b/server/routes/imageGen.test.jsindex 3f2ad13ad1..a21140b9b7 100644--- a/server/routes/imageGen.test.js+++ b/server/routes/imageGen.test.js@@ -174,6 +174,15 @@ describe('Image Gen Routes', () => {expect(imageGen.generateImage).toHaveBeenCalledWith(expect.objectContaining({ prompt: '' }));});+ it('rejects a Codex text-to-image request with no prompt and no init image (synchronous 400)', async () => {+ const response = await request(app)+ .post('/api/image-gen/generate')+ .send({ mode: 'codex' });++ expect(response.status).toBe(400);+ expect(response.body.code).toBe('VALIDATION_ERROR');+ });+it('should validate width and height bounds', async () => {const response = await request(app).post('/api/image-gen/generate')