Skip to content

[codex] Add OpenAI file support for builtin codex_apps tools#18153

Draft
lt-oai wants to merge 9 commits intomainfrom
codex/library-mcp-rebased
Draft

[codex] Add OpenAI file support for builtin codex_apps tools#18153
lt-oai wants to merge 9 commits intomainfrom
codex/library-mcp-rebased

Conversation

@lt-oai
Copy link
Copy Markdown

@lt-oai lt-oai commented Apr 16, 2026

Summary

https://github.com/openai/openai/pull/833843

Add support for builtin codex_apps tools (e.g., ChatGPT Library tool) that use OpenAI file upload and download semantics.

  • Uploads path follows the same approach as Add Codex Apps sediment file remapping #15197 -- local file-path arguments for Library tools declared with openai/fileParams metadata, then rewrites them into OpenAI file references before the MCP tool call.
    • Skips the deprecated /files/{file_id}/uploaded finalize call for library (store_in_library=true) uploads.
  • metadata-driven "builtin" codex_apps support
  • Download path materializes (metadata-driven) Library download results back to local files so downstream tools can reuse them.
  • Adds openai_file_api_base_url for local/dev, since chatgpt_base_url points at local codex-backend while the file API lives on sa-server. (Note: in staging/prod, both codex-backend and sa-server has the same base URL)

High-level approach

  • Treat some codex_apps tools as first-party builtin tools, identified by backend-provided _codex_apps metadata.
  • Use that metadata to:
    • expose builtin tools directly without connector selection
    • optionally materialize file-download results locally
  • Reuse the existing OpenAI file upload path for tool arguments declared through openai/fileParams.
  • Honor backend-declared openai/fileUploadConfig for those uploads.
  • Use openai_file_api_base_url in local/dev, since the file API can live separately from chatgpt_base_url.
  • For builtin tools marked for download materialization:
    • fetch the file after the tool call with ChatGPT auth
    • write a local artifact under CODEX_HOME/.tmp/codex_apps_downloads/...
    • return local_path in the tool result
  • For store_in_library=true uploads, skip the deprecated /files/{file_id}/uploaded finalize call.

Why this shape

  • Keeps everything inside the existing codex_apps MCP surface instead of introducing a separate MCP server.
  • Makes the behavior explicit and opt-in through backend metadata rather than hardcoded tool-name checks in core exposure logic.
  • Keeps upload support generic on the input side, while keeping download materialization narrowly scoped to marked builtin codex_apps tools.
  • Uses a separate file API base in local/dev because chatgpt_base_url can point at local codex-backend while the file API lives elsewhere.
  • The initial backend use case is ChatGPT Library.

Validation

  • local test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@lt-oai lt-oai changed the title [codex] Rebase ChatGPT Library integration onto Codex Apps MCP [codex] Narrow ChatGPT Library codex-apps client to file-only flow Apr 16, 2026
@lt-oai lt-oai changed the title [codex] Narrow ChatGPT Library codex-apps client to file-only flow [codex] Add metadata-driven OpenAI file support for builtin codex_apps tools Apr 18, 2026
@lt-oai lt-oai force-pushed the codex/library-mcp-rebased branch 2 times, most recently from c88b178 to e66c01c Compare April 22, 2026 08:00
@lt-oai lt-oai force-pushed the codex/library-mcp-rebased branch from e66c01c to 1ce4c60 Compare April 22, 2026 08:05
@lt-oai
Copy link
Copy Markdown
Author

lt-oai commented Apr 22, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Apr 22, 2026
@lt-oai lt-oai changed the title [codex] Add metadata-driven OpenAI file support for builtin codex_apps tools [codex] Add OpenAI file support for builtin codex_apps tools Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant