Skip to content

feat(environment): own each attempt's sandbox groups in the base Environment Server, with per-task verifier modes - #6752

Merged
yaoyu-33 merged 207 commits into
mainfrom
claude/sandbox-base-lifecycle
Dec 3, 2026
Merged

yaoyu-33 merged 207 commits into
mainfrom
claude/sandbox-base-lifecycle

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What changes

The base Environment Server owns the sandbox group for an attempt and lends it to the agent and Resources Server. A recipe can run the verifier in the Resources Server, reuse the attempt group, or start a separate verifier group. The verifier-only pairing allows a reviewed model-only agent to run on the host. Cleanup releases the groups after success, failure, or cancellation.

Invalid sandbox configuration and missing provider dependencies are terminal setup failures. Transient provider or command failures remain retryable and carry a provider failure kind. A verifier startup failure retains evidence from the completed agent turn. Retrying a transient failure of a separate verifier still retries the attempt.

The blanket seed guard, affected tool recipes and conformance-fixture migration are in the directly stacked #7146. This split follows the review discussion.

Validation

  • 644 targeted tests passed on the Linux workstation, covering the Environment Server, sandbox lifecycle and conformance fixtures.
  • A second 248 tests passed across agent and Resources sessions, checkpointing, orchestration, and the compatibility Environment Server.
  • Full pre-commit completed. The private guardwords catalog was unavailable to the hook.
  • Ran one GPQA Diamond rollout with a real local model. It completed and was graded 0.0, with no failure or masked sample. The model-only recipe used its existing path.

CI on 383cf0a

DCO, Lint check and Nemo_CICD_Test passed. Environment Server compliance passed. The advisory harness report measured eight P0 passes and two failures (Claude Code and Terminus 2). OpenCode, KiloCode, OpenClaw and Mini-SWE did not produce usable measurements.

ananthsub and others added 30 commits November 18, 2026 15:10
A client that disconnects cancels its request, and every later await in it.
An unshielded stop in the request's cleanup then raises before the provider
closes the sandbox, which runs on until its ttl_s.

nemo_gym.sandbox.stop_sandbox(), in the sandbox package's utils, shields the
stop from that cancellation and bounds it in time, so a hung provider
cannot hold the request either. A timed-out stop raises
TimeoutError, which owners treat like any other failed stop. It also accepts
a Compose group, which harbor owns.

LentSandboxes, the swebench sandbox session base and deepswe_external1 each
had a copy of this stop; they now use the shared one.

Signed-off-by: Ananth Subramaniam <[email protected]>
Every sandbox has one owner, the server that starts it, but each server
family owns its sandboxes through its own design. Gym already has a class
that tracks a server's sandboxes by key, stops them, lends them with operate
scope and snapshots them for checkpoints: SandboxSessionCheckpointer, which
no server uses yet.

It becomes the public nemo_gym.server_runtime.OwnedSandboxes, in its own
module (nemo_gym/server_runtime/owned_sandboxes.py) since it is no longer
checkpoint-only, and every SimpleServer holds one as self.sandboxes:

- created on first use from the server's sandbox_provider and
  checkpoint.state_dir, so a server without sandboxes builds nothing
- self.sandboxes.on("<field>") gives the instance for a second provider
  field, with its own server name for the snapshot index
- run_webserver wraps the app's lifespan so the shutdown stops what every
  instance still owns, after the server's own shutdown code
- access() lends through the provider block the instance was built from
- the instance owns the provider it creates and closes it once every
  sandbox is stopped; it reads the config the server was started with
- the shutdown sweep runs after the server's own shutdown, is bounded
  (150 s in all), refuses to build new instances once it began, and is
  documented next to server_shutdown_timeout_seconds

The glossary gains "sandbox owner" and "lend / borrow", and its existing
"Owner" (the worker that holds a session) points away from them.

The class is renamed directly without an alias: it merged on 2026-11-16 and
is in no release.

Signed-off-by: Ananth Subramaniam <[email protected]>
OwnedSandboxes becomes the one path for every sandbox start and stop, so it
takes on the jobs that servers copied into their own session code:

