Skip to content

[codex] Route MCP file uploads through environment filesystem#27923

Merged
pakrym-oai merged 10 commits into
mainfrom
pakrym/full-ci-mcp-file-fs
Jun 16, 2026
Merged

[codex] Route MCP file uploads through environment filesystem#27923
pakrym-oai merged 10 commits into
mainfrom
pakrym/full-ci-mcp-file-fs

Conversation

@pakrym-oai

@pakrym-oai pakrym-oai commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Why

Codex Apps tools can mark arguments with openai/fileParams, but the execution path resolved and opened those files directly on the host. That bypassed the selected turn environment and prevented annotated file arguments from working with remote environments.

What changed

  • resolve annotated file arguments against the primary turn environment
  • read file metadata and contents through that environment's sandboxed ExecutorFileSystem
  • reject files over the 512 MiB limit from metadata before reading or transferring them
  • retain the buffered upload-size check as defense in depth
  • make the OpenAI upload API accept a filename and buffered contents instead of owning local filesystem access
  • describe the model-visible argument as a path in the primary environment

This builds on #27927, which added size to internal filesystem metadata.

Testing

  • just test -p codex-api upload_openai_file_returns_canonical_uri
  • just test -p codex-mcp tool_with_model_visible_input_schema_masks_file_params
  • just test -p codex-core mcp_openai_file
  • just test -p codex-core codex_apps_file_params_upload_environment_files_before_mcp_tool_call

@pakrym-oai
pakrym-oai force-pushed the pakrym/full-ci-mcp-file-fs branch from a01923b to fe2a373 Compare June 12, 2026 19:11
@pakrym-oai
pakrym-oai changed the base branch from main to pakrym/full-ci-file-metadata-size June 12, 2026 19:11
Base automatically changed from pakrym/full-ci-file-metadata-size to main June 12, 2026 19:12
@pakrym-oai
pakrym-oai marked this pull request as ready for review June 12, 2026 19:14
@pakrym-oai
pakrym-oai requested a review from a team as a code owner June 12, 2026 19:14
@pakrym-oai
pakrym-oai force-pushed the pakrym/full-ci-mcp-file-fs branch from e6cf84e to 263a7db Compare June 12, 2026 19:15
pakrym-oai added a commit that referenced this pull request Jun 12, 2026
@pakrym-oai

Copy link
Copy Markdown
Contributor 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: 0ecbff24e7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/core/src/mcp_openai_file.rs Outdated
Comment thread codex-rs/core/tests/suite/openai_file_mcp.rs Outdated
@pakrym-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 53875b67c6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jif-oai jif-oai 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.

Pre-approved after my comments

Comment thread codex-rs/core/src/mcp_openai_file.rs
Comment thread codex-rs/core/src/mcp_openai_file.rs Outdated
resolved_path.display()
))
})?;
let sandbox = turn_context.file_system_sandbox_context(

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.

(found by Codex)
This drops approved request_permissions grants: a user can grant turn/session read access to this file, but we still build the sandbox with None, so the metadata/read are denied

@pakrym-oai
pakrym-oai force-pushed the pakrym/full-ci-mcp-file-fs branch from 53875b6 to fac2ffd Compare June 16, 2026 17:05
@pakrym-oai
pakrym-oai merged commit 7baf7e4 into main Jun 16, 2026
61 of 75 checks passed
@pakrym-oai
pakrym-oai deleted the pakrym/full-ci-mcp-file-fs branch June 16, 2026 18:27
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 16, 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