Store image save hints on image generation calls#22372
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f11d249215
ℹ️ 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".
| *output_hint = Some( | ||
| ImageGenerationInstructions::new(image_output_dir.display(), saved_path.display()) | ||
| .body(), | ||
| ); |
There was a problem hiding this comment.
Do not replay output_hint to the Responses API
When an image generation succeeds, this embeds the local save note into the ResponseItem that is recorded in history. On the next turn, history is sent unchanged through History::for_prompt → Prompt::get_formatted_input → ResponsesApiRequest.input, so any conversation that generated an image will replay an image_generation_call with this synthetic output_hint field. The Responses API input schema for image_generation_call only accepts the tool-call fields such as id, result, status, and type (I also checked the official generated SDK/docs and found no output_hint field), so this can turn the following model request into a 400 instead of simply giving the model the save hint. Keep the hint in a Codex-only wrapper or strip it before building the API request.
Useful? React with 👍 / 👎.
|
name of the variable is tentative |
Why
Completed image generation calls need to carry their saved-image location into follow-up model turns without injecting a separate developer message into history. Keeping that hint on the
image_generation_callitself preserves the intended next-request shape and avoids adding extra synthetic context items.What changed
output_hintsupport toResponseItem::ImageGenerationCalland regenerated the app-server protocol artifacts.saved_pathbehavior unchanged.output_hintattached to the completed image generation call before it is recorded.handle_non_tool_response_itemfocused onTurnItememission.output_hint, text-only models still strip image bytes, and no separate developer saved-path note is emitted.Validation
just fmtcargo test -p codex-core image_savecargo test -p codex-core generated_image