Repository navigation
feat(run_code): run a script on a deploy_sandbox sandbox via sandbox_name - #69
Merged
psinghal20 merged 5 commits intoOct 6, 2026
Conversation
…name run_code could only target an env's VM host (env_id) or an agent container (agent_name), so a task that provisions a bare machine with deploy_sandbox, stages files onto it with load_artifact(sandbox_name) and collects them with collect_artifacts(sandbox_name) could not run a script there in between. - sandbox_name: resolved from context.deployed_sandboxes through the sandbox's own provider type. A VM-mode sandbox runs on its host (the existing host target); a container-mode one runs in its container, directly on a container provider and through `docker exec -u 0` on a VM-backed one, deciding from the mode deploy_sandbox recorded. - env_id, sandbox_name and agent_name are mutually exclusive; a blank value is unset. A host target no longer defaults agent_name, so it serializes agent_name: null; from_dict drops the default agent name older steps stored beside env_id, so they keep loading.
psinghal20
force-pushed
the
pratyush/run-code-named-sandbox
branch
from
October 6, 2026 17:20
9c45e47 to
fdb6ae7
Compare
…routing' into pratyush/run-code-named-sandbox
…n cleanup Addresses review: each run built a uniquely tagged image that was never removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t_name Addresses review: before the targets were exclusive, env_id overrode any agent_name, so stored steps with both would now fail to load. Drop the ignored agent_name on load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ners Addresses review: the ancestor filter could reach another run's containers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
psinghal20
added this pull request to stack #72
October 6, 2026 17:51
earakely-scale
approved these changes
Oct 6, 2026
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
run_codecould target only an env's VM host (env_id) or an agent container (agent_name). A task that provisions a bare machine withdeploy_sandbox, stages files onto it withload_artifact(sandbox_name=...)and collects them withcollect_artifacts(sandbox_name=...)had no way to run a script there in between.sandbox_nametarget, resolved fromcontext.deployed_sandboxesthrough the sandbox's own provider type (the lookupload_artifactandcollect_artifactsuse), deciding from the modedeploy_sandboxrecorded:_HostTarget; staging, run, output read and timeout unchanged);_AgentTarget, the path container-mode agents already use: directly on a container provider, and with adocker exec -u 0 <container>prefix on a VM-backed one, where a plain exec lands on the host.env_id,sandbox_nameandagent_nameare mutually exclusive: more than one fails at construction (previouslyenv_idsilently won overagent_name). A blank value, as a form submits it, is unset.env_idorsandbox_name) no longer defaultsagent_name, so it serializesagent_name: null. An agent step with noagent_namestill runs inDEFAULT_AGENT_NAME.DEFAULT_AGENT_NAMEbesideenv_id;from_dictdrops it so they keep loading. A stored step with a non-defaultagent_namebesideenv_idis rejected.Use case
Building a deliverable on a throwaway machine with no env or agent deployed:
deploy_sandbox→load_artifact(inputs) →run_code(build) →collect_artifacts(output).Tests
tst/unit/task_step/test_run_code.py: the named sandbox on a VM (host, neverdocker), its provider type, an unknown name, a container-mode sandbox on a container provider (no prefix) and on a VM-backed one (docker exec -u 0), round trip; exclusivity (every pair and all three, the default agent name besidesandbox_name, blank values unset, host targets store no agent name, no target uses the default agent, legacy stored steps load, a stored non-default agent besideenv_idis rejected).tst/integration/task_step/test_run_code_named_sandbox_local.py(new), the chaindeploy_sandbox→load_artifact→run_code(zips the inputs,0600) →collect_artifacts→load_artifact(artifact_from_step_id=...)→run_code(reads the zip back):registry:2, a non-root image user, paths under/workin the container): passes. Cleanup removes only the containers of sandboxes in the test's own sandbox root.tst/unit+ protocol suite with fix(task_steps): reach the container of a container-mode deploy_sandbox sandbox #68 in apython:3.12slim image: 6084 passed; the same 3 environment failures as onmainin that image.check_plugin_api.py: no break to the plugin surface.Notes for reviewers:
run_codeandcollect_artifactsneed GNUtimeoutandstat -c; CI runs Linux.collect_artifactsgiven an absoluteartifact_pathsentry names the collected member by that absolute path, whichload_artifact(artifact_from_step_id=...)then rejects as non-relative. The test collects withbase_pathand a relative name.🤖 Generated with Claude Code
The PR appears safe to merge; the previous findings are addressed and no new issue was established.
What we checked:
agent_name, but the constructor rejects two remaining targets.Summary
Tasks can now use
run_codeon a sandbox deployed by name, running on its host or inside its container based on the sandbox mode. The step also enforces one execution target at a time while keeping saved host steps loadable.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A["run_code target"] --> B{"Selected target"} B -- env_id --> C["Environment host"] B -- sandbox_name --> D{"Deployed sandbox mode"} B -- agent_name or default --> E["Agent container"] D -- VM --> F["Sandbox host"] D -- container --> G["Sandbox container"]Reviews (4) · Last reviewed commit: "test(run_code): scope image cleanup to t..."