fix: download sandbox logs in PrimeRuntime.run to avoid read-file 10MB limit#1890
Draft
mikasenghaas wants to merge 1 commit into
Draft
fix: download sandbox logs in PrimeRuntime.run to avoid read-file 10MB limit#1890mikasenghaas wants to merge 1 commit into
mikasenghaas wants to merge 1 commit into
Conversation
…B limit
PrimeRuntime.run polled get_background_job, which reads the job's
stdout/stderr logs inline via the SDK read_file → gateway /read-file
endpoint. That endpoint caps reads at 10MB and returns HTTP 413 ("Use
/download instead"), so any command emitting more than 10MB of output
(e.g. a verbose test runner) killed the whole rollout with
SandboxError: prime exec failed.
Poll the tiny exit file directly with read_file, then fetch stdout/stderr
via download_file (no size limit), mirroring read(), which already
downloads to dodge this exact limit. Factor the download into a shared
_download_bytes helper.
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
PrimeRuntime.runpolledget_background_job, which reads the job's stdout/stderr logs inline via the SDK'sread_file→ gateway/read-fileendpoint. That endpoint caps reads at 10MB and returns HTTP 413 (File size (...) exceeds max read size (10485760 bytes). Use /download instead). Any command emitting >10MB of output (e.g. a verbose test runner) therefore killed the whole rollout withSandboxError: prime exec failed: Read file failed: HTTP 413 ....read_file, then fetch stdout/stderr viadownload_file(no size limit) once the job completes. This mirrorsread(), which already downloads to dodge this exact limit. The download is factored into a shared_download_byteshelper thatread()now reuses.This is a latent bug for any env whose program emits >10MB on stdout/stderr; it surfaced first in
scaleswe_v1(itspytest -vvscorer produced ~28MB of stdout).Verification
Before: a scaleswe-v1 rollout whose scorer emitted 28MB of stdout failed with
After: stdout/stderr are downloaded rather than read inline, so the 10MB read-file cap no longer applies. (No behavior change for small output; the background-job wrapper always creates both log files via redirection, so the download cannot 404.)
🤖 Generated with Claude Code
Note
Download sandbox logs in
PrimeRuntime.runto avoid the 10MB read-file limitget_background_jobpolling approach inprime.pywith direct polling of the job's exit file viaclient.read_file, parsing the exit code from its contents._download_byteshelper that usesclient.download_fileto a temp location, bypassing the gateway's inline read-file size limit.PrimeRuntime.readto delegate to the same_download_byteshelper for consistency.runnow returns stdout/stderr decoded from downloaded files rather than inline API responses; large log outputs that previously failed or were truncated will now be returned in full.Macroscope summarized 8d5cc55.