mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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:
1 parent
e26f734f91
commit
b6baa77eec
10 files changed
+142
-17
No files matched your search
@@ -73,15 +73,17 @@ pub(crate) fn new_view_image_tool_call(path: AbsolutePathBuf, cwd: &Path) -> Pla
|
||||
|
||||
pub(crate) fn new_image_generation_call(
|
||||
call_id: String,
|
||||
status: &str,
|
||||
revised_prompt: Option<String>,
|
||||
saved_path: Option<AbsolutePathBuf>,
|
||||
) -> PlainHistoryCell {
|
||||
let detail = revised_prompt.unwrap_or_else(|| call_id.clone());
|
||||
|
||||
let mut lines: Vec<Line<'static>> = vec![
|
||||
vec!["• ".dim(), "Generated Image:".bold()].into(),
|
||||
vec![" └ ".dim(), detail.dim()].into(),
|
||||
];
|
||||
let detail = revised_prompt.unwrap_or(call_id);
|
||||
let heading = if status == "failed" {
|
||||
vec!["✗ ".red().bold(), "Image generation failed".bold()].into()
|
||||
} else {
|
||||
vec!["• ".dim(), "Generated Image:".bold()].into()
|
||||
};
|
||||
let mut lines: Vec<Line<'static>> = vec![heading, vec![" └ ".dim(), detail.dim()].into()];
|
||||
if let Some(saved_path) = saved_path {
|
||||
let saved_path = Url::from_file_path(saved_path.as_path())
|
||||
.map(|url| url.to_string())
|
||||
|
||||
@@ -474,6 +474,7 @@ fn image_generation_call_renders_saved_path() {
|
||||
);
|
||||
let cell = new_image_generation_call(
|
||||
"call-image-generation".to_string(),
|
||||
"completed",
|
||||
Some("A tiny blue square".to_string()),
|
||||
Some(saved_path),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user