Skip to content

Add sandboxed upload_file and download_file tools#15131

Closed
caseychow-oai wants to merge 7 commits intomainfrom
caseych/file-transfer-tools-smoke
Closed

Add sandboxed upload_file and download_file tools#15131
caseychow-oai wants to merge 7 commits intomainfrom
caseych/file-transfer-tools-smoke

Conversation

@caseychow-oai
Copy link
Copy Markdown
Contributor

@caseychow-oai caseychow-oai commented Mar 19, 2026

Summary

  • add static Codex upload_file and download_file tools backed by a new codex-file-transfer helper crate
  • preserve bundled experimental tool exposure when remote model metadata omits those tool flags
  • fix ChatGPT file route construction and follow the JSON download-link response to the authenticated content fetch

Key Decisions

  • upload_file and download_file are built-in tools, not experimental tools; they are registered unconditionally rather than being gated on experimental_supported_tools
  • the second hop to a backend-provided download_url does not forward ChatGPT auth headers; only the initial authenticated metadata request does
  • download destinations use strict cp-style semantics, including basename sanitization when writing into an existing directory
  • helper-side local filesystem failures return structured tool errors instead of collapsing into generic helper failures when possible
  • upload and download stream file contents instead of buffering whole files in memory
  • the new helper crate is wired into Bazel so Cargo-only success does not hide build-system regressions

Validation

  • cargo test -p codex-file-transfer -- --nocapture
  • cargo test -p codex-core refresh_available_models_preserves_local_experimental_tools_when_remote_empty -- --nocapture
  • cargo test -p codex-core test_models_json_default_model_includes_file_transfer_tools -- --nocapture
  • cargo test -p codex-core parse_helper_output_preserves_request_context_on_nonzero_exit -- --nocapture
  • just fix -p codex-file-transfer
  • just fix -p codex-core
  • live smoke via just exec --json --sandbox danger-full-access --skip-git-repo-check ... for upload and download round-trip

Smoke notes

  • just exec runs with cwd at codex-rs, so relative file paths resolve there during smoke tests
  • verified a fresh upload returned an openai-file://v1/... URI and an immediate download wrote matching bytes (some data) to /tmp/codex-download-smoke.txt

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@caseychow-oai
Copy link
Copy Markdown
Contributor Author

Additional smoke results after the initial draft:

  • live zero-byte upload currently fails at create time with backend_request_failed / HTTP 500 (Internal Server Error)
  • live non-ASCII round-trip works for bytes: uploading café-smoke.txt and downloading it back produced file contents bonjour
  • the live non-ASCII download filename came back normalized as /tmp/caf_-smoke.txt, so bytes survive but exact filename preservation is still a backend/open question

Added automated helper coverage in codex-file-transfer for zero-byte upload request formation and Unicode filename handling on directory downloads.

caseychow-oai and others added 5 commits March 19, 2026 12:40
Keep auth headers on the backend link request, but do not forward them to the backend-provided blob download URL. Add regression coverage for the blob fetch header set.

Co-authored-by: Codex <noreply@openai.com>
Add the new file-transfer tools to the core tool expectation suites and satisfy the argument-comment lint in the file transfer handler.

Co-authored-by: Codex <noreply@openai.com>
Register upload_file and download_file as built-in tools instead of gating them on experimental_supported_tools, and add regression coverage for the ungated behavior.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Apr 3, 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