Skip to content

feat(sandboxes): add VM live process handles - #819

Merged
hallerite merged 3 commits into
mainfrom
codex/vm-process-sessions
Aug 4, 2026
Merged

feat(sandboxes): add VM live process handles#819
hallerite merged 3 commits into
mainfrom
codex/vm-process-sessions

Conversation

@hallerite

@hallerite hallerite commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • add AsyncSandboxClient.open_process() for live commands in VM sandboxes
  • expose independent byte streams for stdout/stderr plus stdin, wait, terminate, kill, and close
  • build on the existing VM command-session Connect transport and bound live streams to the platform's 24-hour sandbox lifetime
  • reject container sandboxes explicitly; this API is VM-only

Why

Verifiers harness sessions need to retain one process across interaction turns. The SDK currently buffers a command to completion, which forces callers to invent a sidecar transport. A native process handle makes persistence a runtime capability instead.

Validation

  • 157 non-live SDK tests pass on Python 3.10 and 3.13
  • focused command-session and transport tests pass
  • real Prime VM acceptance covers independent stdout/stderr, delayed stdin across interaction pauses, exit codes, terminate/signals, and clean stream shutdown
  • Ruff passes on all touched files

Consumed by PrimeIntellect-ai/verifiers#2249.


Note

Medium Risk
New long-lived gateway streams and process control RPCs affect VM sandbox runtime behavior and cleanup; scope is additive and VM-only with explicit container rejection.

Overview
Adds VM-only live process handles so callers can keep one command running across multiple interaction turns instead of waiting for buffered execute_command completion.

AsyncSandboxClient.open_process() starts a command-session Start stream with stdin enabled and a 24-hour transport timeout, then returns AsyncSandboxProcess with async byte iterators for stdout/stderr, write_stdin, wait, terminate/kill, and aclose (graceful shutdown with terminate→kill fallback). Container sandboxes raise APIError; the user argument is rejected for VM processes.

Command-session helpers gain SendInput and SendSignal RPC wiring, optional stdin on start requests, and parse_command_session_start_event (start PID, raw stdout/stderr chunks, end exit code) while collect_command_session_start_event delegates to it for the existing one-shot execute path. AsyncSandboxProcess is exported from the public package API; tests cover streaming, stdin/signal RPCs, and container rejection.

Reviewed by Cursor Bugbot for commit 84608b9. Bugbot is set up for automated code reviews on this repo. Configure here.

@hallerite
hallerite force-pushed the codex/vm-process-sessions branch from e95ff4e to cd88d08 Compare August 4, 2026 20:37
@hallerite
hallerite marked this pull request as ready for review August 4, 2026 20:58

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cd88d08. Configure here.

Comment thread packages/prime-sandboxes/src/prime_sandboxes/process.py Outdated
Comment thread packages/prime-sandboxes/src/prime_sandboxes/process.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd88d085fb

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/prime-sandboxes/src/prime_sandboxes/process.py Outdated

@DamianB-BitFlipper DamianB-BitFlipper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hallerite
hallerite merged commit 892bea7 into main Aug 4, 2026
19 of 25 checks passed
@hallerite
hallerite deleted the codex/vm-process-sessions branch August 4, 2026 23:11
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.

2 participants