Skip to content

fix(sandbox): reclaim owned session runtimes - #5088

Merged
yaoyu-33 merged 5 commits into
NVIDIA-NeMo:mainfrom
anson627:anson627/kilocode-conformance-fixes
Nov 10, 2026
Merged

yaoyu-33 merged 5 commits into
NVIDIA-NeMo:mainfrom
anson627:anson627/kilocode-conformance-fixes

Conversation

@anson627

@anson627 anson627 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Reclaim private session directories after artifact capture and confirmed cleanup, before stopping owned sandboxes. Seeded sessions that never launched are cleaned too; task output and borrowed-session behavior are preserved.

If directory removal fails, log the failure and still stop the owned sandbox. A successful stop completes close because a stopped sandbox cannot retry file removal. Stop failures remain retryable, cancellation still propagates, and provider OOM handling is preserved. Update the Hermes fallback test to cover this contract.

Repair the CI failures encountered while validating this change:

  • Retain the first successful package-index refresh across retries so container update hooks cannot erase completed or partial packages. Bound index refresh and download-only operations separately, then install from the completed cache with --no-download. This retries slow downloads without killing dpkg during configuration. Repair interrupted dpkg state before retrying; retain the workflow timeout and failure after exhausted retries.
  • Snapshot runtime identity within the adaptive resume integration test so concurrent component workers cannot change its environmental inputs. Production fingerprinting, configuration-mismatch checks, and the separate fingerprint regression remain intact.

Split from #4764; no separate issue is needed for these focused lifecycle and CI repairs. Current main was merged without rewriting the contributor's commits. No configuration migration or verifier/scoring change.

Validation on Linux, Python 3.13.14:

  • Lifecycle revision 678e8f0e53: four before/after regressions; 132 session/supervisor tests passed; 639 Hermes/shared-session/conformance tests passed, 14 skipped (overlapping session coverage). One real-model smoke through SandboxSession.execute and LocalProvider independently verified the answer, transcript capture, removal of runtime paths, preservation of task output, and sandbox stop. This validates the shared lifecycle, not full Kilo/Hermes benchmark parity.
  • Resume-test revision b9f5e2ae0: a clean-to-dirty checkout identity injection reproduced the fingerprint exception before isolation and passed afterward; all 363 CI-environment and agentic-if-realworld tests passed. CI did not preserve the original identity payloads, so the exact changing field in the first queue run remains unknown. The repaired server shard 2 also passed in CI run 42756951645.
  • Final installer revision 155408bec23bd9079730cbec27f1b3fe62e495fa: all 93 CI-environment tests passed, including normal installation, interrupted configuration, exhausted retries, download timeout recovery across cache-clearing update hooks, failed index-refresh recovery, and assertions that timeouts exclude dpkg/configuration.
  • Full pre-commit run --all-files, bash -n scripts/ci/install_test_dependencies.sh, and git diff --check passed on the final source. Independent review found no remaining blocker.
  • Additional model smoke is N/A for the CI/test-only follow-ups; the lifecycle implementation is unchanged from the validated revision above.
python -m pytest tests/unit_tests/agents/test_sandbox_session.py tests/unit_tests/agents/test_process_supervisor.py -q -o addopts=''
python -m pytest --import-mode=importlib responses_api_agents/hermes_agent/tests tests/unit_tests/agents/test_sandbox_session.py scripts/harness_conformance/tests -q -o addopts=''
python -m pytest --import-mode=importlib tests/unit_tests/tooling/test_ci_environment.py resources_servers/agentic_if_realworld/tests --no-cov -q
python -m pytest tests/unit_tests/tooling/test_ci_environment.py --no-cov -q
pre-commit run --all-files

Tests used temporary paths outside Git and the virtualenv on PATH. An initial Python 3.14 run encountered existing Hydra help-string failures; the CI-matching Python 3.13.14 run passed.

Prior author-reported live evidence (October 24): all seven Kilo conformance scenarios passed, and a Qwen3.6 rollout preserved task output and passed independent file verification and runtime cleanup. That evidence remains scoped to its original revision.

@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 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.

anson627 added a commit to anson627/Gym that referenced this pull request Oct 26, 2026
Move shared owned-session cleanup and Kilo model-error handling to NVIDIA-NeMo#5088, as requested in review. Keep NVIDIA-NeMo#4764 focused on CoreWeave and its required dependencies, configuration and docs.

CoreWeave plus OSWorld resolver-policy checks: 67 passed, 1 skipped. All-file pre-commit passed; private guardwords catalog unavailable. The four removed conformance files now match upstream/main.

Signed-off-by: Anson Qian <[email protected]>
@nemo-automation-bot nemo-automation-bot Bot added the community-request Issue reported or requested by someone from the community label Oct 26, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:agent Agent harnesses and Responses API agent behavior bug Something isn't working labels Oct 26, 2026
@anson627
anson627 marked this pull request as ready for review October 26, 2026 17:08
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the blocked Work cannot move forward until an external dependency is cleared label Oct 26, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 27, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Oct 28, 2026
@anson627
anson627 force-pushed the anson627/kilocode-conformance-fixes branch 2 times, most recently from 7b22ed1 to fe2ec78 Compare November 3, 2026 19:53
@anson627
anson627 force-pushed the anson627/kilocode-conformance-fixes branch from fe2ec78 to c82b270 Compare November 4, 2026 17:33
@yaoyu-33

yaoyu-33 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test c82b270

Remove private session files after capture and confirmed cleanup, before stopping owned sandboxes. Always stop the sandbox if runtime removal fails; preserve task output and borrowed-session behavior. Main now contains the Kilo model-error handling, so this PR retains only the shared runtime cleanup fix.

Signed-off-by: Anson Qian <[email protected]>
Retry slow package-index and download operations separately, retaining downloaded packages. Install from the completed cache without networking or an inner timeout so dpkg can finish safely. Verify download timeout recovery and timeout placement.

Signed-off-by: yaoyu-33 <[email protected]>
yaoyu-33
yaoyu-33 previously approved these changes Nov 10, 2026

@yaoyu-33 yaoyu-33 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.

Expected: slow package downloads retry without interrupting package configuration. Actual: only index/download operations have per-attempt timeouts; installation runs from the cache with --no-download, and interrupted dpkg state is repaired first. All 92 CI-environment tests and full pre-commit passed on the exact final tree; independent review found no blocker. Existing lifecycle and resume-test evidence remains applicable. Issues: none found; fresh required CI is starting.

@yaoyu-33

Copy link
Copy Markdown
Contributor

/ok to test 0e887ef

Refresh package indexes only until the first success so container update hooks cannot erase completed and partial downloads between retries. Cover cache-clearing hooks and index-refresh failure recovery.

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

@yaoyu-33 yaoyu-33 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.

Expected: package download retries retain progress and never interrupt dpkg configuration. Actual: successful index refresh is retained across retries; only index/download phases have inner timeouts, followed by no-download installation. The cache-clearing regression failed before the fix; all 93 CI-environment tests and full pre-commit passed on the exact final tree. Independent review found no blocker. Existing lifecycle and resume-test evidence remains applicable. Issues: none found; fresh required CI is starting.

@yaoyu-33

Copy link
Copy Markdown
Contributor

/ok to test 155408b

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42769359123

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42771359609

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42773713478

This branch was previously deployed

1 inactive deployment
public — 155408be Deployed Nov 10, 2026 by copy-pr-bot[bot] via release / finalize / notify #11314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior bug Something isn't working community-request Issue reported or requested by someone from the community ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants