Make js_repl image output controllable#13331
Conversation
bb627f5 to
aa0708e
Compare
aa0708e to
19f2421
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19f24217d0
ℹ️ 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".
19f2421 to
03e2f59
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03e2f59d28
ℹ️ 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".
03e2f59 to
3f1753d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f1753daea
ℹ️ 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".
3f1753d to
879cf67
Compare
879cf67 to
86ab8ea
Compare
86ab8ea to
bb0fe78
Compare
2f32ae2 to
6c3916e
Compare
6c3916e to
95e0034
Compare
95e0034 to
2f438d7
Compare
2f438d7 to
5af28d4
Compare
5af28d4 to
c64b9e3
Compare
c64b9e3 to
dcd9586
Compare
dcd9586 to
c6c0b72
Compare
## Summary
Add original-resolution support for `view_image` behind the
under-development `view_image_original_resolution` feature flag.
When the flag is enabled and the target model is `gpt-5.3-codex` or
newer, `view_image` now preserves original PNG/JPEG/WebP bytes and sends
`detail: "original"` to the Responses API instead of using the legacy
resize/compress path.
## What changed
- Added `view_image_original_resolution` as an under-development feature
flag.
- Added `ImageDetail` to the protocol models and support for serializing
`detail: "original"` on tool-returned images.
- Added `PromptImageMode::Original` to `codex-utils-image`.
- Preserves original PNG/JPEG/WebP bytes.
- Keeps legacy behavior for the resize path.
- Updated `view_image` to:
- use the shared `local_image_content_items_with_label_number(...)`
helper in both code paths
- select original-resolution mode only when:
- the feature flag is enabled, and
- the model slug parses as `gpt-5.3-codex` or newer
- Kept local user image attachments on the existing resize path; this
change is specific to `view_image`.
- Updated history/image accounting so only `detail: "original"` images
use the docs-based GPT-5 image cost calculation; legacy images still use
the old fixed estimate.
- Added JS REPL guidance, gated on the same feature flag, to prefer JPEG
at 85% quality unless lossless is required, while still allowing other
formats when explicitly requested.
- Updated tests and helper code that construct
`FunctionCallOutputContentItem::InputImage` to carry the new `detail`
field.
## Behavior
### Feature off
- `view_image` keeps the existing resize/re-encode behavior.
- History estimation keeps the existing fixed-cost heuristic.
### Feature on + `gpt-5.3-codex+`
- `view_image` sends original-resolution images with `detail:
"original"`.
- PNG/JPEG/WebP source bytes are preserved when possible.
- History estimation uses the GPT-5 docs-based image-cost calculation
for those `detail: "original"` images.
#### [git stack](https://github.com/magus/git-stack-cli)
- 👉 `1` #13050
- ⏳ `2` #13331
- ⏳ `3` #13049
git-stack-id: fjord/original_image_res---4hxjh7uv9pkj_8 git-stack-title: Make js_repl image output controllable
c6c0b72 to
63150b8
Compare
Summary
Instead of always adding inner function call outputs to the model context, let js code decide which ones to return.
codex.tool(...)into the outerjs_replfunction output.codex.tool(...)return values unchanged as structured JS objects.codex.emitImage(...)as the explicit path for attaching an image to the outerjs_replfunction output.input_imageitem, an explicit{ bytes, mimeType }object, or a raw tool response object containing exactly one image.view_imageoriginal-resolution behavior when JS emits the rawview_imagetool result.ViewImageToolCallevent forjs_repl-sourcedview_imagecalls so nested inspection stays side-effect free until JS explicitly emits.js_repldocs and generated project instructions with both recommended patterns:await codex.emitImage(codex.tool("view_image", { path }))await codex.emitImage({ bytes: await page.screenshot({ type: "jpeg", quality: 85 }), mimeType: "image/jpeg" })git stack
1Add under-development original-resolution view_image support #130502Make js_repl image output controllable #133313Enforce the Responses API 50 MB image limit #13049