Repository navigation
Description
Problem Statement
Live retained-sandbox destroy checks the recorded OpenShell identity, then clears the agent's native home through the mutable sandbox name before its final identity check. If an independent OpenShell client replaces that name after the earlier check, the cleanup can clear the replacement's native state. A later identity mismatch prevents deletion but cannot undo the state loss.
This is a source-level interleaving identified in the PR Review Advisor run for docs PR #12735. It has not been reproduced against a live gateway. The current operating assumption on PR #12893 excludes independent same-name replacement during cleanup. That decision addressed the later check-to-delete race; it did not establish a durable-identity binding for the earlier native-state wipe.
Desired Behavior
Cleanup of a live retained sandbox must not clear native state or detach providers belonging to a different durable sandbox identity. When NemoClaw cannot bind a destructive step to the recorded identity or prove exclusive authority for the name, it stops before that step and preserves the recovery record. A stable matching sandbox remains eligible for cleanup when the required authority exists.
Evidence and Current Boundary
src/lib/actions/sandbox/destroy-execution.tschecks continuity after managed inference cleanup, then callswipeAgentNativeHome(sandboxName, ...)before the provider and final delete-boundary identity checks.src/lib/onboard/sandbox-provider-cleanup.tsdetaches providers by sandbox name. Its optional identity callback is not supplied by this destroy call.src/lib/actions/sandbox/destroy-retained-recovery-flow.test.tscovers identity drift at the delete boundary, but not replacement before native-home cleanup.- The recovery guide in PR #12735 warns operators that native state can be cleared before the final check. Documentation cannot bind the mutation to a durable identity.
Scope and Exclusions
This issue covers the retained, live-sandbox destroy path and its pre-delete destructive steps. It does not request a new integration or a general lifecycle redesign. The accepted check-to-delete risk on PR #12893 remains a separate decision. Implementation should first establish whether OpenShell offers an identity-bound mutation or an authoritative exclusion mechanism; another point-in-time identity read alone does not close the race.
Ownership and Placement
Core NemoClaw sandbox lifecycle maintainers. No implementation owner is assigned. The behavior belongs in the existing destroy and retained-recovery path, not in a community recipe.
Validation Plan
Add a deterministic destroy-flow test that changes the observed sandbox identity between the last pre-cleanup check and the native-home step. Assert that native-state wipe, provider detach, deletion, and registry clearing do not affect the replacement, and that the retained recovery record remains. Cover a matching stable identity and an inconclusive identity result. Use a live E2E only if an OpenShell boundary cannot be represented by the existing deterministic test harness.
Compatibility and Security Impact
Applies to supported agents and runtime providers that enter live retained-sandbox cleanup. No credential handling change is requested. The risk is unintended loss of sandbox native state under concurrent management of the same name; this issue does not claim an unprivileged exploit or include confidential details.
Activity
ksapru commentedon Oct 11, 2026
I looked at what OpenShell offers for this, before changing any code. Findings are from
mainhere and OpenShellv0.0.116(the version NemoClaw pins).Confirmed here:
wipeAgentNativeHomerunsopenshell sandbox exec --name <name>before the provider detach and the final identity check, so the wipe addresses the mutable name.What 0.0.116 offers:
ExecSandboxsandbox_id(durable ID)sandbox exec--nameonlyGetSandboxby name, thenExecSandboxwith the resolved ID, so there is a gap inside the CLIDeleteSandboxDetachSandboxProviderexpected_resource_versionI found no lock, lease, or exclusion mechanism for a sandbox name.
Possible direction: the wipe could go through the gateway's
ExecSandboxwith the recorded durable sandbox ID and fail closed if that ID is gone, instead of the CLI's name-based exec. NemoClaw already calls the gateway bysandboxIdelsewhere (for examplegetSandboxConfiginsandbox-config.ts), but its SDK exec helper insandbox-command-sdk.tscurrently takes a name. I have not yet confirmed whether the SDK exposes exec by ID or whether this would need the raw call.The provider detach and the final delete would still address the name. For those, the issue's fallback seems to be the only option on 0.0.116: stop before the step when identity cannot be bound, and keep the recovery record.
Does this match the maintainers' expectations? If so, I'm happy to take a stab at an ID-bound wipe plus the deterministic destroy-flow test described in the validation plan (identity changes between the last check and the wipe, matching stable identity, inconclusive result), starting from
main.