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 (codex): attach synchronously-rendered images (external SD-API)

[._.]/ Adam Eivyb0240f8ad128
diff --git a/client/src/pages/CatalogIngredient.jsx b/client/src/pages/CatalogIngredient.jsx
index 626e0c4981..7dd140215f 100644
--- a/client/src/pages/CatalogIngredient.jsx
+++ b/client/src/pages/CatalogIngredient.jsx
@@ -870,9 +870,18 @@ function GenerateImageControl({ name, description, onComplete }) {
).catch((err) => { toast.error(err?.message || 'Image generation failed'); return null; });
if (!mountedRef.current) return;
setStarting(false);
- if (!queued?.jobId) return;
- setJobId(queued.jobId);
- toast.success('Generating image…');
+ if (!queued) return;
+ if (queued.jobId) {
+ // Local/Codex modes enqueue a job — track it live via MediaJobThumb.
+ setJobId(queued.jobId);
+ toast.success('Generating image…');
+ } else if (queued.filename) {
+ // External SD-API mode renders synchronously and returns the finished
+ // filename with no jobId — attach it directly.
+ onComplete?.(queued.filename);
+ } else {
+ toast.error('Image generation returned no result');
+ }
};
// Fires once when the in-flight job completes (MediaJobThumb forwards the
diff --git a/client/src/pages/CatalogIngredient.test.jsx b/client/src/pages/CatalogIngredient.test.jsx
index f56e0f8c27..c1d050e52b 100644
--- a/client/src/pages/CatalogIngredient.test.jsx
+++ b/client/src/pages/CatalogIngredient.test.jsx
@@ -205,6 +205,21 @@ describe('CatalogIngredient — character sheet', () => {
));
});
+ it('attaches a synchronously-returned image (external mode, no jobId)', async () => {
+ const { generateImage } = await import('../services/apiSystem');
+ const { setCatalogIngredientPortrait } = await import('../services/apiCatalog');
+ generateImage.mockResolvedValue({ filename: 'ext.png' }); // external SD-API: no jobId
+ setCatalogIngredientPortrait.mockResolvedValue({});
+ renderPage();
+ await waitFor(() => expect(screen.getByDisplayValue('Sharp eyes, ink-stained cuffs.')).toBeTruthy());
+
+ fireEvent.click(screen.getByRole('button', { name: /^Generate$/i }));
+
+ await waitFor(() => expect(setCatalogIngredientPortrait).toHaveBeenCalledWith(
+ 'cat-chr-1', { mediaKey: 'ext.png' }, { silent: true },
+ ));
+ });
+
it('re-enables Generate after a failed render (does not get stuck)', async () => {
const { generateImage } = await import('../services/apiSystem');
generateImage.mockResolvedValue({ jobId: 'fail-job' });