feat(sandbox): add ConnectableProvider capability and serialize/connect facade#2083
Open
ananthsub wants to merge 2 commits into
Open
feat(sandbox): add ConnectableProvider capability and serialize/connect facade#2083ananthsub wants to merge 2 commits into
ananthsub wants to merge 2 commits into
Conversation
|
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
marked this pull request as ready for review
July 20, 2026 17:37
3 tasks
…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
force-pushed
the
ansubramania/sandbox-connectable-provider
branch
from
July 20, 2026 17:41
92a3fb6 to
7f9cdec
Compare
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
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:
What's here
ConnectableProvider— an optionalruntime_checkableprotocol (serialize_handle/connect), separate from the baseSandboxProvider(which is unchanged). Capability membership is checked withisinstance, 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 fakeConnectableProviderexercises theserialize->connectround-trip;serialize/connectraise for a provider without the capability;isinstancemembership check.