Skip to content

fix: clear onboard session when stale sandbox is removed (#1316) - #1555

Merged
cv merged 1 commit into
mainfrom
fix/sandbox-session-cleanup
Apr 7, 2026
Merged

cv merged 1 commit into
mainfrom
fix/sandbox-session-cleanup

Conversation

@zyang-dev

Copy link
Copy Markdown
Contributor

Summary

After a sandbox deletion , nemoclaw list shows ghost sandboxes recovered from onboard-session.json. The status
command detect the sandbox is missing and remove it from the registry, but onboard-session.json is never cleaned, causing nemoclaw list to re-add it every time.

Related Issue

Fixes #1316

Changes

bin/nemoclaw.js: Clear sandboxName from onboard-session.json when a sandbox is removed from the registry, at all three registry.removeSandbox() call sites (connect, status, destroy paths).

Type of Change

  • Code change for a new feature, bug fix, or refactor.
  • Code change with doc updates.
  • Doc only. Prose changes without code sample modifications.
  • Doc only. Includes code sample changes.

Testing

openshell sandbox delete -> nemoclaw list (deleted sandbox still shown) -> nemoclaw status (removes
stale entry) → nemoclaw list (deleted sandbox reappears). After the fix, the deleted sandbox does not reappear.

  • npx prek run --all-files passes (or equivalently make check).
  • npm test passes.
  • make docs builds without warnings. (for doc-only changes)

Checklist

General

Code Changes

  • Formatters applied — npx prek run --all-files auto-fixes formatting (or make format for targeted runs).
  • Tests added or updated for new or changed behavior.
  • No secrets, API keys, or credentials committed.
  • Doc pages updated for any user-facing behavior changes (new commands, changed defaults, new features, bug fixes that contradict existing docs).

Doc Changes

  • Follows the style guide. Try running the update-docs agent skill to draft changes while complying with the style guide. For example, prompt your agent with "/update-docs catch up the docs for the new changes I made in this PR."
  • New pages include SPDX license header and frontmatter, if creating a new page.
  • Cross-references and links verified.

Signed-off-by: zyang-dev [email protected]

@cv
cv merged commit ecc1277 into main Apr 7, 2026
8 checks passed
@zyang-dev
zyang-dev deleted the fix/sandbox-session-cleanup branch April 7, 2026 00:35
ColinM-sys added a commit to ColinM-sys/NemoClaw that referenced this pull request Apr 9, 2026
…not resurrect destroyed sandboxes

NVIDIA#1641 reported that after `nemoclaw <name> destroy`, `nemoclaw list`
would print "Recovered sandbox inventory from the last onboard
session" and re-show the destroyed sandbox, then `nemoclaw <name>
connect` would mark it stale and remove it again — looping forever
between the two commands. The reporter was on v0.0.6-19-gea9a6f2,
which is 13 commits behind ecc1277 (PR NVIDIA#1555), the commit that
added `s.sandboxName = null` to `sandboxDestroy()`. So the bug is
already fixed on main, but there is no regression test pinning the
behavior, which means a future refactor of the destroy or list path
could silently re-introduce the loop.

Add a regression test in src/lib/inventory-commands.test.ts under
"NVIDIA#1641" that exercises the post-destroy state explicitly: registry
empty, session present but with sandboxName cleared. Assert that
list prints the onboard hint and does NOT print either of the
recovery / "last onboarded sandbox was" messages that signal the
loop has come back.

Refs: NVIDIA#1641, NVIDIA#1555
ColinM-sys added a commit to ColinM-sys/NemoClaw that referenced this pull request Apr 10, 2026
…not resurrect destroyed sandboxes

NVIDIA#1641 reported that after `nemoclaw <name> destroy`, `nemoclaw list`
would print "Recovered sandbox inventory from the last onboard
session" and re-show the destroyed sandbox, then `nemoclaw <name>
connect` would mark it stale and remove it again — looping forever
between the two commands. The reporter was on v0.0.6-19-gea9a6f2,
which is 13 commits behind ecc1277 (PR NVIDIA#1555), the commit that
added `s.sandboxName = null` to `sandboxDestroy()`. So the bug is
already fixed on main, but there is no regression test pinning the
behavior, which means a future refactor of the destroy or list path
could silently re-introduce the loop.

Add a regression test in src/lib/inventory-commands.test.ts under
"NVIDIA#1641" that exercises the post-destroy state explicitly: registry
empty, session present but with sandboxName cleared. Assert that
list prints the onboard hint and does NOT print either of the
recovery / "last onboarded sandbox was" messages that signal the
loop has come back.

Refs: NVIDIA#1641, NVIDIA#1555
Signed-off-by: ColinM-sys <[email protected]>
ColinM-sys added a commit to ColinM-sys/NemoClaw that referenced this pull request Apr 14, 2026
…not resurrect destroyed sandboxes

NVIDIA#1641 reported that after `nemoclaw <name> destroy`, `nemoclaw list`
would print "Recovered sandbox inventory from the last onboard
session" and re-show the destroyed sandbox, then `nemoclaw <name>
connect` would mark it stale and remove it again — looping forever
between the two commands. The reporter was on v0.0.6-19-gea9a6f2,
which is 13 commits behind ecc1277 (PR NVIDIA#1555), the commit that
added `s.sandboxName = null` to `sandboxDestroy()`. So the bug is
already fixed on main, but there is no regression test pinning the
behavior, which means a future refactor of the destroy or list path
could silently re-introduce the loop.

Add a regression test in src/lib/inventory-commands.test.ts under
"NVIDIA#1641" that exercises the post-destroy state explicitly: registry
empty, session present but with sandboxName cleared. Assert that
list prints the onboard hint and does NOT print either of the
recovery / "last onboarded sandbox was" messages that signal the
loop has come back.

Refs: NVIDIA#1641, NVIDIA#1555
Signed-off-by: ColinM-sys <[email protected]>
gemini2026 pushed a commit to gemini2026/NemoClaw that referenced this pull request Apr 14, 2026
NVIDIA#1555)

<!-- markdownlint-disable MD041 -->
## Summary
After a sandbox deletion , `nemoclaw list` shows ghost sandboxes
recovered from `onboard-session.json`. The `status`
command detect the sandbox is missing and remove it from the registry,
but `onboard-session.json` is never cleaned, causing `nemoclaw list` to
re-add it every time.

## Related Issue
 Fixes NVIDIA#1316

## Changes
`bin/nemoclaw.js`: Clear `sandboxName` from `onboard-session.json` when
a sandbox is removed from the registry, at all three
`registry.removeSandbox()` call sites (connect, status, destroy paths).

## Type of Change
<!-- Check the one that applies. -->
- [x] Code change for a new feature, bug fix, or refactor.
- [ ] Code change with doc updates.
- [ ] Doc only. Prose changes without code sample modifications.
- [ ] Doc only. Includes code sample changes.

## Testing
`openshell sandbox delete` -> `nemoclaw list` (deleted sandbox still
shown) -> `nemoclaw status` (removes
stale entry) → `nemoclaw list` (deleted sandbox reappears). After the
fix, the deleted sandbox does not reappear.

- [x] `npx prek run --all-files` passes (or equivalently `make check`).
- [x] `npm test` passes.
- [ ] `make docs` builds without warnings. (for doc-only changes)

## Checklist

### General

- [x] I have read and followed the [contributing
guide](https://github.com/NVIDIA/NemoClaw/blob/main/CONTRIBUTING.md).
- [ ] I have read and followed the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md).
(for doc-only changes)

### Code Changes
<!-- Skip if this is a doc-only PR. -->
- [x] Formatters applied — `npx prek run --all-files` auto-fixes
formatting (or `make format` for targeted runs).
- [ ] Tests added or updated for new or changed behavior.
- [x] No secrets, API keys, or credentials committed.
- [ ] Doc pages updated for any user-facing behavior changes (new
commands, changed defaults, new features, bug fixes that contradict
existing docs).

### Doc Changes
<!-- Skip if this PR has no doc changes. -->
- [ ] Follows the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md).
Try running the `update-docs` agent skill to draft changes while
complying with the style guide. For example, prompt your agent with
"`/update-docs` catch up the docs for the new changes I made in this
PR."
- [ ] New pages include SPDX license header and frontmatter, if creating
a new page.
- [ ] Cross-references and links verified.

---
<!-- DCO sign-off (required by CI). Replace with your real name and
email. -->
Signed-off-by: zyang-dev <[email protected]>

Signed-off-by: zyang-dev <[email protected]>
ColinM-sys added a commit to ColinM-sys/NemoClaw that referenced this pull request Apr 15, 2026
…not resurrect destroyed sandboxes

NVIDIA#1641 reported that after `nemoclaw <name> destroy`, `nemoclaw list`
would print "Recovered sandbox inventory from the last onboard
session" and re-show the destroyed sandbox, then `nemoclaw <name>
connect` would mark it stale and remove it again — looping forever
between the two commands. The reporter was on v0.0.6-19-gea9a6f2,
which is 13 commits behind ecc1277 (PR NVIDIA#1555), the commit that
added `s.sandboxName = null` to `sandboxDestroy()`. So the bug is
already fixed on main, but there is no regression test pinning the
behavior, which means a future refactor of the destroy or list path
could silently re-introduce the loop.

Add a regression test in src/lib/inventory-commands.test.ts under
"NVIDIA#1641" that exercises the post-destroy state explicitly: registry
empty, session present but with sandboxName cleared. Assert that
list prints the onboard hint and does NOT print either of the
recovery / "last onboarded sandbox was" messages that signal the
loop has come back.

Refs: NVIDIA#1641, NVIDIA#1555
Signed-off-by: ColinM-sys <[email protected]>
ColinM-sys added a commit to ColinM-sys/NemoClaw that referenced this pull request Apr 16, 2026
…not resurrect destroyed sandboxes

NVIDIA#1641 reported that after `nemoclaw <name> destroy`, `nemoclaw list`
would print "Recovered sandbox inventory from the last onboard
session" and re-show the destroyed sandbox, then `nemoclaw <name>
connect` would mark it stale and remove it again — looping forever
between the two commands. The reporter was on v0.0.6-19-gea9a6f2,
which is 13 commits behind ecc1277 (PR NVIDIA#1555), the commit that
added `s.sandboxName = null` to `sandboxDestroy()`. So the bug is
already fixed on main, but there is no regression test pinning the
behavior, which means a future refactor of the destroy or list path
could silently re-introduce the loop.

Add a regression test in src/lib/inventory-commands.test.ts under
"NVIDIA#1641" that exercises the post-destroy state explicitly: registry
empty, session present but with sandboxName cleared. Assert that
list prints the onboard hint and does NOT print either of the
recovery / "last onboarded sandbox was" messages that signal the
loop has come back.

Refs: NVIDIA#1641, NVIDIA#1555
Signed-off-by: ColinM-sys <[email protected]>
ColinM-sys added a commit to ColinM-sys/NemoClaw that referenced this pull request Apr 27, 2026
…not resurrect destroyed sandboxes

NVIDIA#1641 reported that after `nemoclaw <name> destroy`, `nemoclaw list`
would print "Recovered sandbox inventory from the last onboard
session" and re-show the destroyed sandbox, then `nemoclaw <name>
connect` would mark it stale and remove it again — looping forever
between the two commands. The reporter was on v0.0.6-19-gea9a6f2,
which is 13 commits behind ecc1277 (PR NVIDIA#1555), the commit that
added `s.sandboxName = null` to `sandboxDestroy()`. So the bug is
already fixed on main, but there is no regression test pinning the
behavior, which means a future refactor of the destroy or list path
could silently re-introduce the loop.

Add a regression test in src/lib/inventory-commands.test.ts under
"NVIDIA#1641" that exercises the post-destroy state explicitly: registry
empty, session present but with sandboxName cleared. Assert that
list prints the onboard hint and does NOT print either of the
recovery / "last onboarded sandbox was" messages that signal the
loop has come back.

Refs: NVIDIA#1641, NVIDIA#1555
Signed-off-by: ColinM-sys <[email protected]>
@wscurran wscurran added the bug-fix PR fixes a bug or regression label Jun 8, 2026
@wscurran wscurran added NV QA Bugs found by the NVIDIA QA Team UAT Issues flagged for User Acceptance Testing. labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression NV QA Bugs found by the NVIDIA QA Team UAT Issues flagged for User Acceptance Testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[spark] nemoclaw list shows ghost sandboxes recovered from onboard session after gateway restart or machine reboot

3 participants