- One stop: stop() is shielded from the caller's cancellation and bounded
  by STOP_TIMEOUT_S from the moment it is called, its waits for the key's
  lock and for a stop slot included, so a client that disconnects cannot
  leave the sandbox running and nothing can hold the stop forever. A stop
  that fails or times out keeps the key, as before.
- Tracking before start: create() tracks the sandbox before it starts. A
  start that fails or is cancelled after the provider returned the sandbox
  is stopped, shielded. If that stop fails too, the key stays tracked for
  the next stop or aclose(), an export leaves the half-started sandbox out,
  and create() raises the start's error with the stop's as its context.
  AsyncSandbox.start now keeps the start's error the same way when its own
  rollback stop fails. A start cancelled before the provider returned the
  sandbox leaves nothing to stop; ttl_s reclaims it.
- Their own start and stop limits: parallelism (16 by default) bounded
  creates, stops, snapshots and deletes alike, which would let a server
  seeding 512 episodes start only 16 sandboxes at a time. Starts and forks
  now take max_concurrent_starts and stops take max_concurrent_stops, both
  unbounded by default and set per provider with the block's
  owner_concurrency, so a stop never waits behind starts. parallelism bounds
  only snapshot submits and deletes.
- Exclusion per key: a create, a stop, an export and a restore of one key
  hold that key's lock. An export snapshots a sandbox only once its start
  finished, a stop waits for the export or restore of its key and then
  stops what is there, and other keys go on. A restore takes its keys'
  locks in sorted order. A key's lock exists only while someone holds or
  waits for it.

Signed-off-by: Ananth Subramaniam <[email protected]>
Each sandbox's egress rule was set five different ways, and about 20
servers set none. A typed rule in its config block makes every sandbox's
egress visible, and the owner applies it when the sandbox starts.

- SandboxConfig gains network (inherit, no_network, model_only,
  model_and_tools, hosts_only), model_server, tool_servers and
  allowed_hosts, checked for consistency at load. A block that sets network
  and also a provider's own network option is refused. A subclass's own
  network setting, such as partner_if's tool sandbox, is left alone.
- SandboxConfig.spec() takes network_options, the provider options that
  apply the rule, and refuses a restricted rule without them: only the
  owner builds them, so a block that asks for restricted egress never
  starts a sandbox with the provider's default egress. network_options
  replaces Gym#6179's OpenSandbox-only network_policy parameter, which is
  in no release; whichever of the two lands second drops network_policy.
- Each provider class declares a frozen SandboxCapabilities: what its
  snapshots keep, the network rules it can apply, whether it reconnects
  always, only on the same host or never, and whether it closes by label.
  OpenSandbox applies every rule through its egress policy, built by the
  same helper as restricted_network_policy. Docker applies no_network as
  --network none, or leaves it to a provider block that already sets it.
- OwnedSandboxes.spec() turns model_server and tool_servers into reachable
  hosts, read from the config the server was started with, asks the provider for its options for the rule and builds the
  spec. A block without a rule keeps today's behavior and logs one
  deprecation warning naming the rule that keeps it.
- check_provider() refuses a rule the provider cannot apply, and lending on
  a provider that never reconnects. SimpleServer runs it at startup from the
  provider's class, for servers that set lends_sandboxes and, when
  sandbox_provider is the only provider field, for every typed block, whose
  model and tool servers it also resolves to hosts from the config, without
  connecting to them; access() refuses lending again at first use.
- The sandbox docs describe the rule.

Signed-off-by: Ananth Subramaniam <[email protected]>
An agent that is lent a sandbox connects to it through its own copy of the
borrow-or-own branch, and gets the sandbox to stop as easily as to run in.
Only an operate-scope descriptor kept it from stopping a sandbox the
environment still grades in, and no provider enforces that.

borrow(access) in nemo_gym.agents.utils is the one way to use a lent
sandbox. It resolves the provider, connects with the descriptor, and
returns a BorrowedSandbox:

- commands and terminal sessions run as the access's user in its workdir,
  with its env under each call's own
- stop, start, pause, resume and snapshot raise BorrowedSandboxError: they
  are the owner's
- serialize() gives only operate scope, and access() passes the lent access
  on for a harness that borrows the sandbox again in a subprocess
