Skip to content

feat(sandbox): support conditional deletion by sandbox ID - #6205

Open
rodrigosetti wants to merge 3 commits into
ai-openshell:mainfrom
rodrigosetti:feat/3210-conditional-sandbox-delete/rodrigosetti
Open

rodrigosetti wants to merge 3 commits into
ai-openshell:mainfrom
rodrigosetti:feat/3210-conditional-sandbox-delete/rodrigosetti

Conversation

@rodrigosetti

Copy link
Copy Markdown

Summary

An automated cleanup that reads a sandbox and later deletes it by name can delete a same-name replacement. Allow the caller to require that the name still resolves to the sandbox ID it observed.

Related Issue

Closes #3210

Changes

  • Add optional DeleteSandboxRequest.expected_sandbox_id. A mismatch returns ABORTED with ErrorInfo reason SANDBOX_IDENTITY_MISMATCH. An empty ID is invalid, and an omitted ID preserves name-only deletion. Interceptors must preserve a caller-supplied ID.
  • Add openshell sandbox delete --id ID and openshell sandbox delete NAME --expected-id ID. Foreground sandbox create --no-keep uses the created ID. Conditional cleanup only stops local port forwards tracked for that ID.
  • Bind the TUI confirmation to the name, workspace, and ID shown when it opens, even if the list refreshes before the user confirms.
  • Keep the Rust SDK's delete_sandbox signatures unchanged. Use the existing raw gRPC client for conditional requests. Update the public schema inventory without changing stored schemas.

Release Notes

Conditional deletion requires a gateway that supports expected_sandbox_id. Older gateways ignore the field and delete by name.

Testing

  • 36 focused Rust tests passed across the gateway, core, SDK, CLI, and TUI. Regression coverage includes interceptor rewrites, request replay, forward ownership, confirmation refresh, and SDK type inference.
  • Docker conformance passed for stale and matching sandbox IDs through raw gRPC.
  • In a live TUI PTY, refreshed the sandbox list with a same-name replacement while the confirmation was open. Confirming was refused and the replacement remained intact.
  • Rust formatting, Buf lint and compatibility against upstream, Markdown lint, Fern docs validation, and frozen-path validation passed.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

Add an optional expected_sandbox_id precondition to DeleteSandbox. Reject
an empty ID and report a mismatch as ABORTED with structured reason
SANDBOX_IDENTITY_MISMATCH. Requests without the field stay name-based.

Add CLI deletion by ID and by name with an expected ID. Bind CLI no-keep
cleanup and TUI deletion to the observed sandbox ID. Expose the precondition
in the Rust SDK without changing name-only deletion callers.

Exercise name reuse and delete replay at the gateway and same-name
replacement through Rust conformance. Document the version requirement
for gateways that predate conditional deletion.

Closes ai-openshell#3210

Signed-off-by: rodrigosetti <rodrigosetti@gmail.com>
Avoid unused qualification warnings on the sandbox delete path.

Signed-off-by: rodrigosetti <rodrigosetti@gmail.com>
Preserve the caller's expected sandbox ID through gateway interception,
pin the TUI confirmation to its original target, and scope port-forward
cleanup to that target. Keep the existing Rust SDK delete signatures
and use raw gRPC for conditional requests.

Signed-off-by: rodrigosetti <rodrigosetti@gmail.com>

This branch has not been deployed

No deployments
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.

Support atomic delete-by-identity for sandboxes (no compare-and-delete primitive today)

1 participant