Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions verifiers/envs/experimental/rlm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,10 +1378,9 @@ async def _recreate_sandbox(self, state: State) -> State:

# Create new sandbox via parent's parent (SandboxEnv.setup_state)
# We need to call the grandparent to avoid re-running RLM setup
request = self.get_sandbox_request(state)
try:
sandbox = await self.with_retry(self.sandbox_client.create)(
self.sandbox_request
)
sandbox = await self.with_retry(self.sandbox_client.create)(request)
except Exception as e:
raise SandboxCreationError(e)
self.active_sandboxes.add(sandbox.id)
Expand Down
9 changes: 6 additions & 3 deletions verifiers/envs/sandbox_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,15 @@ async def _delete_sandbox(sandbox_id: str):
# only warn, not raise an error on deletion
self.logger.warning(f"Failed to delete sandbox {sandbox_id}: {e}")

def get_sandbox_request(self, state: vf.State) -> CreateSandboxRequest:
"""Return sandbox request for this rollout. Override to customize per-state."""
return self.sandbox_request.model_copy()

async def setup_state(self, state: vf.State, **kwargs) -> vf.State:
"""Create per-rollout sandbox"""
request = self.get_sandbox_request(state)
try:
sandbox = await self.with_retry(self.sandbox_client.create)(
self.sandbox_request
)
sandbox = await self.with_retry(self.sandbox_client.create)(request)
except Exception as e:
raise SandboxCreationError(e)
self.active_sandboxes.add(sandbox.id)
Expand Down
Loading