- disconnect(), and leaving an async-with block, release the client
  shielded from cancellation and bounded, as does a failed connect

AgentSandboxConfig types the sandbox an agent starts for itself when nothing
is lent, with the keys agent recipes set today (image, workdir, files,
entrypoint, user, ports and derive_cpu_env, off by default as in most
agents) on top of SandboxConfig and its network rule. Other SandboxSpec keys
a recipe may set, such as sidecars, are refused; each agent that moves onto
the config warns about them for one release first. No checked-in agent,
benchmark or environment recipe sets one today.

No agent moves onto them here: that is each agent family's own change, and
the harness guide changes with the first one.

Signed-off-by: Ananth Subramaniam <[email protected]>
Resolve against main:
- Drop this branch's earlier copy of the shielded stop (stop_sandbox() in
  nemo_gym.sandbox.utils and its test): #6410 merged a different version that
  puts the shield and limit in AsyncSandbox.stop(timeout_s=...). The sandbox
  package, LentSandboxes, the swebench session base and deepswe_external1
  take main's code; OwnedSandboxes stops through AsyncSandbox.stop.
- #5266 exports the checkpointer under its old name: its server, conformance
  helper and test move to OwnedSandboxes in owned_sandboxes, and the public
  API serves SandboxCheckpointConfig, SandboxCheckpointError and
  checkpoint_state_dir from there. No release shipped the old name.
- The glossary keeps main's sandbox lease and capabilities rows beside the
  owner and lend/borrow rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Brings in origin/main through the parent. Keeps this branch's stop: shielded
and bounded as a whole, the wait for a stop slot included. It passes
STOP_TIMEOUT_S to AsyncSandbox.stop, whose own shield (#6410) would otherwise
hold a stop for its 120 s default past a shorter configured limit. The
superseded-sandbox stop does the same. STOP_TIMEOUT_S now comes from
nemo_gym.sandbox.api.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…xes-network

Brings in origin/main through the parents. Main added SandboxCapabilities
with snapshot_keeps and provider_capabilities() in #5410; this branch added
its own SandboxCapabilities. They become one class: main's, with this
branch's network_rules, reconnect and close_by_label, its NetworkRule and
Reconnect defined before it. E2B and OpenSandbox declare one capabilities
each (E2B keeps main's files-and-processes snapshots). The owner's private
_capabilities() copy gives way to provider_capabilities().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Brings in origin/main through the parents; the glossary keeps main's sandbox
lease and capabilities rows beside this branch's lend/borrow row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…n attempt

When the Resources Server lends no sandbox, single_agent_turn can now start one
per attempt through its OwnedSandboxes, with a typed network rule such as
model_only. It lends the sandbox to the agent in the seed, lends the same
sandbox to /verify as ng_sandbox_access after the agent closes, and stops it in
the episode's cleanup on every path. A sandbox that cannot start fails the
attempt as a retryable infrastructure failure before the agent runs; nothing
falls back to the host. The feature is opt-in through sandbox_provider and
sandbox_config, so existing configs behave as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
OwnedSandboxes.for_server created the provider before it read
checkpoint.state_dir, so a refused config (checkpointing on without a
state_dir) left a provider nobody closes, and every later self.sandboxes
built another. The provider block and state_dir are now resolved first. An
owner on the local provider, which runs commands as host processes, logs a
warning.

The self.sandboxes docstring and the glossary say what is true today: no
server owns its sandboxes through it yet, it is used from the event loop, and
a borrower is an agent or a Resources Server grading in the sandbox. The
test imports names from their defining modules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
create() let a cancellation cut the provider's start short and relied on
ttl_s to reclaim what the provider had made. Not every provider applies
ttl_s: on Enroot a create cancelled half a second in left its container on
the node with nothing tracking it (seen in a lifecycle smoke). The start now
runs to its end, shielded and bounded by STOP_TIMEOUT_S, so the create's
rollback has a handle to stop; only a start still running after that is cut
short.

A main test of a stop that waits for its turn held the snapshot semaphore,
which stops no longer take since they got their own limit; it now holds the
stop limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
- stop() took STOP_TIMEOUT_S for its key's lock, again for a stop slot, and
  AsyncSandbox.stop, which shields itself from enclosing deadlines since
  #6410, took a third: up to three limits in all. One deadline now covers the
  whole stop, and the provider's stop gets only the time that is left.
- create() refuses a spec without ttl_s: the shutdown sweep is bounded and a
  crash runs none, so ttl_s is what ends a sandbox its owner never stops.
- access() lends only a running sandbox. A key is tracked from before its
  start, so a key still starting, or one whose start and stop both failed,
  raised a RuntimeError from the sandbox, or lent a broken one.
- An instance built with from_config, as swebench's checkpoint server builds
  it, keeps parallelism as the bound of its starts, forks and stops. They
  bounded them before they got limits of their own, and such a server has no
  owner_concurrency to set. swebench's close test holds the stop limit,
  which stops take now, instead of the snapshot semaphore.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…ent lends

With sandboxed: true, Simple Agent borrows the sandbox its agent session is
lent, installs a private Python runtime in it with this server's nemo_gym
sources, and runs each activation through sandbox_runner.py under Gym's
process supervisor. The runner builds the same SimpleAgent and calls the same
_create_episode loop as in process, calls only the model server, and returns
the output items unchanged. A seed that lends no sandbox is refused and a
sandboxed agent never runs the loop in its own process. In-process mode stays
the default.

reward_profile and the rollout timeout summary now import numpy, pandas and
scipy where they use them, so an agent server, and the sandbox runtime, no
longer load them on import.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
… after close

- A stop waiting for a stop slot no longer counts that wait against
  STOP_TIMEOUT_S. Every stop ahead holds its slot for at most that long, and
  cutting queued stops short under load (1000 sandboxes, 16 slots) left most
  of them running until their ttl_s. The wait for the key's lock and the
  provider's stop are each bounded by STOP_TIMEOUT_S, without the extra
  nested limits the previous commit removed.
- A create queued for a start slot when aclose() began now raises instead of
  starting a sandbox after the shutdown sweep has begun.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…xes-network

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…boxed loop

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…ry entry for the rule

- critpt's agentic execution server built its SandboxSpec from the whole
  SandboxConfig dump, which now also holds the network rule's fields, so its
  startup failed with an unexpected keyword. It takes only the fields a
  SandboxSpec has, and refuses a typed rule it would not apply.
- ECS reconnects through the owner's tunnel on the same host, so it declares
  same_host, not never; Daytona's connect takes a bare id, so it declares
  never; bwrap, added on main after this branch, declares same_host.
  Lending also refuses a provider with no serialize_handle and connect,
  whatever it declares. A test keeps every built-in provider's reconnect in
  step with its methods, and the design table lists every built-in provider.
- close_by_label is dropped: no provider sets it and nothing reads it.
- The startup check runs before the dry-run return, so a dry run reports a
  rule the provider cannot apply. It imports from the defining modules.
- The glossary gains "Network rule" (naming the network_access fields it
  replaces) and the capabilities entry names network_rules and reconnect.
  The sandbox page says which refusals happen at startup and which at the
  first spec(), and that a rule allows a server's whole host.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…egress at startup

- Declare the verify field once, as BaseVerifyRequest.sandbox_access
  (wire name ng_sandbox_access, excluded from dumps), and drop it from the
  verify reply, so a verifier that echoes its request never stores it.
- Refuse at startup a network rule that blocks the tools an episode grants,
  and build the provider at startup, so a bad block fails startup.
- Stop an attempt sandbox only where this server built a provider, so an
  episode whose Resources Server lent the sandbox builds none in cleanup.
- A sandbox that cannot be lent to the verifier is a retryable
  infrastructure failure.
- Require ttl_s to exceed the episode and cleanup timeouts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…w from server_runtime

- BorrowedSandbox.stop and disconnect dropped the timeout_s keyword that
  AsyncSandbox.stop and disconnect take since #6410. SandboxSession, which
  every sandboxed agent closes through, releases a sandbox it does not own
  with disconnect(timeout_s=...), so a borrowed sandbox raised TypeError at
  close and its client was never released. stop(timeout_s=...) now refuses
  like stop(), and the disconnect override is gone: AsyncSandbox.disconnect
  is shielded and bounded itself, and the override's own 60 s limit could
  not cut the inner shielded one short anyway.
- borrow(), BorrowedSandbox and BorrowedSandboxError move to
  nemo_gym.server_runtime, beside OwnedSandboxes, and its public API serves
  them: a Resources Server grading in a lent sandbox borrows it too, and
  server_runtime cannot import nemo_gym.agents. AgentSandboxConfig joins
  nemo_gym.agents' public API.
- A failed connect's client close no longer replaces the connect's error or
  a cancellation. access() passes on the access the sandbox was lent with
  instead of serializing it again. A command that keeps background services
  runs as the lent user: that provider call reads no sandbox default.
- Docstrings: a borrower installs its runtime as the lent user unless a
  command names another; the repository check is planned, not in place;
  the OpenCode and Pi sandboxed agents turn CPU caps on in code.
- Tests import from the defining modules; the AgentSandboxConfig tests sit
  beside their module in tests/unit_tests/agents/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Running it before the dry-run return broke servers whose config a test
mocks (test_dry_run_skips_webserver_spinup); the check stays where the PR
put it. critpt's new test stubs the execution sessions instead of building
a Docker provider, so it runs on hosts without Docker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
- Retiring a sandboxed session closes it, so the loop stops and the
  borrowed client is released.
- A model server's HTTP error raised in the sandbox comes back with its
  status, headers and body, as the agent boundary reports one raised in
  process.
- Stage only the settings the loop reads; refuse a direct_http grant the
  sandbox cannot reach and a subclass that changes the agent loop.
- Write the harness archive in a private directory, rewrite it when it is
  gone or changed, and build it off the event loop; create each
  activation's directory; key the runtime only when it is used.
- Drop the rollout-stop hook until stops are enforced in the sandbox, and
  use the base session_close_timeout_seconds and the harnesses'
  sandbox_runner_timeout_seconds name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…attempt-sandbox

Signed-off-by: yaoyu-33 <[email protected]>

# Conflicts:
#	fern/versions/latest/pages/about/concepts/key-terminology.mdx
…mple-agent-sandbox-mode

Signed-off-by: yaoyu-33 <[email protected]>

# Conflicts:
#	responses_api_agents/simple_agent/app.py
@yaoyu-33

yaoyu-33 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 383cf0a

@yaoyu-33 yaoyu-33 added the area:sandbox Sandbox providers, isolation, and sandbox runtime contracts label Dec 2, 2026
@yaoyu-33

yaoyu-33 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=true

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP WITH CARE

I reviewed all 25 changed files and traced the sandbox lifecycle, agent integration and configuration compatibility with three delegated reviewers. Two correctness risks are inline. The lifecycle probes otherwise showed the expected placement, failure attribution and cleanup behavior.

RISK: Add representative real-model smoke evidence

Could you provide one real-model rollout through a configured sandbox placement? The PR describes the GPQA Diamond rollout as using the existing model-only path. The sandbox lifecycle and weather evidence uses scripted models, so it does not exercise actual agent inference and sandbox grading together. AGENTS.md requires representative real smoke rollouts for behavior-changing environment work.

Please exercise an Environment Server-owned agent group or the new verifier-only placement through sandbox seeding and verification. Record the model and configuration, observed agent and verifier behavior, score, failures or masking, and confirmation that cleanup releases the groups. This asks for validation evidence, not a production-code change.

Validation

  • I relied on successful DCO, Lint check, Nemo_CICD_Test, Unit tests / Test and Unit tests / Server suite checks associated with this head. Harness conformance reports eight P0 passes, two failures and four unavailable results. The Claude Code and Terminus failure categories also appear on the admitted base; I have not attributed those failures to this PR.
  • CPU probes ran in gym:fa8e6907e0210e92fe22dad57c6f4df09d52350d, the default branch's CI image, because the head image build was skipped. Routing, cancellation, cleanup retry, checkpoint restart, compatibility exports and agent ownership-header probes passed. The HTTP serialization and MCP preparation probes reproduced the inline findings. An in-memory reserved-name fix blocked MCP preparation while keeping its HTTP endpoint working.
  • I did not rerun green existing suites. These probes use fake providers and do not validate real provider enforcement or replace the requested real-model smoke.

Inline comments (escaped v1):

  • nemo_gym/server_runtime/base_resources_server.py line 153: RISK: Keep sandbox preparation out of the model's MCP tools.

    The new route registration makes /prepare_sandbox available whenever a subclass overrides the hook, but this reserved-name set omits it. With expose_tools_over_mcp: true, tool harvesting therefore advertises lifecycle preparation as a model tool.

    I confirmed this with python mcp_prepare_probe.py through the real /mcp endpoint: tools/list included prepare_sandbox, and a seed-issued token successfully invoked the hook with a different resources_session_id and model-chosen task_data. Preparation-enabled integrations can consequently rerun initialization during the agent turn. The concrete effect depends on their hook; the probe does not demonstrate a deployed exploit.

    Could you add prepare_sandbox to RESERVED_MCP_TOOL_NAMES? That excludes automatic harvesting and prevents an explicit tool inventory from reintroducing it. Keep the Environment Server's HTTP preparation path working. Add regression coverage showing that MCP listing omits it, MCP calling cannot enter the hook, ordinary task tools still work, and direct HTTP preparation succeeds.

  • nemo_gym/server_runtime/base_resources_server.py line 436: RISK: Preserve an explicitly selected verifier_mode="none" through serialization.

    This removes verifier_mode even when the caller explicitly supplied it. The new seed wrapper interprets a dict without that field as undeclared and substitutes the class default.

    For a Resources Server whose class default is "separate", an override returning ResourcesSeedSessionResponse(..., verifier_mode="none") correctly selects "none". Returning the same reply via .model_dump(mode="json") selects "separate" instead. python explicit_mode_probe.py reproduced both outcomes through HTTP. This can provision an unwanted verifier group or reject an otherwise sandbox-free task when no provider is configured.

    Could you retain explicitly supplied "none" and omit only an undeclared default? Keep the existing no-declaration wire shape, including replies built by sandbox_declaration(), which currently supplies the class default explicitly. Add HTTP regression cases for typed and serialized-dict replies under a "separate" class default; both explicit overrides should yield effective mode "none", while the existing undeclared-default compatibility assertion still passes.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@yaoyu-33

yaoyu-33 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 257a708

@yaoyu-33

yaoyu-33 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Fixed both findings from the AI review in 257a708.

  • prepare_sandbox is reserved. MCP omits it from tool discovery, rejects calls as unknown, and rejects explicit inventories that name it. Ordinary MCP tools and direct HTTP preparation still work.
  • An explicit verifier_mode="none" survives both typed and serialized-dict seed replies, including when the Resources Server defaults to "separate". Servers that declare no placement keep their existing wire format.

Real-model rollout. I ran this lifecycle commit with the code_gen pairing and grading helpers from #6754 as the consumer. Simple Agent called Qwen2.5-0.5B-Instruct through llama.cpp at temperature 0, with no tools or agent sandbox. The model generated a Python solution to an integer-squaring task. The Environment Server provisioned one fresh Docker verifier with networking disabled, 1 CPU, and 6 GiB of memory. Both test inputs passed (3 → 9 and 5 → 25). Reward was 1.0, mask_sample=false, with no failure kind. The provider recorded one create and one successful remove with the same container ID.

The focused MCP, seed and placement suites passed 184/184. Full pre-commit passed locally with the private guardwords check skipped because its catalog was unavailable. All three required checks passed, including DCO, Lint check, and Nemo_CICD_Test. CI run for this commit

The optional harness report recorded 9 P0 passes and 2 P0 failures (claude_code and terminus_2_sandboxed). The opencode, openclaw, and miniswe_sandboxed probes were unavailable. Conformance report

@yaoyu-33

yaoyu-33 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=true

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP WITH CARE

I reviewed all 26 changed files and connected callers with three delegated reviewers. One RISK is inline: deterministic provider-option type errors are marked retryable, including after a completed agent turn.

Earlier findings

  • HTTP and MCP probes confirm both code findings from review 6159285642 are fixed. MCP excludes preparation while direct HTTP preparation works. Explicit verifier_mode="none" survives typed and serialized replies, and undeclared defaults keep their compatible wire shape.
  • The author's reported verifier-only rollout supplies the requested real-model smoke evidence: Qwen2.5-0.5B-Instruct generated a solution, the Docker verifier returned reward 1.0 without masking, and one create matched one successful remove. I did not independently reproduce that rollout.

Validation

  • I relied on successful DCO, Lint check, Nemo_CICD_Test, core, sandbox and server-suite CI checks associated with this head. The test workflow reports the PR merge revision e3d02cd83720f4839c7368f8c33d62e32a6190b8. I did not rerun green suites.
  • CPU probes ran in gym:fa0384812210928a042ecb8c1592a5c0abb8c9f9, the default branch's CI image, because the head image build was skipped. Cancellation, concurrent attempt isolation, checkpoint restart, cleanup retry, verifier input separation, compatibility exports and skipped-verification probes passed. Actual E2B option validation reproduced the inline finding.
  • The advisory harness report records nine P0 passes, two failures and three unavailable results. Claude Code and Terminus show the same first-failure signatures on the admitted base. OpenCode, OpenClaw and Mini-SWE have no usable results.

The lifecycle probes use fake providers and do not validate real provider isolation or network enforcement.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@hemildesai hemildesai 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.

Re-reviewed at 257a708340. My blocking finding from the last round is resolved, and I have no blockers left.

Resolved since aba22e91c5

  • The seed-time tool guard, the agent type deny-list and the config and README edits that went with it are out of this PR. The diff no longer touches any shipped YAML, so pairings with no sandbox settings behave as on main.
  • Embedded NOOA is refused only when it would be lent a sandbox it cannot borrow.
  • resolve_server_dir now lives in nemo_gym.config, so the Environment Server no longer imports from the supervisor.
  • The agent-owned sandbox check applies only with require_agent_owned_sandbox, and the refusal says it accepts only built-in providers.
  • The README documents which settings a fresh verifier group reuses and when to declare a verifier_group.
  • Invalid settings and missing dependencies are terminal; other start failures are retryable with a provider failure kind.
  • 257a708340: reserving prepare_sandbox from MCP tools and keeping an explicit verifier_mode: none from an overridden seed both look right.

Non-blocking

  • Two inline notes on failure classification.
  • The reviewed-entrypoint lists still gate verifier_sandbox, so an out-of-tree model-only agent cannot use it. Fine while it is opt-in; a declared capability would remove the lists later.
  • _seed_agent in environment_servers/single_agent_turn/app.py keeps a local resources_tool_transports alias that the guard removal left behind.

Not covered: I did not run this head live or run the unit tests locally, and I did not review the stacked guard PR. The five failing checks are all under the non-blocking harness conformance job; I could not download their logs, so I cannot say whether this PR causes them.

🤖 Generated with Claude Code

await self.release_attempt_sandbox(attempt.key)
return None
try:
await self.sandboxes.stop(attempt.key)

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.

Non-blocking. For a separate verifier, a failed stop of the agent's group now fails a finished attempt as retryable, which reruns the whole agent turn. Before, the failure was logged and cleanup retried the stop. If the intent is that the verifier never starts while the agent's group may still be alive, that is a fair trade; otherwise a bounded retry of the stop here would avoid paying for the agent turn twice.

raise dependency_failure(
error,
stage=stage,
terminal=isinstance(error, (ConfigError, ValueError, ImportError)),

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.

Non-blocking. The type rule covers the whole block: spec building, create, the mkdir exec and access. Any ValueError subclass a provider raises while starting, for example from validating a response, would be terminal. I did not find a transient case in the built-in providers. Applying the rule only to the spec-building calls would rule it out.

@yaoyu-33

yaoyu-33 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 9df3d81

@nemo-pr-automation
nemo-pr-automation Bot requested review from a team December 3, 2026 19:20
@yaoyu-33

yaoyu-33 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:env-infra Shared environment framework, lifecycle, registry, scaffolding, and validation area:sandbox Sandbox providers, isolation, and sandbox runtime contracts feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high 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.

6 participants