Repository navigation
fix(sandbox): stop destroyed sibling-root sandboxes from reappearing - #12520
laitingsheng wants to merge 14 commits into
Conversation
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Gate session recovery on live listings src/lib/registry-recovery-action.ts, src/lib/registry-recovery-action.test.ts, docs/reference/commands.mdx |
Recovery registers a confirmed onboarding-session sandbox only when it appears in the live gateway listing. Tests cover absent sandboxes and failed listing probes. The command reference documents the listing rule. |
Add destroy to the owning-root worker protocol src/lib/actions/sandbox/rebuild/owning-registry.ts, src/lib/actions/sandbox/rebuild/owning-registry-worker.ts, test/package-contract/rebuild-owning-registry-worker.test.ts |
The worker protocol accepts destroy requests with validated options and reports destroy exit statuses. The owning-registry code resolves and validates the owning gateway state directory. Tests cover invalid options, failures, and successful destruction. |
Delegate destruction and carry cleanup decisions src/lib/domain/lifecycle/options.ts, src/lib/domain/sandbox/destroy.ts, src/lib/domain/sandbox/destroy.test.ts, src/lib/actions/sandbox/destroy-preflight.ts, src/lib/actions/sandbox/destroy.ts, src/lib/actions/sandbox/destroy-cross-root.test.ts, src/lib/actions/sandbox/destroy-final-gateway-flow.test.ts, src/lib/state/gateway-registry.ts, src/lib/actions/sandbox/destroy-execution.ts, src/commands/sandbox/destroy.ts, src/commands/sandbox/oclif-command-adapters.test.ts, test/helpers/destroy-flow-test-harness.ts, test/e2e/live/concurrent-gateway-ports.test.ts, test/e2e/mock-parity.json, docs/reference/commands.mdx |
Destruction resolves confirmation before delegation and carries a final-gateway prompt answer to the owning root. If no remote owner handles the request, destruction runs in the selected root. Tests cover cancellation, exit statuses, host-fence refusal, cleanup decisions, and port-scoped listing. |
Filter shared fallback ports during teardown src/lib/actions/sandbox/forward-recovery.ts, src/lib/actions/sandbox/forward-recovery-declared-ports.test.ts |
Teardown omits a fallback port from release checks when another registered sandbox records that port. Tests cover shared and unshared fallback ports and recorded dashboard ports. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant DestroyCommand
participant DestroyPreflight
participant OwningRegistryWorker
participant SelectedRootDestroy
DestroyCommand->>DestroyPreflight: Resolve ownership and confirm options
DestroyPreflight->>OwningRegistryWorker: Send destroy request to owning root
OwningRegistryWorker->>SelectedRootDestroy: Execute destroy with validated options
SelectedRootDestroy-->>OwningRegistryWorker: Return result or exit status
OwningRegistryWorker-->>DestroyPreflight: Return worker result
Possibly related issues
- NVIDIA/NemoClaw#13817: The PR changes the final-gateway cleanup decision path, although the supplied context does not confirm resolution of the issue’s two-gateway case.
- NVIDIA/NemoClaw#7609: The PR prevents session-based recovery from registering a sandbox absent from the live gateway, but the issue does not identify whether its reported entry comes from this recovery path.
Possibly related PRs
- NVIDIA/NemoClaw#13012: Both changes scope sandbox destruction and gateway cleanup to the recorded gateway; this PR adds delegation across gateway roots.
Suggested reviewers: rsliter, cv
Merge Risk: 
Minimal · up to 94586
-
No actionable merge-blocking issue is established by the available evidence. The sibling-root migration path remains unverified.
Pre-merge checks: 
5
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
🌿 Preview your docs: https://nvidia-preview-pr-12520.docs.buildwithfern.com/nemoclaw |
Code coverage overviewLanguages: TypeScript TypeScript / code-coverage/plugin
View coverage of the 10 most impacted files.
TypeScript / code-coverage/cli
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Merge main to resolve the import conflict in the owning-registry worker contract test. When a cross-root destroy skips the final-gateway prompt because other sandboxes remain, hand the worker a declined answer. A race that removes those sandboxes before the worker's final check otherwise applies the unattended macOS default and removes the shared gateway without asking. Name the invoking CLI in the host-fence refusal, drop the rebuild-only wording from the native-Windows refusal that destroy now reaches, and state the full prompt and session conditions in the command reference. Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
## Outcome Fixes #12260. After a failed onboarding leaves identity-free retained recovery, `nemoclaw <name> destroy --yes` can release the name once the owning gateway and Docker confirm resource absence. The selected state root must match the failed attempt: ```bash NEMOCLAW_GATEWAY_PORT=19260 nemoclaw <sandbox-name> destroy --yes ``` The operation retires local metadata only. Ownership conflicts or uncertain absence keep recovery blocked. A retry remains reachable after the reservation was removed but recovery-file retirement failed. ## Reason When OpenShell cannot return a durable sandbox identity, failed onboarding can reserve the name even after the owning runtime confirms absence. Recovery needs a guarded metadata-only path and a reachable retry after a partial local write. ## Changes This PR covers selected-root recovery on native Linux with the default Docker daemon. It requires one null-fingerprint record, an owned default-Docker runtime marker older than that record, and a matching session when a reservation exists. The owning gateway and Docker must confirm no remaining sandbox, matching containers or managed volumes. Recorded sandbox-scoped providers or additional resource ownership in the reservation block recovery. The lifecycle owner holds the onboarding lock, rechecks authority, retires legacy Shields state before registry metadata, and retires the recovery record last. CLI admission does not authorize resource deletion. Automatic cross-root routing, stale-session resurrection through `list`, and sibling forward-port cleanup belong to [#12452](#12452) / [#12520](#12520). #12452 destroys an alternate-port sandbox without selecting its port; #12260 permits a documented recovery procedure. The base comparison at `5f765a1318` showed selected-root recovery failing before this PR and succeeding with it, while cross-root recovery remained unresolved on both versions. This PR imports no #12520 worker or routing changes and does not depend on that PR landing. Native NVIDIA CONNECT403/curl56 verification is separate: San's merged [#12826](#12826) closed [#12822](#12822). Native-inference changes, credential/model troubleshooting and GPU/CDI changes remain outside this PR. Advisor attempt 2 records three required live selectors (`managed-image-protected-runtime`, `full-e2e`, `staging-brev-launchable`) and optional `hermes-e2e`. Their stated reasons concern Hermes validation/topology and Launchable external-gateway registration changes inherited from main. The cited Hermes files, `src/lib/sandbox/mutable-config-perms*`, gateway-host-runtime code, Launchable documentation and full-E2E files are unchanged between PR base `4b1791cd18` and `ddab26b6f8`. They appear in the historical `be4a104e10..ddab26b` follow-up range because it includes the main merge. This is evidence for maintainer scope disposition, not a waiver or proof that those selectors ran. The existing lifecycle/rebuild validation floor remains separate. ## Test and documentation rationale San's normalized-default-endpoint correction remains: runner initialization can resolve `DOCKER_CONTEXT=default` to `DOCKER_HOST=unix:///var/run/docker.sock`. [CodeRabbit identified a different gap](#12839 (comment)): checking the current Docker selector alone can release recovery created under another daemon. This repair checks the existing owned gateway runtime marker before and after absence probes. Its recorded Docker host must be the native default, and its creation time must precede the recovery record. An alternate host, unknown time, or newer marker keeps recovery unresolved. A later gateway restart does not establish the earlier daemon's authority. The recovery schema remains unchanged. Existing records can recover when the corresponding default-runtime marker still qualifies. This is a marker and chronology check, not a newly persisted per-create daemon identity. - The recovery suite contains 27 cases, down from 33. Default and alternate-port tests through `destroySandbox` now also verify runner normalization and pinned Docker observations, replacing a separate helper-only success case. - Three repeated unknown-gateway inputs and one malformed-container input are removed from the recovery suite. Parsing remains covered in `sandbox-presence.test.ts`, `destroy-container-identity.test.ts` and the existing retained-destroy flow matrix. Recovery retains present/unknown gateway denial, failed/residual container denial, metadata preservation and the second absence probe. - Replacement-session preservation now runs inside the real recovery-file rename failure/retry test. The retirement path itself removes the reservation before retry; no separate test pre-removes that state. - The added mock-only runtime qualification test is removed from `destroy-gateway.test.ts`. Recovery now verifies missing-marker rejection despite a registered Docker fallback, and wrong-provider rejection, using real runtime markers and the production owner resolver. The alternate-current-daemon fixture starts with a valid default marker so an earlier owner refusal cannot hide a missing current-target guard. - Three daemon-history regressions remain: original alternate daemon, replacement gateway before recovery and replacement during absence probes. Locking, conflicting owners, residual volumes, record/registry replacement, Shields retirement and retry checks remain. All three CLI admission tests remain because command, name and registry-less admission are distinct boundaries. - This reduction adds no new test cases, public documentation or bulk docstrings. Seven redundant cases are removed across the two test files; the test diff loses 45 lines. The production helper separately loses eight lines of duplicate validation and nested control flow, while retaining the existing classifier's ownership checks. Coverage is chosen by distinct regression and boundary, not test count. A request for more tests should identify an uncovered behavior and why these existing assertions do not detect it. Equivalent tests at another layer add maintenance without additional evidence. This rationale does not waive a demonstrated defect, security gap or required live check. ## Verification Candidate commit: `207659658f3840348c7183f358051efe3f28775e`. Integrated main: `fcbbab088ad89dc78322b79d6b4e5ecceee8f1b0`. Parents: `ddab26b6f88aa7b0bcacaa56076c350cb68ad310` and that main revision. The merge resolves the existing command-reference conflict. It preserves main's live retained-cleanup warning and provider/identity-drift guidance alongside this PR's selected-root metadata recovery procedure. Main's gateway-binding cleanup is retained; the identity-free path still returns before runtime cleanup. No additional tests or recovery behavior were added for this merge. On the staged merged source, Linux x64 / Node 22.22.2 / Vitest 4.1.9: - `vitest run --project cli` for the five prior recovery/gateway/absence suites plus `src/lib/onboard/gateway/runtime-binding.test.ts`: 103 tests passed across six files. - `NODE_OPTIONS=--max-old-space-size=8192 npm run typecheck:cli`: passed. Targeted Oxlint, Oxfmt and whitespace checks passed. - `npm run docs` with the pinned Fern 5.92.4 already cached: passed, zero errors and two warnings. Fern skipped online missing-redirect checking without authentication; the existing light-theme contrast warning remains. The generated OpenClaw, Hermes and Deep Agents command pages match the independently reviewed resolution. Direct source markdownlint still reports the same ten unrelated findings on both parents; no rule was weakened. - The native `test/automation/pull-requests/growth-guardrails.test.ts` check passed all seven assertions against the integrated main revision. No full suite or live run was performed for this merge. The candidate-owned diff contains no secrets, API keys or credentials. CI, CodeRabbit and Advisor evaluation of the merge commit remain pending. ## Review notes The following evidence belongs to previous revisions; it does not establish CI or live verification of the merge commit. - On merged parent `df1efbe5` plus the local reduction, Linux x64 / Node 22.22.2 / Vitest 4.1.9: all 100 selected tests passed across recovery, gateway, container identity, OpenShell presence and retained-destroy flow. CLI typecheck with an 8 GiB heap, lint, formatting, whitespace and 12 path-selected repository checks passed. No live or full-suite run was performed. Normal publication hooks subsequently passed; that revision's CI is recorded below. - The previous published commit `ddab26b6f8` passed [source CI](https://github.com/NVIDIA/NemoClaw/actions/runs/37957382824), [Docker/Podman activation](https://github.com/NVIDIA/NemoClaw/actions/runs/37957382760) and [independent growth checks](https://github.com/NVIDIA/NemoClaw/actions/runs/37957882699). San's merged #12893 is inherited through main; it is separate from this PR's identity-free recovery change. - CodeRabbit reviewed `0556605..ddab26b` without new actionable comments and [explicitly accepted the marker/chronology fix and resolved its original finding](#12839 (comment)). Automatic reviews were paused at the last observed CodeRabbit run. [San's approval](#12839 (review)) belongs to `be4a104e10`. - [Advisor run 37959702844, attempt 2](https://github.com/NVIDIA/NemoClaw/actions/runs/37959702844/attempts/2) completed on `ddab26b6f8` / base `4b1791cd18`, using trusted workflow `8322eda4f4`. All nine findings ledgers are clear, and `Require no Advisor blockers` and the publisher passed. All nine summaries, findings ledgers and E2E recommendations were inspected. The earlier customer specialist's missing-output failure is resolved by this completed rerun. Additional selectors and their inherited-main attribution are recorded above; review completion does not establish live execution. The coordinator's `would-approve` result is read-only shadow output, not an approval submitted to GitHub. - The `3d4d6aeb8c` [CLI job failure](https://github.com/NVIDIA/NemoClaw/actions/runs/37939372851/job/113856848166) was HTTP 500 while uploading coverage, after all 12 shards and the coverage ratchet passed. No coverage threshold or upload-failure policy was weakened. Historical #12260 live evidence used Ubuntu 24.04.4 ARM64, Docker 29.8.2 and OpenShell 0.0.116. Reproduction used `88c4ae04`; unpatched `f633c995` refused recovery, while that revision plus patch archive `20db0d8f1bb9d961d94f9518a41dd7d29b214c0b09f7a2826787369495e1511a` cleared it after absence verification. An unreadable-gateway control preserved metadata; same-name onboarding and cleanup then succeeded. This predates later wiring and retry repairs. A dummy inference endpoint and disabled GPU do not establish native NVIDIA inference health. Advisor's four existing E2E selections (`onboard-repair`, `onboard-resume`, `rebuild-hermes`, `rebuild-openclaw`) remain separate execution requirements; the Advisor review is not evidence that they ran. No CI or live-evidence waiver is claimed. The repair also touches `src/lib/onboard/host-gateway-process.ts`; the existing onboarding container inspection and lifecycle contract remain in the PR. --- Signed-off-by: Hung Le <hple@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * `destroy` can now clear eligible retained recovery metadata for an unpublished sandbox on supported Linux setups, releasing its name without removing runtime resources. * Recovery is allowed only after ownership and sandbox absence are verified; if checks fail, the metadata remains unchanged. * If cleanup is interrupted by a metadata-write failure, retry the same command with the gateway port. * **Documentation** * Updated recovery guidance to explain the checks and retry behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Hung Le <hple@nvidia.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
<!-- markdownlint-disable MD041 --> ## Outcome On native Linux with default Docker, failed creates with no sandbox identity can release their local name reservation after confirmed absence, even after a gateway restart or onboarding for another sandbox. New records preserve the authority needed for `destroy --yes`; eligible legacy records with lost authority require explicit `destroy --force` to archive and discard local tracking. Forced discard does not establish original runtime cleanup. ## Reason The recovery path added in #12839 depended on the original session and a gateway marker predating the recovery record. Restarting the gateway or starting another session can remove that evidence while the retained name remains blocked. Shared inference providers alone do not cause this refusal. ### Related issues Fixes #13071. Follows #12839 and #12260. ## Changes - Capture the reservation owner, Docker daemon ID, and gateway state directory before create on a qualified native Linux default-Docker gateway. Preserve them through the failure writer and session reconstruction so recovery can qualify the original create after the session changes. - Store records containing this authority as schema 2 so older CLIs refuse them instead of dropping the evidence. Continue reading schema 1 and preserve authority during legacy port migration. - Use captured authority for metadata retirement while retaining absence checks, locking, revalidation, and reservation compare-and-swap. Explicit `--force` archives eligible local tracking before retirement. Conflicting same-name sessions and sandbox-scoped resource ownership still block retirement; shared providers remain unchanged. - Share the native authority observer through the existing gateway state-ownership module. Destroy imports that owner directly; the create boundary re-exports the same helper for its existing caller. The persisted parser and type remain with the state owner. This dependency cleanup preserves the observer's function body and adds no source file, package dependency, or budget exception. ## Verification - Selected live E2E: [run 38706144876](https://github.com/NVIDIA/NemoClaw/actions/runs/38706144876), attempt 2, passed on GitHub-hosted Ubuntu Linux x64 with Docker. Tested commit: `c15e9218bf7ea7b064b6be1755eb4a64bfc10f2e`; PR base and trusted `main` workflow revision: `80491e92e2cda863d6bf42869a8f8a5b0a975628`. Selectors: `onboard-repair,onboard-resume,rebuild-hermes,rebuild-openclaw`. All five executions ran one test and passed, with zero skipped tests, unhandled errors, or recorded cleanup failures. - Selected jobs: [OpenClaw repair](https://github.com/NVIDIA/NemoClaw/actions/runs/38706144876/job/116350872294), [OpenClaw resume](https://github.com/NVIDIA/NemoClaw/actions/runs/38706144876/job/116350872222), [Hermes resume](https://github.com/NVIDIA/NemoClaw/actions/runs/38706144876/job/116350872173), [OpenClaw rebuild](https://github.com/NVIDIA/NemoClaw/actions/runs/38706144876/job/116350872243), and [Hermes rebuild](https://github.com/NVIDIA/NemoClaw/actions/runs/38706144876/job/116350872184). OpenClaw rebuild also passed its Docker kill/Error-state recovery check with preserved workspace and native-root markers. - Evidence: [dispatch receipt `e2e-dispatch-38706144876-2`](https://github.com/NVIDIA/NemoClaw/actions/runs/38706144876/artifacts/11960959475), artifact `11960959475`, ZIP SHA-256 `3712b67cfa7e03d76c43051645ccf37bce11347d90b22f82f913075a953b6a9e`. Correlation: `84539ce4-bd3b-414e-b320-994937d0e79c`. [Aggregate result `review-queue-e2e-result-38706144876-2`](https://github.com/NVIDIA/NemoClaw/actions/runs/38706144876/artifacts/11963000897) reports `pass`. The receipt, aggregate, and all five execution manifests, test counts, phase results, and cleanup records were checked against the same source/workflow/run attempt; artifact digests were verified. Attempt 1 stopped before live execution because the candidate image producer was still running. Attempt 2 passed after candidate image publication completed, without a source change. This is focused E2E evidence, not full-suite or all-platform qualification. - Latest local validation: `c15e9218bf7ea7b064b6be1755eb4a64bfc10f2e`, Linux x86_64 / Node.js 22.22.2. The retained-recovery CLI test file and fresh-create integration file passed **65 tests with no skips** using `vitest run --project cli --project integration --maxWorkers 1` with those two file paths. CLI typecheck, scoped formatting/lint, and 13 selected repository checks passed. The committed diff and source hashes match the validated two-file change. Normal commit hooks passed, including growth and source-shape checks. No full local suite was run for this test-only reduction. Current-commit live E2E results are recorded above. - The producer-to-destroy integration case runs real create-authority capture, orchestration, registry, and retained-record persistence. A separate process reloads the record after a simulated gateway restart and session replacement, calls `destroySandbox`, and verifies selected metadata retirement, unrelated-state preservation, and no ordinary resource cleanup. External Docker/OpenShell observations are mocked. The latest commit removes one unit case already covered by that integration case and two lines comparing file bytes around a read-only load. It keeps the fresh-process record comparison, authority/nonce checks, unrelated-state assertions, and cleanup guards; it adds no test cases. - Earlier implementation evidence remains revision-bound: the candidate based on `abf42f10a54617128c1464d33592164356660e43` passed 253 focused CLI tests plus native CLI/plugin builds and type checks. Current focused local validation supplements those checks without rerunning the full local suite. - Live evidence: Linux x86_64, Docker 29.2.1, OpenShell 0.0.116, Ollama 0.32.9 / `qwen3.5:9b`, sandbox GPU disabled. A control using an earlier candidate before schema fencing onboarded without fault injection. Fault runs killed their dedicated gateway after a real Docker create. After native runtime removal, new-authority recovery passed `--yes`; a stock v0.0.133 schema-1 record refused `--yes` and passed explicit `--force`. Both names then onboarded with new identities. Presence and wrong-endpoint cases refused retirement; shared providers and unrelated state remained unchanged. Recovery records came from the real failure path. - Those live recovery consumers used v0.0.133 (`ef5d55d19e2da33c2474db158588613828e1a9be`) plus patch SHA-256 `7fb0da1fb249dbff9a2452c501f323f3619ccc7264acecb07c8efbc7336dae82`. The first observer relocation, before commit `a43a46a5b2b8e174c2a40f257a13ce498713c893`, passed build, focused tests, and a compiled read-only daemon probe. That probe does not qualify the current relocation. The current relocation has the local validation and selected live E2E above. The original identity-free create-failure timing was not rerun on this commit, and no new agent tool-call result is claimed. Original logs, manifests, snapshots, and the legacy archive remain available locally. ## Review notes Publication commit: `c15e9218bf7ea7b064b6be1755eb4a64bfc10f2e`; PR base: `80491e92e2cda863d6bf42869a8f8a5b0a975628`. [CI run 38703642625](https://github.com/NVIDIA/NemoClaw/actions/runs/38703642625) passed on publication commit `c15e9218bf7ea7b064b6be1755eb4a64bfc10f2e` against base `80491e92e2cda863d6bf42869a8f8a5b0a975628`. The earlier [CodeRabbit review](#13170 (comment)) reviewed `b5124a72d911ed3a49234cb900d63895ab302a17` against the recorded base and generated no actionable comments. Its 26.32% docstring-coverage result is a separate advisory warning; no docstrings were added solely to satisfy that metric. That CodeRabbit result predates the test reduction and does not establish the current automated-review disposition. [Advisor run 38689464981](https://github.com/NVIDIA/NemoClaw/actions/runs/38689464981) completed all nine specialists on `b5124a72` against the recorded base: eight clear, including Architecture and Verification, with one repeated archive-retention P1 (`F-operability-recovery-7cecf90ed7d07a2f09a5`). The gate failed on that finding; there was no missing specialist analysis. The test reduction does not resolve that gate. The archive writer is unchanged from the commit San reviewed. Resolution of the Advisor blocker gate remains a separate repository review-process requirement. [San's review](#13170 (comment)) found no confirmed code defect in `0c0bdb868bf002bbd475d4678107f9a424375bb6` against `e7840acd43451ae79191854aacafdf9e206983ed`. His macOS / Node.js 25.9.0 validation passed 98 focused tests and skipped 39 Linux-only recovery tests. His assessment remains bound to that revision and does not approve the publication commit. [San's follow-up on `b5124a72`](#13170 (comment)) requests latest-commit live E2E evidence and resolution of the separate Advisor blocker gate before approval. The selected E2E requirement is now supported on `c15e9218` by attempt 2 and the evidence linked above. San reiterates that the stated retention P1 is unsubstantiated and needs a separate policy; he does not request automatic archive pruning. His assessment remains recorded here. This E2E update does not claim that the Advisor gate is cleared or that maintainer approval has been granted. The author's retained-state choices remain: - Keep private archives after forced local discard while original-runtime cleanup is unverified. A retry reuses the same record's archive; distinct discarded records can accumulate. Automatic pruning needs a separate retention policy and removal conditions. - Keep the existing ownership checks without refusing solely because `credentialEnvironmentVariables` is nonempty. That list contains configured names/references; staged sandbox-provider receipts are recorded separately and block retirement. Forced discard archives the original record and reservation. This does not establish cleanup of every credential-bearing resource or of the original daemon. San's source assessment supports treating the archive-retention and credential-reference P1 claims as unsubstantiated as stated; it also confirms the earlier same-name-session guard and regression case. His comment contains the source references. These choices do not assert maintainer approval of the publication commit. Scope remains identity-free local recovery on native Linux default Docker. Cross-root work (#12520/#12452), inference failures addressed by #12826, runtime deletion without an identity, and support for other runtime providers remain outside this PR. Forced local discard cannot reconstruct lost historical ownership or prove absence from the original daemon. --- Signed-off-by: Hung Le <hple@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved recovery for Linux systems using default Docker when a sandbox identity is unavailable. Recovery verifies that the gateway and Docker confirm the sandbox is absent and that ownership evidence meets the applicable checks before removing local tracking. * The `--force` option can archive and remove eligible local recovery records after absence checks. It preserves runtime resources and shared providers; cleanup on the original runtime remains unverified. * Recovery remains blocked when conflicting active sessions, sandbox-scoped providers, or other resource ownership are detected. * **Documentation** * Clarified recovery requirements, limits, and archive retention behavior for `destroy` and `--force`. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Hung Le <hple@nvidia.com>
…irectory Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
|
@coderabbitai Seeded live-gateway recovery in |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
fd '^(registry-recovery-action|registry-recovery-action\.test|registry-recovery-seeded-paths\.test)\.ts$'
ast-grep outline src/lib/registry-recovery-action.ts
ast-grep outline src/lib/registry-recovery-action.test.ts
ast-grep outline src/lib/registry-recovery-seeded-paths.test.ts
ast-grep outline src/lib/inventory/index.ts
sed -n '100,155p' src/lib/registry-recovery-action.test.ts
sed -n '410,485p' src/lib/inventory/index.ts
sed -n '1050,1100p' docs/reference/commands.mdx
rg -n -C4 'recoverRegistryFromLiveGateway|upsertRecoveredSandbox|readOnly|sandboxName|seed' src/lib/registry-recovery-action.ts
rg -n -C4 'onboard|session|clear.*[Ss]andbox' src/lib/actions/sandbox/destroy.tsLength of output: 42025 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '301,393p' src/lib/registry-recovery-action.ts
sed -n '403,500p' src/lib/registry-recovery-action.ts
sed -n '90,240p' src/lib/registry-recovery-seeded-paths.test.ts
sed -n '145,195p' src/lib/registry-recovery-action.test.ts
rg -n -C4 'confirmed|session-recorded|display-only|live gateway lists|owning.*root|onboarding session' docs/reference/commands.mdx
ast-grep outline src/lib/actions/sandbox/rebuild/owning-registry-worker.ts
rg -n -C4 'destroySandboxInSelectedRoot|operation === "destroy"' src/lib/actions/sandbox/rebuild/owning-registry-worker.ts
sed -n '1449,1480p' src/lib/actions/sandbox/destroy.tsLength of output: 91298
Seeded recovery intentionally persists live sandboxes. The owning-root worker runs the session cleanup in that root. With the matching session name cleared and the sandbox absent from the live gateway, the described post-destroy My concern conflated intentional seeded recovery with post-destroy recovery. I withdraw it. ✏️ Learnings added
You are interacting with an AI system. |
…egation Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Preserve the reviewed stale-session destroy fix while integrating the latest main. Signed-off-by: Rebecca Sliter <rsliter@nvidia.com>
The existing destroy-cross-root test owns the changed concurrent-gateway live phase and satisfies its mock parity rule. Signed-off-by: Rebecca Sliter <rsliter@nvidia.com>
Observe the live gateway absence condition before checking that the owning-root list does not resurrect the destroyed sandbox. Signed-off-by: Rebecca Sliter <rsliter@nvidia.com>
|
@coderabbitai review |
✅ Action performed
|
Delegate the owning-root destroy before acquiring the caller host fence, preserving the existing authority and migration checks. Cover the real CLI cross-root path and an unrelated fence owner. Refs #12452 Signed-off-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com>
|
@coderabbitai review |
✅ Action performed
|
|
PR Review Advisor finished for commit Request review only when Require no Advisor blockers is green. |
|
WIP on exact PR head The prior-head run 40592386040 passed this same phase: after A's stop/start, the dashboard returned curl exit 52 three times and then HTTP 200 at about 15 seconds. Its later sibling-root destroy failed for the host-fence reason addressed by the current commit. Both phase-6 B destroy outputs are materially identical. Source trace shows the new early hook executes on same-root B destroy but returns before worker, prompt, or mutation, then the ordinary selected-root destroy runs. The retained evidence does not prove why the new run's OpenShell forward did not return, so this E2E failure is unresolved. We are not rerunning an unchanged live workflow without an applicable narrow retry basis. No approval or merge while the exact-head selected E2E is failed. |
Authoring session — opening
|
|
The maintainer hold remains in effect for I checked current main PR #13997 is still open and adds diagnostic evidence for the forward-restart failure. Its description explicitly preserves the assertions and retry decisions and claims no runtime fix or historical root cause, so it does not resolve this hold. Candidate run 40601487202 remains failed; the retained main-base evidence from 40578766066 also failed the restart dashboard boundary. The stale-session cleanup fix remains valid in scope. Blanket read-only behavior for |
|
Hi @laitingsheng, thanks for your work on cleaning up destroyed sibling sandboxes. The underlying issue #12452 is closed as not planned. We’re planning an updated architecture for NemoClaw, so I’m closing this PR as well. If this is still an issue that needs prioritization in our v1 release, please re-open and tag @wscurran. |
Outcome
Destroying a sandbox that another gateway port's state root owns now also clears the onboarding session in that state root, so
nemoclaw listno longer adds the sandbox back as a partial registry row.Registry recovery no longer registers a sandbox from the onboarding session alone.
A registry row that records no dashboard port can now be destroyed even when another sandbox owns the fallback port.
Reason
destroyresolved the owning registry across gateway state roots, but it read and cleared the onboarding session, retained recovery records, and Model Router state through paths that the caller'sNEMOCLAW_GATEWAY_PORTselects.A destroy that ran without that variable removed the registry row from the owning state root and left the completed session in that root.
The next
nemoclaw listfor that port registered the session's sandbox without asking the live gateway, so the new row had no ports, agent, image tag, or driver, and it became the default.Destroying that row resolved the host-wide fallback dashboard port, which another sandbox's forward held, so release verification failed and the suggested retry failed the same way.
Related issues
Refs #12452
This PR fixes stale-session resurrection and the sibling dashboard-port conflict. Generic read-only behavior for
nemoclaw listremains a separate decision on #12452; seeded recovery from a live gateway stays supported.Changes
destroySandboxhands a sandbox registered under another gateway port's state root to the existing owning-registry worker, started with that port'sNEMOCLAW_GATEWAY_PORT. The worker runs the existing destroy path, so the registry row, onboarding session, retained recovery records, and Model Router state are all read and cleared in the owning state root.nemoclaw <name> destroymust mutate the state of the root that owns the sandbox.cleanupGatewayPromptAnsweroption, which applies like an accepted or declined prompt rather than like--cleanup-gateway. When another published sandbox or pending route reservation owns that gateway, the caller sends a declined answer, so the worker keeps the shared gateway even if that sandbox is removed before the worker finishes. Selected-root final-gateway cleanup checks published and pending owners of the target gateway across registry roots (while preserving cross-rootlistSandboxesfor host-wide shared resources), so an accepted prompt or--cleanup-gatewayfor the last owner of its target gateway removes that gateway even when another gateway root has a sandbox.destroyoperation with strict boolean option parsing and anexitCoderesult field, so the caller exits with the status that destroy requested.destroySandboxInSelectedRootrecords the terminal destroy completion in the owning root (including its gateway name andmutationStartedstate), while the caller records pre-worker cancellations and failures and flushes the telemetry operation before exiting on a delegated exit code, so each destroy emits one terminal record. The worker receives the destroy settings and standard allowlisted subprocess environment, which can include OpenShell authentication variables, but adds no provider API credentials, and bindsNEMOCLAW_OPENSHELL_GATEWAY_STATE_DIRto the owning sandbox entry'sopenshellGatewayStateDirafter verifying its managed gateway state-root marker, ownership, permissions, and gateway identity (or omits the caller's override when the owning entry has none).destroy.tspasses to the owning-registry module because importing the branding module there would exceed that module's source-architecture fan-in budget. The native-Windows refusal no longer names rebuild, because destroy also reaches it.destroy-preflight.ts, which keepsdestroy.tsandstate-root.tswithin their source-architecture budgets.src/lib/actions/sandbox/destroy-cross-root.test.tscovers the hand-off, the final-gateway prompt and owning-gateway cleanup when the target is the last published sandbox in its owning root while another gateway root has a sandbox (keeping host-wide services running for the other root), the declined answer when another sandbox remains in the owning root, cancellation telemetry, exit status, single partial-state telemetry recording when a delegated worker fails after mutation, the host-fence refusal with the invoking CLI name, the owning entry's verifiedopenshellGatewayStateDirbinding, and rejection of an untrusted recordedopenshellGatewayStateDir(missing, gateway-mismatched, or non-private managed-root marker) before prompting or starting the worker.test/package-contract/rebuild-owning-registry-worker.test.tscovers descriptor validation and the native-Windows refusal, and proves, against the compiled worker, both a failing delegated destroy with retained recovery records (exit status 1) and a successful delegated destroy that removes the sibling-root registry row, clears the matching onboarding sessionsandboxName, and replaces the caller'sNEMOCLAW_OPENSHELL_GATEWAY_STATE_DIRoverride.concurrent-gateway-portstarget now invokes retained-gateway destroy from the sibling root, then checks thatnemoclaw listfor the owning root does not resurrect the deleted sandbox while the survivor remains healthy.listand sandbox-scoped recovery register the session's sandbox only when the live gateway lists it, andrecoveredFromSessionreports that such a live sandbox was registered.docs/reference/commands.mdxdescribes the session rule forlistand sandbox-scoped recovery. Fordestroy, it describes the owning-root worker, its verifiedopenshellGatewayStateDirbinding and failure behavior, when each prompt appears, which settings replace or skip it, and when the worker clears the onboarding session.Verification
3cda55fwith maind713749— reviewed final diff is 20 scoped paths, including the live/fast parity manifest; final tested commit and tree are recorded in PR evidencenpm run build:cli— passedNODE_OPTIONS="--max-old-space-size=8192" npm run typecheck:cli— passednpx oxfmt --check src/lib/actions/sandbox/destroy.ts src/lib/actions/sandbox/destroy-preflight.ts src/lib/actions/sandbox/destroy-cross-root.test.ts— passednpx oxlint --deny-warnings src/lib/actions/sandbox/destroy.ts src/lib/actions/sandbox/destroy-preflight.ts src/lib/actions/sandbox/destroy-cross-root.test.ts— passed with 0 warnings and 0 errorsnpm run checks:repository— 18 selected checks passed, includingsource-architectureandtest-title-stylenpx vitest run --project cli src/lib/actions/sandbox/destroy-cross-root.test.ts src/lib/actions/sandbox/destroy-final-gateway-flow.test.ts src/lib/actions/sandbox/forward-recovery-declared-ports.test.ts src/lib/domain/sandbox/destroy.test.ts src/lib/registry-recovery-action.test.ts— 5 files, 78 passednpx vitest run --project package-contract test/package-contract/rebuild-owning-registry-worker.test.ts— 1 file, 11 passed, 2 skippednpx vitest run --project integration test/automation/pull-requests/growth-guardrails.test.ts— 1 file, 7 passed./node_modules/.bin/tsx scripts/checks/e2e-mock-parity.mts --base d7137496475dd9353053001cf58f09eddfdd7e05 --head cc482ca3c4eb638b8fcf09282a2871524053329f— passed against the staged final tree;test/automation/e2e/e2e-mock-parity.test.ts— 55 passednpm run e2e:assertions:check— passed, 1271 direct assertions across 77 files; no growthnpx vitest run --project e2e-support test/e2e/support/runtime-matrix.test.ts test/e2e/support/workflow-plan.test.ts— 2 files, 147 passednpx vitest run --project cli src/lib/registry-recovery-seeded-paths.test.ts src/lib/actions/sandbox/destroy-flow.test.ts src/lib/actions/sandbox/destroy-retained-recovery-flow.test.ts— 3 files, 109 passednpm run docs— passed (check-docs-published-routesOK;fern check0 errors, 2 baseline warnings)agent_id=ab80a6eeon staged tree onead42a5691a9bff30b781dc29128fa261f141118, base9347d8928be41deaa78febfe34dc357839251e6b,AGENTS.mdblobddd7894d0490398a821a49da287a27d00e535294) —Verdict: PASS,Result: docs-updated, 0 blocking findingsReview notes
ead42a5691a9bff30b781dc29128fa261f141118(base9347d8928be41deaa78febfe34dc357839251e6b,AGENTS.mdblobddd7894d0490398a821a49da287a27d00e535294) returnedVerdict: PASSwithResult: docs-updatedand 0 blocking findings.listshows its existing last-onboarded-sandbox hint, and a sandbox-scoped command reports that the sandbox does not exist.nemoclaw.src/lib/actions/sandbox/destroy-shared-proxy.test.tswith a 5-second timeout, that timeout also occurs without this change: it reproduced on a cold local run ofmaincommit41b9d9fa90.Signed-off-by: Tinson Lai tinsonl@nvidia.com
Summary by CodeRabbit
Bug Fixes
Documentation