Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(images): prevent duplicate generated previews

vastsa71ca7003460b
diff --git a/apps/desktop/resources/skills/image-generation.md b/apps/desktop/resources/skills/image-generation.md
index 7e4178b48..1a46d3009 100644
--- a/apps/desktop/resources/skills/image-generation.md
+++ b/apps/desktop/resources/skills/image-generation.md
@@ -47,8 +47,10 @@ model is configured, direct the user to Settings → Models; do not select one s
## Deliver the result
Results are ordered and contain a status and, for successes, a local image path.
-Show the successful images with Markdown image links and report failed items.
-The desktop also renders their previews directly from the tool result.
+The desktop renders successful images directly from the tool result in the
+conversation. Do not repeat those result paths as Markdown image links; that
+would display the same images twice. Briefly confirm what was generated and
+report failed items.
Use available image inspection tools to check the result when possible. Do not
claim to have visually inspected an image if you only received its file path.
diff --git a/apps/desktop/test/image-generation.test.mjs b/apps/desktop/test/image-generation.test.mjs
index 4cba0e98a..0c0d34efd 100644
--- a/apps/desktop/test/image-generation.test.mjs
+++ b/apps/desktop/test/image-generation.test.mjs
@@ -115,6 +115,8 @@ test("the default imagegen skill is discoverable and loads in an ordinary sessio
assert.match(body, /GenerateImages/);
assert.match(body, /previous result path/);
assert.match(body, /Do not retry/);
+ assert.match(body, /desktop renders successful images directly from the tool result/i);
+ assert.match(body, /Do not repeat those result paths as Markdown image links/i);
assert.equal(loadBuiltinSkillBody("../../outside"), null);
});
diff --git a/docs/spec/03-runtime/21-image-generation.md b/docs/spec/03-runtime/21-image-generation.md
index 684bbb74d..ece281f52 100644
--- a/docs/spec/03-runtime/21-image-generation.md
+++ b/docs/spec/03-runtime/21-image-generation.md
@@ -96,6 +96,11 @@ path. A missing or unreadable preview has no download action; revealing a
missing file reports an error. These actions do not move or overwrite the
original scratch file.
+The renderer owns successful-result previews in the conversation. The bundled
+imagegen skill confirms generation in text and reports failures, but does not
+embed those same result paths as Markdown images; doing so duplicates the
+renderer preview.
+
Each result records index, status (`succeeded`, `failed`, `cancelled`), successful
path/MIME type or a safe error code. New files get unique names in session scratch;
editing never overwrites its source. The tool result and transcript retain file
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index a1964a113..0144091f1 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -16543,12 +16543,15 @@ the latest destination. These assertions measure work counts, not device FPS.
host data directory, local image HTTP fixture, no production credentials.
- **Steps:** Choose a model in Advanced, cancel and verify no change; save and
replace it through another provider's Advanced settings. Clear the binding via
- the test settings API to verify recovery. Generate same-prompt variants and distinct images,
- edit a generated image, inspect partial failures, then restart the host/session.
- Attempt the tool in a durable Plan session and verify no HTTP request occurs.
+ the test settings API to verify recovery. Generate same-prompt variants and
+ distinct images; confirm each result appears once in the conversation gallery
+ while the assistant confirms completion in text. Edit a generated image,
+ inspect partial failures, then restart the host/session. Attempt the tool in a
+ durable Plan session and verify no HTTP request occurs.
- **Expected:** One image binding persists without changing the chat default;
generated files, edit sources and transcript references survive restart.
- Images render in chat; unconfigured errors navigate to Models settings.
+ Each successful image appears once in its result card instead of being
+ repeated as a Markdown embed; unconfigured errors navigate to Models settings.
- **Specs:** 03-runtime/21-image-generation; 03-runtime/13-model-catalog-and-selection.
- **Acceptance:** Configured image generation/editing, safe cancellation and persistence.
- **Milestone:** Post-MVP.