Skip to content

feat(sandbox-utils): fetch_container_logs takes max_chars per stream - #918

Open
andrewpark-scaleai wants to merge 3 commits into
mainfrom
andrew-park/container-logs-max-chars
Open

andrewpark-scaleai wants to merge 3 commits into
mainfrom
andrew-park/container-logs-max-chars

Conversation

@andrewpark-scaleai

@andrewpark-scaleai andrewpark-scaleai commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Why

fetch_container_logs keeps 500 characters of each stream. That fits inlining the logs in an error message, which is what its callers do today. A caller that stores the logs elsewhere, such as an object store, gets only the last few lines of a traceback.

What changed

  • fetch_container_logs takes an optional keyword max_chars, the limit for each stream of each container. It defaults to the current 500.

Scope

  • The existing callers keep the default, so their output does not change.

Verification

  • pytest tst/unit/task_step/test_sandbox_utils_logs.py tst/unit/task_step/verifiers/test_rubrics_verifier_judge_usage.py: 27 passed. A new test checks that max_chars=3000 keeps 3000 characters of both stdout and stderr.
  • ruff check passes on the changed files.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the short-stream bug is fixed and no new actionable issues remain.

Summary

fetch_container_logs adds a keyword-only max_chars limit for each stream, keeping the default of 500 characters.

  • Callers can choose how much of each container log stream to keep.

Reviews (3) · Last reviewed commit: "fix(sandbox-utils): a stream shorter tha..." · Reviewed by Greptile

The 500-character default keeps the result small enough to inline in an error message. A caller
that stores the logs somewhere else can now ask for more of each stream. Existing callers keep the
default.
@andrewpark-scaleai
andrewpark-scaleai requested a review from a team as a code owner November 24, 2026 23:24
A slice of [-0:] keeps the whole string, so max_chars=0 returned every stream in full.
The start index went negative when a stream was shorter than the limit, and Python counts a
negative index from the end, so a 499-character stream kept only its last character.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant