Repository navigation
Description
Tracks what is left from the review of the owned-sandboxes stack: #6414 → #6415 → #6416 → #6417.
The stack gives every server one component, OwnedSandboxes (self.sandboxes), to start, lend, checkpoint and stop the sandboxes it owns, a typed network rule on the sandbox block, and borrow() for the agent that is lent a sandbox. It was reviewed, then restacked onto main and fixed, and reviewed again over three rounds, and reverified on the current heads. The review comments and the verification records are on the four pull requests; the two documents attached to this issue explain the design and the checks visually.
Attached
- Owned sandboxes explainer (HTML): the stack at a glance, owner and borrower, the life of one sandbox key, the network rule results, what was verified, what is open.
- State charts (Markdown): three simplified state charts from a TLA+ model checked with TLC, with the models and views that produce them.
Open items
Open after the third round (none blocks the stack):
- feat(sandbox): expose the shared OwnedSandboxes owner #6414, low, new: A server now resolves an explicitly named
sandbox_providerwhen it launches, a dry run included. 107 shipped configs namesandboxand 4 define that block in the same file, so the rest rely on a provider config composed in. A server that names a provider it uses only in some modes no longer starts without it; worth a line in the compatibility notes. - feat(sandbox): stop, start and export owned sandboxes safely under load #6415:
stop()can take up to two limits, plus the wait for a stop slot. Documented; decide whether callers need a single overall deadline. - feat(sandbox): apply typed network rules through owner capabilities #6416, low: The E2B network rules were not run against a live service.
- feat(sandbox): borrow lent sandboxes and share harness configuration #6417, low:
HarnessSandboxConfigis exported fromnemo_gym.sandbox, which is meant to stay lifecycle-only; confirm the home is deliberate. - feat(sandbox): borrow lent sandboxes and share harness configuration #6417: "The one way" to use a lent sandbox is not enforced yet; the module docstring says the refusals are advisory until providers enforce scope.
- stack: A create cancelled before the provider returns a handle, whose wait for the handle runs out, is left to
ttl_s. Documented, andcreate()requires attl_s. This is the one red state in the lifecycle chart.
Fixed in the third round:
- feat(sandbox): apply typed network rules through owner capabilities #6416: A merge had dropped the paragraphs on
exec()taking an argument list from the sandbox docs page. Restored, on feat(sandbox): borrow lent sandboxes and share harness configuration #6417 too. - feat(sandbox): apply typed network rules through owner capabilities #6416:
test_a_setup_whose_rollback_stop_fails_raises_the_setups_own_errorhad lost itsasyncio.run(run()). It runs its body again. - feat(sandbox): stop, start and export owned sandboxes safely under load #6415: Three tests each waited a real 120 s. They now shorten the stop limit.
- feat(sandbox): stop, start and export owned sandboxes safely under load #6415: A cancelled create kept its handler and start slot for
ready_timeout_s + STOP_TIMEOUT_S. It now waits only until the provider returns a handle, then stops the sandbox; 0.17 s in a probe with the real limits. - feat(sandbox): stop, start and export owned sandboxes safely under load #6415: The private
_owner_rolls_backkeyword is now a publictake_ownershipcallback onAsyncSandbox.start(). - feat(sandbox): apply typed network rules through owner capabilities #6416: The comment in
nemo_gym/sandbox/config.pynames both OpenSandbox and E2B as readers ofnetwork_policy; a blankmodel_serveris refused. - feat(sandbox): expose the shared OwnedSandboxes owner #6414: A misnamed provider block is reported when the server launches, not at its first request.
Fixed in earlier rounds:
- feat(sandbox): expose the shared OwnedSandboxes owner #6414:
SandboxSessionCheckpointerimports again fromnemo_gym.server_runtimeand from its old module, with a deprecation warning. - feat(sandbox): stop, start and export owned sandboxes safely under load #6415:
get(),inandaccess()all pass over a key whose sandbox is not usable yet;keysstill lists it. - feat(sandbox): stop, start and export owned sandboxes safely under load #6415:
owner_concurrencyhas a glossary entry. - feat(sandbox): stop, start and export owned sandboxes safely under load #6415: Other servers' tests that assert on a failed stop are unaffected by the start's error being raised.
- feat(sandbox): apply typed network rules through owner capabilities #6416: The startup check reads an explicit
owned_sandbox_blocksdeclaration instead of a name suffix. - feat(sandbox): apply typed network rules through owner capabilities #6416:
allowed_hostsrefuses a URL, ahost:portor a loopback address when the config loads. - feat(sandbox): apply typed network rules through owner capabilities #6416: The glossary says
networkis the name that stays.
Verified on the current heads
| Check | #6414 c46c9f4ea1 |
#6415 3a0fda7e61 |
#6416 782842baff |
#6417 4e713144c5 |
|---|---|---|---|---|
| pre-commit on the PR's files | pass | pass | pass | pass |
| Live OpenSandbox checks | 19 of 19 pass | 16 of 16 pass | 33 of 33 pass | 18 of 18 pass |
deepswe_external1 live server run |
not run on this commit | not run on this commit | not run on this commit | 16 of 16 pass |
The live checks start real sandboxes on OpenSandbox through the public API and confirm afterwards that none is left. The live server run drives the real deepswe_external1 resources server through its HTTP routes with a null run (reward 0) and a golden run (reward 1), and checks that its sandboxes are stopped at verify, at close and at shutdown. No model was called anywhere, and gym env start was not used. The local Docker check of no_network was not rerun on these heads.
The state charts were made again for #6415 at 3a0fda7e61: the model of one key was rewritten for that head and checked with TLC, and both attachments carry the new charts.
Activity
yaoyu-33 commentedon Nov 24, 2026
Where each open item stands after the push to the stack (heads: #6414
0f019e64f0, #6415143865a2a6, #64169c2612e0b5, #6417ff29e50899).SandboxSessionCheckpointernemo_gym.server_runtime.SandboxSessionCheckpointerresolves toOwnedSandboxeswith a deprecation warning, removed in 0.10.0 (_moved_paths.py, test intest_moved_paths.py). b6f2750get()andinaccess()andexport. A sandbox still starting, or one whose start and stop both failed, is none of theirs;keysstill lists it, so a stop oraclosestops it. 02096a9stop()SANDBOX_SHUTDOWN_TIMEOUT_S).owner_concurrencyin the glossaryad6bb5143dand they passed. Theagentic_mmeandbrowsecomp_advanced_harnesstests assert a failed stop at retire or close, not a failed start, so the start-error change does not reach them.self.sandboxesinowned_sandbox_blocks, each with the config field naming its provider. Startup checks each listed block against that provider, and refuses a restricted rule in any otherSandboxConfigof the config, nested ones too. a60f895allowed_hosts*.and a domain, or an IP address or CIDR block. A URL, port, path,*, loopback or0.0.0.0/0is refused. a60f895networkvsnetwork_accessnetworkstays: partner_if already names a sandbox block's egress that way, and the rule lives on the block. The per-servernetwork_accessandsandbox_network_accessfields are deprecated as each server moves onto its block's rule; the glossary says so. a60f895.providerincluded, and that the repository check follows once agents useborrow(). abdc90eready_timeout_splus the stop limit, so the provider call is stuck. Finishing it in the background would leave a task that may never end, and shutdown would still have to cut it short.Also fixed in this push: the three findings of the review bot on #6414. A server's other provider field shared a snapshot index with a server named
<server>.<field>. A provider was built before an index check that can fail. A provider close that failed or was cancelled could not be retried. The fix commit is 0f019e6. Also fixed: my own inline asks on the four PRs, each answered in its thread.Follow-ups, not in this stack:
LentSandboxes(8 resources servers) andBaseEnvironmentServerWithTools.start_episode_sandboxontoself.sandboxes.single_agent_turnlending its attempt sandbox (feat(environment): start and lend a sandbox for each single-agent-turn attempt #6700) is the first server on it.AsyncSandbox.connecttoborrow()(Stirrup first), then add the repository check that keeps connections insideborrow()andOwnedSandboxes.network_accessandsandbox_network_accessserver by server, as each moves onto its sandbox block'snetwork.Checks on the final heads: the unit tests of the touched packages show the same failures as a
maintree in the same venv (missing optional SDK extras and no Docker on the node), and nothing new. pre-commit passes on each PR's files. The Enroot lifecycle smoke passes on the #6417 head with nothing left behind (create, lend, borrow, borrower refusals, a second borrow reading the agent's file, stop, cancel mid-exec and mid-create, restricted rule refused,aclose).yaoyu-33 commentedon Nov 24, 2026
Follow-ups from checking the stack against the sandbox ownership rule. The rule: the Environment Server starts the sandbox for each attempt, lends it, and stops it. The agent and the Resources Server only borrow it.
Already supported:
self.sandboxesand lends it withaccess()./verifywithborrow(), though it never started it. It finds the provider by the block name in the access. A new test in feat(sandbox): borrow lent sandboxes and share harness configuration #6417 covers this.sandbox_providerstarts nothing and passes the startup check, so an attempt that opts out needs nothing from this stack.Fixed in this round:
lends_sandboxesnow names the Resources Server as a borrower too (feat(sandbox): apply typed network rules through owner capabilities #6416).New follow-ups:
networkis one rule per sandbox and fixed at start. See the inline comment on feat(sandbox): apply typed network rules through owner capabilities #6416.single_agent_turn, not the base Environment Server class./verify, through theng_sandbox_accessbody key.Already listed above, and still open:
borrow()refusals stay advisory until providers enforce scope, so "only borrow" is a convention until then.