Repository navigation
fix(sandbox): a big file written on a local sandbox's host decodes on macOS too - #660
Merged
Merged
Conversation
… macOS too The chunked write ran `base64 -d <file>`, which macOS's base64 refuses (it takes no file argument), so on a Mac every local computer whose site routing writes site_proxy.py (over 96 KiB of base64) failed to deploy. Decode from stdin, which GNU and BSD base64 both take; a test runs the write's own scripts with this machine's base64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A file too big for one heredoc is written onto a sandbox's host in base64 chunks, then decoded with
base64 -d <file>. macOS's base64 takes no file argument (base64: invalid argument …), so on a Mac every local sandbox write of more than 96 KiB of base64 failed.Site routing hits this: it writes
site_proxy.pyonto a local computer's host. So a multi env that routes its sites to a local computer failed to deploy on macOS:How
The chunked write now decodes from stdin (
base64 -d < <file>), which both GNU and BSD base64 accept. The small-file heredoc path already read stdin.Testing
test_a_file_written_on_the_host_in_chunks_decodes_with_this_machines_own_base64runs the write's own scripts with this machine'sbashandbase64, and checks the file decodes byte for byte.The two tests that pin the script text now expect the stdin form.
tst/unit/providers/sandbox_providers: 1,705 passed on an amd64 and an arm64 Linux host.Differential chaos run, the real
write_host_fileonmain(1f5bef4) and on this branch, through four shells: the host's ownbash(GNU coreutils 9.4), busybox 1.36, Alpine 3.20 and Ubuntu 24.04'sdash. On an amd64 and an arm64 Linux host, no outcome differs between the two in any shell. It runs 25 checks:$(...);.b64from an earlier run, and new nested folders;On macOS's BSD
base64, 20 of the cases fail onmain, leaving an empty file and the.b64behind, and all pass on this branch.End to end on the same Linux hosts, on this branch:
computer/multi_env_computers_test.py,website_browser_test.py,browser_computer_test.pyandca_trust_test.py, which route sites to local computers;task_step/test_run_code_named_sandbox_local.py;agent/proxy_local_container_test.pyandproxy_container_install_test.py;providers/sandbox_providers/vm_sandbox_build_test.py.They pass: 52 on amd64. On arm64, four CDP-agent tests in
browser_computer_test.pyfail the same way onmain: the echo agent's image build hitsexec /bin/sh: exec format error. That's that host, not this change.End to end on macOS (arm64, local Docker): a multi env whose website is routed to a local computer deploys on this branch, and failed at the site-routing step above without it.
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no blocking issues were found.Summary
Changes chunked host-file writes to feed
base64 -dthrough stdin so they work on macOS.Reviews (5) · Last reviewed commit: "fix(sandbox): a big file written on a lo..." · Reviewed by Greptile