Skip to content

fix(env): a file universe loaded onto a lone server's container lands in it - #735

Merged
earakely-scale merged 2 commits into
mainfrom
edgararakelyan/fd-5994-load_artifact-of-a-file-universe-dies
Nov 17, 2026
Merged

earakely-scale merged 2 commits into
mainfrom
edgararakelyan/fd-5994-load_artifact-of-a-file-universe-dies

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

What

load_artifact of a file or a FileArtifactUniverse onto a server env (env_provider_type = "server") now writes the files into the server's container.

Fixes FD-5994. Every run of fna1-doc-tools-smoke-muse (framework 0.9.1546) died at load_artifact with:

AttributeError: 'ModalSandbox' object has no attribute 'exec_script'

Why it broke

Env.load_file_artifact_universe, the default MCPServerEnv uses, assumed its sandbox is a VM: it ran exec_script and load_object_file, which only VmSandbox has. A server env's _sandbox is its own container (_SandboxEnvironmentProvider._reattach).

  • On Modal that's a ModalSandbox, so the load crashed.
  • On local Docker it's a LocalSandbox in container mode, whose exec_script runs on this machine. The load succeeded, but the files landed on the host, where the server can't see them.

The change

A sandbox in container mode is staged with stage_files_into_container, the helper an agent's container and a container deploy_sandbox already use:

  • A plain container (Modal, CoreWeave's container sandbox): exec mkdir -p and write_file_from_object.
  • A VM-hosted container (local, and the VM providers): docker exec -u 0 <container> mkdir -p and docker cp.

A VM-mode sandbox (the gateway provider's) takes the same path as before, unchanged.

Behaviour change: on local Docker, a server env's files now go into its container instead of onto the host. Nothing could use them on the host; this matches Modal and how MCPServerEnv already stages environment artifacts in container mode.

Tests

  • Unit, tst/unit/env/load_file_artifact_universe_test.py, three tests:
    • a Modal container is written directly;
    • a VM-hosted container is written through docker exec;
    • a VM is loaded on its host, exactly as before.
  • Local e2e, server_env_local_test.py::test_files_a_task_loads_onto_a_server_env_land_in_its_container: the real load_artifact step loads a file and a universe with a nested file onto a local server env, then reads each file back inside the server's container.
  • Modal e2e, server_env_modal_test.py::test_files_a_task_loads_onto_a_modal_server_env_land_in_its_container: the same on Modal. It is gated by skip_without_remote_sandbox("modal").

Verification

On an x86 Linux host with Docker and a local registry (the branch, then the same tests against main's env.py):

Check Branch Main
New unit tests, load_file_artifact_universe_test.py 3 passed 2 failed: the Modal case with AttributeError: Mock object has no attribute 'exec_script' (the reported error); the local container case loaded onto the host
New local e2e, test_files_a_task_loads_onto_a_server_env_land_in_its_container passed failed: cat: /tmp/docs/note.txt: No such file or directory in the container; the files were on the host at /tmp/docs
Rest of server_env_local_test.py (7 tests) all passed n/a
test_container_sandbox_files_local.py (3 tests: the shared staging helper on local) all passed n/a
VM-path regression, task_steps_test.py::test_load_artifact_stages_files_into_env_and_agent (gateway env on a VM, and an agent) passed n/a
Full unit tier (tst/unit and the protocol tests) 15,872 passed n/a

About the full unit tier:

  • Two failures, both explained:
    • test_load_artifact_file.py::test_into_a_deployed_env: its stand-in sandbox had no mode, which the sandbox contract requires ("vm" for a VM). The second commit gives it one, and the file passes.
    • version_lookup_benchmark_test.py: it needs a git checkout, which the shipped copy didn't have. It passes in a clone.
  • The host's shell limits open files to 1024. At that limit hidden_by_default_test.py fails even on its own and takes its xdist worker down with it, so the tier ran with ulimit -n 65536.

Not run by hand: the Modal e2e. CI's Integration Tests job doesn't collect server_env_modal_test.py, and the run needs Modal credentials.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge; container loads reach the intended container, and VM loads keep their existing behavior.

Summary

File loads now write into an env’s own container when its sandbox uses container mode. VM loads keep their existing behavior.

  • File and universe loads now land inside a lone server's container.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Env loads file universe] --> B{Sandbox mode}
  B -->|container| C[stage_files_into_container]
  C --> D{VM-hosted container?}
  D -->|Yes| E[Create directories with docker exec and copy files]
  D -->|No| F[Write directly into container]
  B -->|vm| G[Create directories and load files on VM host]
  E --> H[Return destination paths]
  F --> H
  G --> H
Loading

Reviews (1) · Last reviewed commit: "test(load_artifact): the deployed env's ..." · Reviewed by Greptile

earakely-scale and others added 2 commits November 16, 2026 20:59
… in it

Env.load_file_artifact_universe assumed a VM sandbox, staging with exec_script and load_object_file. A server env's
sandbox is its own container: on Modal the load died with "'ModalSandbox' object has no attribute 'exec_script'", and
on local Docker the files went to this machine, where the server can't see them. A container-mode sandbox is now
written through stage_files_into_container, as an agent's container is; a VM is loaded on its host as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the sandbox contract says

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale marked this pull request as ready for review November 17, 2026 07:19
@earakely-scale
earakely-scale requested a review from a team as a code owner November 17, 2026 07:19
@earakely-scale
earakely-scale merged commit 970cb73 into main Nov 17, 2026
36 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-5994-load_artifact-of-a-file-universe-dies branch November 17, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant