Repository navigation
Conversation
…an't drop output collect_artifacts._collect_file streamed `base64 < file` through one exec. A sandbox exec channel can buffer a bounded amount of output and silently drop the oldest events when the reader lags, with exit 0, so a file near or over that size arrived corrupt or cut off. A file larger than 4 MiB is now sized first and read in ranges of at most 4 MiB (`tail -c +N | head -c M | base64`, one exec each), each decoded on its own; a chunk that comes back short raises. Files at or under 4 MiB keep the single exec. The sudo / `docker exec -u 0` wrapping is unchanged, and the integrity check sizes the file again after reading, so a file that grew mid-collection is rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dmchoiboi
force-pushed
the
dmchoi/_claude/arp-collect-chunked
branch
from
October 26, 2026 22:07
0bd6bca to
3b9c7af
Compare
Author
|
Closing: not needed as a standalone change. |
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 and why
collect_artifacts._collect_filestreamedbase64 < filethrough one exec. Some sandbox exec channels buffer only a bounded amount of output per stream (about 16 MiB on one remote VM provider) and silently drop the oldest events when the client lags, exiting 0. A big deliverable therefore arrives corrupt or cut off (FDE-2537; the customer sawcollect integrity check failed … decoded 12823548 bytes but source is 15400836).Repro on a remote VM sandbox with that limit, 2 trials per size, before this change:
Invalid base64 … 1 more than a multiple of 4,Incorrect paddingExit code was 0 in every case.
Now
_collect_filesizes the file first. A file over 4 MiB is read in ranges of at most 4 MiB (tail -c +N | head -c M | base64, one exec each, ~5.4 MB of base64, well under the buffer), each decoded on its own into the temp file. A chunk that comes back short raises. Files at or under 4 MiB keep the single exec, so they pay no extra round-trips. The final size check and the_exec_argswrapping (sudo for a VM host,docker exec -u 0for a container) are unchanged. It applies to every provider.The ranged read follows the existing CUA pattern (
_controller_stream_to_file); I did not merge the two because that one goes throughcua_bash, this one throughsandbox.exec.Needs a release to reach the customer (they run 0.9.1351); the PR carries no
bump-versionlabel.How it was tested
tst/unit/task_step/test_collect_chunked.pyagainst a fake sandbox that interprets the ranged command: multi-chunk reassembly is byte-exact (sha256), an exact multiple of the chunk size reads no extra chunk, a small file takes one unranged exec, a 0-byte file collects as empty, a short chunk raises, and a file that grows during collection fails the integrity check (added after review: the check sizes the file again after reading). Written first; 3 of the 5 failed on the old code for the right reason.make unit-test: 10576 passed, 7 skipped (before the follow-up commit;tst/unit/task_step1980 passed after it, and CIunitis green on the final commit).ruff check .: clean.quay.io/containerdisks/ubuntu:22.04),_collect_filecalled against the real sandbox exec API and a fake store, on thesudoVM-host path:The sandbox was deleted and
GETon it returns 404.Not run locally:
make int-test-*,installer-test,clean-install-test(CI covers them).🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issues were found.Summary
Large files are collected in ranges of at most 4 MiB to avoid dropped output.
Reviews (3) · Last reviewed commit: "fix(collect): read a large file in bound..." · Reviewed by Greptile