Skip to content

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

Merged
johntmyers merged 3 commits intoNVIDIA:mainfrom
Kh4L:fix/stale-last-used-sandbox
Mar 23, 2026
Merged

fix(cli): clear stale last-used sandbox on deletion#510
johntmyers merged 3 commits 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

@johntmyers
Copy link
Collaborator

Thank you. Looks like some fmt checks that need to be addressed.

@Kh4L
Copy link
Contributor Author

Kh4L commented Mar 23, 2026

@johntmyers Just pushed a fix for the ftm (imports are sorted correctly now and the line wrapping matches rustfmt output)

Kh4L and others added 3 commits March 23, 2026 15:38
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>
Signed-off-by: Serge Panev <spanev@nvidia.com>
…ession

Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
@johntmyers johntmyers force-pushed the fix/stale-last-used-sandbox branch from 0b97d79 to fc40fef Compare March 23, 2026 22:40
@johntmyers johntmyers added the test:e2e Requires end-to-end coverage label Mar 23, 2026
@johntmyers johntmyers merged commit 1f2a85e into NVIDIA:main Mar 23, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants