[codex] Make app file payloads schema-aware#31330
Draft
jacobzhou-oai wants to merge 1 commit into
Draft
Conversation
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Codex Apps file parameters are exposed to the model as local paths, then uploaded and rewritten into provided-file payloads during tool execution. The native bridge currently forwards the complete internal upload result, including fields that are not part of the downstream tool schema.
Strict Apps SDK tools reject those extra fields before executing. Adobe Photoshop is one concrete example: uploaded-image calls fail validation because
nativeImagereceivesmime_type,file_name,uri, andfile_size_byteseven though its schema accepts onlydownload_urlandfile_id.Root cause
The model-visible schema masking step retained only the names declared in
openai/fileParams. By execution time, Codex no longer knew which optional provided-file fields the original MCP schema accepted, so it serialized every field returned by the internal upload API.Changes
download_urlandfile_id.mime_typeandfile_nameonly when the target parameter schema explicitly declares them and the upload has a value.uriorfile_size_bytes.openai/fileParams.The existing Codex Apps cache already stores raw tool schemas. The new optional-field map is derived after cache load, so this does not require invalidating the cache format.
Validation
just fmtjust test -p codex-mcp(106 tests passed)git diff --checkI also attempted
just test -p codex-core mcp_openai_file. The changed Rust compiled, but the local machine ran out of disk during final test-binary linking (errno=28), so that focused test could not complete locally.Follow-up
This fixes the native Codex schema-validation failure. Adobe Photoshop still needs a separate app-side change for uploaded images: when
inputImageType="nativeImage", it should fetch fromnativeImage.download_urland usenativeImage.file_idas the stable reference instead of treatingoriginalUploadedImage="/workspace/..."as a fetchable local path.