Skip to content

Add saved image path hint to standalone image generation#25947

Merged
won-openai merged 4 commits into
mainfrom
image_hint_injection
Jun 4, 2026
Merged

Add saved image path hint to standalone image generation#25947
won-openai merged 4 commits into
mainfrom
image_hint_injection

Conversation

@won-openai

Copy link
Copy Markdown
Collaborator

Why

Standalone image generation returns image bytes to the model, but the model also needs the host artifact path to reference the generated file in follow-up work.

What changed

  • Append the default saved-image path hint alongside the generated image tool output.
  • Reuse the existing core image-generation hint text.
  • Pass the thread ID and Codex home directory needed to compute the artifact path.
  • Add app-server and extension coverage for the model-visible hint.

Validation

  • just fmt
  • just bazel-lock-check
  • just test -p codex-app-server standalone_image_generation_returns_saved_path_hint_to_model

@won-openai won-openai requested a review from a team as a code owner June 2, 2026 21:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d1ed8cefc

ℹ️ 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".

Comment thread codex-rs/ext/image-generation/src/tool.rs Outdated
Comment thread codex-rs/tools/src/tool_call.rs Outdated
Comment thread codex-rs/ext/image-generation/src/tool.rs Outdated
@won-openai won-openai force-pushed the image_hint_injection branch from dbbe6f8 to 5b371f3 Compare June 3, 2026 07:22
@won-openai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffdbcb79cc

ℹ️ 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".

codex-model-provider-info = { workspace = true }
codex-protocol = { workspace = true }
codex-tools = { workspace = true }
codex-utils-absolute-path = { workspace = true }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh Bazel lockfile for the new dependency

Adding this workspace dependency changes the Rust dependency graph, but the commit does not include the corresponding MODULE.bazel.lock update required by the root AGENTS.md dependency-change rule. I checked this commit locally with just bazel-lock-check; it exits with MODULE.bazel.lock is out of date. Run 'just bazel-lock-update' and commit the updated lockfile., so Bazel lock validation will fail until the lockfile update is committed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already ran this and no change

Comment on lines +137 to +138
let output_hint =
extension_image_generation_output_hint(output_dir.display(), output_path.display());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Only advertise the saved path after persistence succeeds

When the image bytes are valid but core fails to write the artifact (for example, codex_home is unwritable or the disk is full), persist_image_generation_item leaves saved_path as None, but this code still appends a model-visible hint saying the image is saved at the computed path. That makes follow-up model work reference a file that does not exist; the hint should be emitted only after the core finalization path confirms the image was actually persisted, matching the hosted image-generation behavior.

Useful? React with 👍 / 👎.

@won-openai won-openai merged commit 12e8764 into main Jun 4, 2026
31 checks passed
@won-openai won-openai deleted the image_hint_injection branch June 4, 2026 16:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants