Handle standalone image generation failures as terminal items (#27920)

## Why

Standalone image generation emitted a started item but no terminal item
when the backend failed. Clients could leave the operation unresolved or
render it as successful.

## What changed

- Emit a terminal image-generation item with `status: "failed"` when
generation or editing fails.
- Skip image persistence for failed terminal items.
- Render failed image generation distinctly in TUI history.
- Preserve the status when handling live and replayed terminal items.

## Looks for TUI, App-Side change needed 

<img width="867" height="89" alt="image"
src="https://github.com/user-attachments/assets/9e32342f-a982-411e-8498-456639fc468a"
/>

## Validation

- `just test -p codex-image-generation-extension`
- App-server image-generation tests
- Core stream-event tests
- TUI image-generation lifecycle and snapshot tests
- Scoped Clippy and formatting
This commit is contained in:
Won Park authored and GitHub committed 2026-06-12 11:57:22 -07:00
1 parent e26f734f91
commit b6baa77eec
10 files changed
+142 -17

No files matched your search

@@ -29,12 +29,14 @@ impl ChatWidget {
pub(super) fn on_image_generation_end(
&mut self,
call_id: String,
status: String,
revised_prompt: Option<String>,
saved_path: Option<AbsolutePathBuf>,
) {
self.flush_answer_stream_with_separator();
self.add_to_history(history_cell::new_image_generation_call(
call_id,
&status,
revised_prompt,
saved_path,
));