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 round 6: 2 Copilot findings on PR #181

Adam Eivyfb182cb288c0
diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsx
index 7da0db0c79..400a5d0895 100644
--- a/client/src/pages/ImageGen.jsx
+++ b/client/src/pages/ImageGen.jsx
@@ -249,14 +249,23 @@ export default function ImageGen() {
setStatusMsg(msg.message);
}
if (msg.type === 'complete') {
+ // Codex's built-in image_gen tool decides steps/guidance/seed
+ // internally and ignores whatever we pass — so don't backfill
+ // local-mode model defaults onto a codex render's metadata.
+ // The gallery / sidecar would otherwise show steps=20,
+ // guidance=3.5 (Flux 1 Dev defaults) on every codex image,
+ // misleading the user about what actually produced it.
+ const localOnlyMeta = isCodexMode ? {} : {
+ steps: payload.steps ?? currentModel?.steps,
+ guidance: payload.guidance ?? currentModel?.guidance,
+ };
setResult({
...data,
...msg.result,
prompt: payload.prompt,
negativePrompt: payload.negativePrompt,
width, height,
- steps: payload.steps ?? currentModel?.steps,
- guidance: payload.guidance ?? currentModel?.guidance,
+ ...localOnlyMeta,
});
es.close();
resolve(msg.result);
diff --git a/server/routes/imageGen.js b/server/routes/imageGen.js
index 3f4dd40af6..fe4271c6fa 100644
--- a/server/routes/imageGen.js
+++ b/server/routes/imageGen.js
@@ -56,8 +56,12 @@ const avatarSchema = z.object({
router.get('/status', asyncHandler(async (req, res) => {
// Optional ?mode= override lets the Image Gen page probe a specific
// backend (e.g. when the user flips the per-render chip to Codex but
- // hasn't saved Codex as the default yet).
- const mode = IMAGE_GEN_MODES.includes(req.query.mode) ? req.query.mode : undefined;
+ // hasn't saved Codex as the default yet). Express's default query
+ // parser turns duplicated keys (?mode=local&mode=codex) into arrays,
+ // so guard on string type before forwarding so `mode` always reaches
+ // the dispatcher as `string | undefined`.
+ const rawMode = req.query.mode;
+ const mode = typeof rawMode === 'string' && IMAGE_GEN_MODES.includes(rawMode) ? rawMode : undefined;
res.json(await imageGen.checkConnection({ mode }));
}));
diff --git a/server/routes/imageGen.test.js b/server/routes/imageGen.test.js
index b9ab198ce9..cfd189fae7 100644
--- a/server/routes/imageGen.test.js
+++ b/server/routes/imageGen.test.js
@@ -63,6 +63,17 @@ describe('Image Gen Routes', () => {
expect(response.status).toBe(200);
expect(imageGen.checkConnection).toHaveBeenCalledWith({ mode: undefined });
});
+
+ // Express turns ?mode=a&mode=b into an array — without the
+ // typeof === 'string' guard, that array would either match
+ // IMAGE_GEN_MODES.includes() falsely or propagate as a non-string
+ // mode to the dispatcher.
+ it('ignores a duplicated-key ?mode= array', async () => {
+ imageGen.checkConnection.mockResolvedValue({ connected: true, mode: 'external' });
+ const response = await request(app).get('/api/image-gen/status?mode=local&mode=codex');
+ expect(response.status).toBe(200);
+ expect(imageGen.checkConnection).toHaveBeenCalledWith({ mode: undefined });
+ });
});
describe('POST /api/image-gen/generate', () => {