Route standalone image generation through host finalization md#25176
Conversation
| let conversation_history = | ||
| ConversationHistory::new(invocation.session.clone_history().await.into_raw_items()); | ||
| ExtensionToolCall { | ||
| thread_id: invocation.session.conversation_id.to_string(), |
There was a problem hiding this comment.
to know where it's saved
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf947390ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| call.turn_item_emitter | ||
| .emit_started(ExtensionTurnItem::ImageGeneration(ImageGenerationItem { | ||
| id: call.call_id.clone(), | ||
| status: "in_progress".to_string(), | ||
| revised_prompt: None, |
There was a problem hiding this comment.
Emit a terminal image item on generation failure
When the image backend fails or returns no image data after this emit_started, handle returns FunctionCallError before any matching completed/failed image-generation item is emitted. The generic tool error path only returns a failed FunctionCallOutput, so app-server/TUI clients that already received this started item can leave the image generation permanently in progress for quota, network, or upstream failures; before this change the image item was only started after a successful result was available.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
the error is sent to the model, no need for separate ui on this imo
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e9606e804
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| result, | ||
| output_hint, | ||
| })) | ||
| Ok(Box::new(GeneratedImageOutput { result })) |
There was a problem hiding this comment.
Return the saved image path to the model
After successful standalone image generation, this now returns a GeneratedImageOutput that only serializes the image bytes, while the persisted saved_path is only emitted to clients via the turn item and is not added to the model-facing function output or conversation history. In the common follow-up where the model needs to inspect, copy, or edit the generated file from the shell, it no longer knows the deterministic artifact path that was previously included by image_generation_completed when persistence succeeded.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
this is highly relevant to the PR but i'm putting this separately for sake of reviewer
jif-oai
left a comment
There was a problem hiding this comment.
See Slack comment + I agree with the remaining open comment but the rest lgtm
Why
Standalone image-generation extensions emitted turn items through the low-level event path, bypassing host-owned finalization such as image persistence and contributor processing. At the same time, the generated-image save-path hint must remain visible to the model through the extension tool's
FunctionCallOutput, rather than the legacy built-in developer-message path.What changed
ExtensionTurnItemto support image-generation items while keeping the extension-facing emitter API limited toemit_startedandemit_completed.finalize_turn_item, so standalone image-generation items receive host-owned processing and persistedsaved_pathvalues before publication.FunctionCallOutput.Validation
just fmtjust test -p codex-image-generation-extensionjust test -p codex-web-search-extensionjust test -p codex-goal-extensionjust test -p codex-memories-extensioncodex-coretests for image save history, extension completion finalization, and contributor executionjust test -p codex-app-server standalone_image_generation_returns_saved_path_hint_to_modeljust fix -p codex-corejust fix -p codex-image-generation-extensionjust bazel-lock-updatejust bazel-lock-check