fix(sandboxes): bound background output retrieval - #862
Merged
Conversation
DamianB-BitFlipper
requested review from
JannikSt,
JohannesHa,
burnpiro,
kcoopermiller,
kennethnym and
willccbb
as code owners
August 24, 2026 17:49
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ca296c473
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…tput-burst # Conflicts: # packages/prime-sandboxes/tests/test_batch_status.py
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 822778c. Configure here.
kcoopermiller
approved these changes
Sep 1, 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.

Caps background-job output reads at 20 concurrent requests, retrieves stdout/stderr
sequentially, preserves completed exit codes when output retrieval fails, adds jittered retries and
errno diagnostics, and includes a 100-job concurrency test.
Verification:
Note
Medium Risk
Large change to background-job polling, concurrency, and client shutdown/delete ordering; behavior is well-tested but affects hot paths for VM batch job monitoring.
Overview
VM background jobs now separate completion checks from stdout/stderr downloads. New
get_background_job_status/get_background_job_statusesreturnBackgroundJobStatusSnapshotwithout touching log files;get_background_jobandget_background_jobsstill hydrate tails but route output through a shared coordinator.Output hydration is deduplicated per job, cached in a byte-bounded LRU, and limited client-wide (defaults: 20 active, 200 queued, 64 MiB cache) via
background_job_output_concurrency,background_job_output_queue_size, andbackground_job_output_cache_byteson sync/async clients. Fetches are fair across sandboxes, sequential per job (stdout then stderr), and respect a bounded retrieval deadline after the exit file is seen.Reliability:
BackgroundJobStatusgainsstdout_error/stderr_errorso a known exit code stays authoritative when a stream is missing; read retries use jittered backoff and richer errno diagnostics. Sandbox delete/drain cancels queued output work and coordinates with the expanded operation lease registry before API teardown.Reviewed by Cursor Bugbot for commit 63425e7. Bugbot is set up for automated code reviews on this repo. Configure here.