Add sandbox file transfer API#13
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces native file and directory transfer capabilities (put_archive, put_dir, and put_file) across the sandbox interface, Docker sandbox, and sandbox managers, replacing custom in-memory tar implementations in various execution tools. The review feedback suggests several key improvements: allowing active statuses like IDLE and BUSY in sandbox state checks, offloading synchronous archiving operations to a separate thread to avoid blocking the asyncio event loop, validating absolute file paths, securing the mkdir command against option injection, setting explicit modification times on tar files, and refining HTTP error mapping to distinguish validation errors from resource-not-found errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR adds first-class sandbox file-transfer APIs (put_archive, put_dir, put_file) to the sandbox abstraction and exposes archive upload through both local and HTTP managers, then refactors existing tools to reuse the new put_file path and adds real Docker-backed file-transfer tests.
Changes:
- Add tar archive helpers and sandbox-level file transfer APIs (
put_archive/put_dir/put_file). - Expose archive upload via FastAPI (
POST /sandbox/{id}/archive) and add corresponding HTTP/local manager methods. - Refactor tool implementations to use
sandbox_context.put_file(...)and add local + HTTP Docker integration tests forput_dir.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_manager.py | Adds real local/HTTP Docker integration tests for manager-level directory transfer. |
| ms_enclave/sandbox/utils/archive.py | Introduces in-memory tar helpers used by put_dir / put_file. |
| ms_enclave/sandbox/utils/init.py | Adds utils package initializer. |
| ms_enclave/sandbox/tools/sandbox_tools/python_executor.py | Switches to sandbox put_file instead of bespoke tar upload. |
| ms_enclave/sandbox/tools/sandbox_tools/multi_code_executor.py | Switches to sandbox put_file instead of bespoke tar upload. |
| ms_enclave/sandbox/tools/sandbox_tools/file_operation.py | Switches to sandbox put_file for temp writes instead of bespoke tar upload. |
| ms_enclave/sandbox/server/server.py | Adds HTTP endpoint to upload/extract tar archives into a sandbox. |
| ms_enclave/sandbox/manager/local_manager.py | Adds local manager put_archive / put_dir forwarding to sandbox implementations. |
| ms_enclave/sandbox/manager/http_manager.py | Adds HTTP manager put_archive / put_dir implemented via the new server route. |
| ms_enclave/sandbox/manager/base.py | Adds default (unsupported) manager API surface for put_archive / put_dir. |
| ms_enclave/sandbox/boxes/docker_sandbox.py | Implements Docker-backed put_archive with mkdir -p + container.put_archive. |
| ms_enclave/sandbox/boxes/base.py | Adds sandbox-level put_archive / put_dir / put_file APIs and shared tar-based implementations. |
Summary
Validation