Avoid rendering generated images twice (#34378)

## What changed

- Tell the model that generated images are already displayed to the user and should not be repeated as Markdown images or file links.
- Keep generated-image artifact paths and output hints owned by the image generation extension.
- Centralize the availability check for the image generation tool across feature, provider, namespace-tool, model modality, and authentication requirements.

## Testing

- Verify artifact paths sanitize session and call identifiers.
- Verify the model-facing output hint reports that the generated image is already displayed.

GitOrigin-RevId: 6c865b6a96d6a71bb2c33246d1518a00e7c8b840
This commit is contained in:
Won Park authored and copyberry committed 2026-07-20 16:47:03 +00:00
1 parent 9a7e823e5b
commit 7e51abbbd1
12 files changed
+99 -95

No files matched your search

+3 -3
View File
@@ -8,8 +8,6 @@ use codex_api::ImageEditRequest;
use codex_api::ImageGenerationRequest;
use codex_api::ImageQuality;
use codex_api::ImageUrl;
use codex_core::context::extension_image_generation_output_hint;
use codex_core::image_generation_artifact_path;
use codex_exec_server::CreateDirectoryOptions;
use codex_exec_server::ExecutorFileSystem;
use codex_exec_server::LOCAL_FS;
@@ -52,6 +50,8 @@ use serde_json::Value;
use crate::IMAGE_GEN_NAMESPACE;
use crate::IMAGEGEN_TOOL_NAME;
use crate::artifact::image_generation_artifact_path;
use crate::artifact::image_generation_output_hint;
use crate::backend::CodexImagesBackend;
const IMAGE_MODEL: &str = "gpt-image-2";
@@ -217,7 +217,7 @@ impl ImageGenerationTool {
.await;
let output_hint = saved_path.as_ref().and_then(|output_path| {
let output_dir = output_path.parent()?;
extension_image_generation_output_hint(output_dir.display(), output_path.display())
image_generation_output_hint(output_dir.display(), output_path.display())
});
Ok(Box::new(GeneratedImageOutput {
result,