docs(sandbox): note exec output-limit truncation is provider-dependent#4506
Open
MattFisher wants to merge 3 commits into
Open
docs(sandbox): note exec output-limit truncation is provider-dependent#4506MattFisher wants to merge 3 commits into
MattFisher wants to merge 3 commits into
Conversation
SandboxEnvironment.exec claimed an over-limit output stream raises OutputLimitExceededError, but some providers (including the built-in Docker provider) pre-truncate each stream to the trailing bytes and return the truncated output instead of raising. Callers parsing large exec output (e.g. JSON) can therefore receive a silently truncated tail that fails to parse. Document the provider-dependent behaviour and point at read_file() for large payloads. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
10 tasks
Contributor
Author
|
Removed the changelog entry since there were no other "Docs:" entries I could see. |
MattFisher
commented
Jul 16, 2026
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
SandboxEnvironment.exec's docstring states that when an output stream exceedsINSPECT_SANDBOX_MAX_EXEC_OUTPUT_SIZE(default 10 MiB), "anOutputLimitExceededErrorwill be raised." That isn't what happens for the built-in providers: the Docker (and local) exec path captures stdout/stderr through aCircularByteBufferthat keeps only the trailing bytes within the limit and returns the truncated output.SandboxEnvironmentProxy.verify_exec_result_sizedoes raise, but only when a provider's ownexecreturns un-truncated output over the limit — for Docker it receives content already trimmed to within the limit, so it never fires.Net effect for callers: a command that emits more than the limit doesn't error — the scorer/solver silently receives the last N bytes with the beginning discarded. Code that parses
execoutput (e.g.json.loads(result.stdout)) then fails on an invalid tail, and the failure looks unrelated to output size.This is a docs-only clarification (no behaviour change). It documents the provider-dependent behaviour on
execand points callers atread_file()for large payloads, which checks size up front and always raisesOutputLimitExceededError.Motivation
We hit this in inspect_evals: a scorer that POSTed a proof-of-concept and parsed the executor's JSON response via
curlstdout crashed withJSONDecodeErroron large program output, because the 10 MiB exec limit truncated the JSON tail rather than raising (inspect_evals#1644). Theexec-vs-read_filedistinction (truncate vs raise) is subtle and currently the docstring points the wrong way, so it's easy to write a guard against the wrong failure mode.Changes
SandboxEnvironment.execdocstring: replace "anOutputLimitExceededErrorwill be raised" with a note that the over-limit behaviour is provider-dependent — some providers (including Docker) pre-truncate to the trailing bytes and return them, others raise — and steer large payloads toread_file().Raises:entry qualified to match.Docs:bullet in## Unreleased(drop if you'd rather keep the changelog behaviour-only).🤖 Generated with Claude Code