Skip to content

feat(sandbox): add ConnectableProvider capability and serialize/connect facade#2083

Open
ananthsub wants to merge 2 commits into
mainfrom
ansubramania/sandbox-connectable-provider
Open

feat(sandbox): add ConnectableProvider capability and serialize/connect facade#2083
ananthsub wants to merge 2 commits into
mainfrom
ansubramania/sandbox-connectable-provider

Conversation

@ananthsub

@ananthsub ananthsub commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of #2082

Bottom of a 3-PR stack for cross-server sandbox sharing. Introduces the optional provider capability and the sandbox-facade methods that use it. No in-tree provider implements the capability yet; the next PRs add OpenSandbox and the sandbox server.

Stack:

  1. feat(sandbox): add ConnectableProvider capability and serialize/connect facade #2083 (this PR) — ConnectableProvider + serialize/connect facade
  2. feat(sandbox): implement ConnectableProvider for the OpenSandbox provider #2084 — OpenSandbox implements ConnectableProvider
  3. feat(sandbox): add sandbox server for cross-server sandbox sharing #2085 — sandbox server

What's here

  • ConnectableProvider — an optional runtime_checkable protocol (serialize_handle / connect), separate from the base SandboxProvider (which is unchanged). Capability membership is checked with isinstance, so new capabilities can be added as their own protocols instead of growing one interface.
  • AsyncSandbox.serialize(scope=...) / AsyncSandbox.connect(descriptor, *, provider=...) — facade methods that delegate to the capability and raise for providers that do not support it. There is one live type (SandboxHandle); a descriptor is just its serialized form.

Test plan

  • tests/unit_tests/test_sandbox_connect.py: a fake ConnectableProvider exercises the serialize -> connect round-trip; serialize/connect raise for a provider without the capability; isinstance membership check.
  • Existing sandbox tests pass; ruff clean.

@copy-pr-bot

copy-pr-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@ananthsub
ananthsub requested a review from hemildesai July 20, 2026 17:17
@ananthsub ananthsub changed the title ansubramania/sandbox connectable provider [sandbox] connectable provider Jul 20, 2026
@ananthsub ananthsub changed the title [sandbox] connectable provider feat(sandbox): add ConnectableProvider capability and serialize/connect facade Jul 20, 2026
@ananthsub
ananthsub marked this pull request as ready for review July 20, 2026 17:37
…ct facade

Introduce an optional, runtime_checkable ConnectableProvider protocol
(serialize_handle / connect), separate from the base SandboxProvider, so a
provider whose sandbox is reachable by id can hand a descriptor to another
process. Add AsyncSandbox.serialize and AsyncSandbox.connect, which delegate
to the capability and raise for providers that do not support it.

No in-tree provider implements the capability yet; a fake provider in the
tests exercises the serialize/connect round-trip and the negative cases.

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
AsyncSandbox.connect rebuilds the spec from descriptor["workdir"] and exec
defaults cwd to it. The remote provider's SandboxRef already includes workdir,
but a provider whose descriptor omits it (e.g. OpenSandbox's {"sandbox_id"})
would lose the working directory on reattach. Have serialize() annotate the
descriptor with the sandbox's workdir when the provider did not, so exec on a
reattached sandbox defaults to the same directory for every provider.

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
@ananthsub
ananthsub force-pushed the ansubramania/sandbox-connectable-provider branch from 92a3fb6 to 7f9cdec Compare July 20, 2026 17:41
@copy-pr-bot

copy-pr-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant