Skip to content

Stop sandboxes when post-start setup raises - #3425

Merged
bxyu-nvidia merged 2 commits into
NVIDIA-NeMo:mainfrom
ekellbuch:kbuchanan/async-sandbox-start-with-setup
Sep 16, 2026
Merged

bxyu-nvidia merged 2 commits into
NVIDIA-NeMo:mainfrom
ekellbuch:kbuchanan/async-sandbox-start-with-setup

Conversation

@ekellbuch

@ekellbuch ekellbuch commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Terminal-Bench 2.1, SWE-bench, and DeepSWE run setup commands after starting a task container. If setup raises an exception, the caller never receives the container handle. The task fails, but the container can remain running until expiry or manual cleanup.

AsyncSandbox.start_with_setup() starts the container, runs setup, and attempts to stop the container if setup raises. The three resources servers now use this shared helper. Successful setup and subsequent agent execution and verification are unchanged.

The helper handles exceptions, including cancellation. A nonzero command exit alone does not trigger cleanup. If stopping the container also raises, the cleanup exception propagates with the setup exception retained as Python exception context.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format/copyright pass).
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

Signed-off-by: Kelly <ekellbuchanan@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nemo-automation-bot nemo-automation-bot Bot added the community-request Issue reported or requested by someone from the community label Sep 16, 2026
@ekellbuch
ekellbuch marked this pull request as ready for review September 16, 2026 05:59
Signed-off-by: Kelly <ekellbuchanan@gmail.com>
@yaoyu-33 yaoyu-33 added area:sandbox Sandbox providers, isolation, and sandbox runtime contracts bug Something isn't working complexity:medium Single-domain change with interacting parts or a moderate review surface needs-review PR is ready for code review and waiting on a reviewer labels Sep 16, 2026
@bxyu-nvidia

Copy link
Copy Markdown
Contributor

/ok to test f3c4af8

@bxyu-nvidia
bxyu-nvidia merged commit ed1c204 into NVIDIA-NeMo:main Sep 16, 2026
41 checks passed

This branch was previously deployed

1 inactive deployment
public β€” f3c4af8b Deployed Sep 16, 2026 by copy-pr-bot[bot] via release / finalize / notify #3056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:sandbox Sandbox providers, isolation, and sandbox runtime contracts bug Something isn't working community-request Issue reported or requested by someone from the community complexity:medium Single-domain change with interacting parts or a moderate review surface needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants