Skip to content

fix(cli): clear stale last-used sandbox on deletion#510

Open
Kh4L wants to merge 1 commit intoNVIDIA:mainfrom
Kh4L:fix/stale-last-used-sandbox
Open

fix(cli): clear stale last-used sandbox on deletion#510
Kh4L wants to merge 1 commit intoNVIDIA:mainfrom
Kh4L:fix/stale-last-used-sandbox

Conversation

@Kh4L
Copy link
Contributor

@Kh4L Kh4L commented Mar 20, 2026

Summary

  • Clears the locally stored last-used sandbox record when the matching sandbox is deleted
  • Prevents commands like sandbox connect from falling back to a deleted sandbox, which previously caused confusing gRPC "not found" errors

Related Issue

Closes #172

Changes

  • crates/openshell-bootstrap/src/metadata.rs: add clear_last_sandbox_if_matches() that removes the persisted record when it matches the deleted sandbox name
  • crates/openshell-bootstrap/src/lib.rs: export the new function
  • crates/openshell-cli/src/run.rs: call clear_last_sandbox_if_matches() after each successful sandbox deletion; add gateway parameter to sandbox_delete()
  • crates/openshell-cli/src/main.rs: pass gateway name through to sandbox_delete()

Testing

  • mise run test passes
  • Create a sandbox, delete it, then run openshell sandbox connect — should get a clean "no last-used sandbox" error instead of a gRPC crash
  • Deleting a sandbox that is not the last-used one leaves the record untouched

Checklist

  • Follows Conventional Commits format
  • Signed-off-by line included
  • No new dependencies introduced

When a sandbox is deleted, the locally stored last-used record now gets
cleared if it matches the deleted sandbox name. This prevents subsequent
commands from falling back to a sandbox that no longer exists, which
previously caused confusing gRPC errors.

Adds clear_last_sandbox_if_matches() to openshell-bootstrap and calls
it from sandbox_delete() after each successful deletion.

Closes NVIDIA#172

Signed-off-by: Serge Panev <spanev@nvidia.com>
@Kh4L Kh4L requested a review from a team as a code owner March 20, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): handle stale last-used sandbox after sandbox deletion

1 participant