fix(uninstall): ignore OpenShell-orphaned siblings in cleanup scoping#7351
Conversation
Signed-off-by: Rui Luo <ruluo@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:
📝 WalkthroughWalkthroughUninstall sibling detection now compares registry and per-port gateway entries with cached OpenShell gateway names. Confirmed orphans allow shared cleanup, while live or uncertain siblings preserve scoped cleanup. Preparation rechecks for siblings before teardown. ChangesUninstall sibling gateway detection
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant UninstallPlanner
participant OpenShellCLI
participant GatewayState
UninstallPlanner->>OpenShellCLI: Query gateway list
OpenShellCLI-->>UninstallPlanner: Live gateway names or unknown
UninstallPlanner->>GatewayState: Inspect registry and per-port directories
GatewayState-->>UninstallPlanner: Live, orphaned, or uncertain sibling status
UninstallPlanner->>OpenShellCLI: Recheck and select gateway for scoped teardown
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in commit c4edc0e in the TypeScript / code-coverage/cliThe overall coverage in commit c4edc0e in the Show a code coverage summary of the most impacted files.
Updated |
PR Review Advisor — InformationalAdvisor assessment: Informational / high confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: None 1 optional E2E recommendation
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/lib/actions/uninstall/run-plan.ts (1)
1106-1135: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffConsider isolating the OpenShell process call in an adapter.
As per path instructions (src/lib/README.md), "
Isolate host-boundary calls (e.g., OpenShell gateway listing, filesystem scanning) in src/lib/adapters/** so actions/domain remain testable."collectLiveOpenShellGatewayNamesis exactly this named example but lives directly in the actions file. This mirrors existingruntime.run("openshell", ...)calls already in this file, so it's consistent with current (non-adapter) convention rather than a net-new regression; still flagging per path instructions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/actions/uninstall/run-plan.ts` around lines 1106 - 1135, Move the host-boundary logic from collectLiveOpenShellGatewayNames into an appropriate adapter under src/lib/adapters, including the openshell command invocation and JSON parsing. Update the action to call the adapter while preserving the existing Set<string> | null conservative behavior and runtime environment handling.Source: Path instructions
src/lib/actions/uninstall/run-plan-gateway-segregation.test.ts (1)
594-789: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract shared test setup to cut duplication.
The four new tests repeat the same tmpdir-create/
sandboxes.json-write/mock-run/cleanup boilerplate almost verbatim, differing only in fixture content and expected OpenShell calls. A small helper (e.g.runUninstallWithFixture({ gatewaysDirPorts, sandboxes, liveGatewayNames })) would cut ~150 lines and make future orphan/sibling scenarios cheaper to add.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/actions/uninstall/run-plan-gateway-segregation.test.ts` around lines 594 - 789, Extract the repeated temporary-home setup, fixture writing, uninstall invocation, OpenShell mocking, and cleanup from the four tests into a shared helper near these tests, such as runUninstallWithFixture. Parameterize gateway directory ports, sandbox registry data, and live gateway names, while returning the uninstall result, logs, calls, and temporary state path needed by assertions. Update each test to use the helper and preserve its existing scenario-specific expectations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/lib/actions/uninstall/run-plan-gateway-segregation.test.ts`:
- Around line 594-789: Extract the repeated temporary-home setup, fixture
writing, uninstall invocation, OpenShell mocking, and cleanup from the four
tests into a shared helper near these tests, such as runUninstallWithFixture.
Parameterize gateway directory ports, sandbox registry data, and live gateway
names, while returning the uninstall result, logs, calls, and temporary state
path needed by assertions. Update each test to use the helper and preserve its
existing scenario-specific expectations.
In `@src/lib/actions/uninstall/run-plan.ts`:
- Around line 1106-1135: Move the host-boundary logic from
collectLiveOpenShellGatewayNames into an appropriate adapter under
src/lib/adapters, including the openshell command invocation and JSON parsing.
Update the action to call the adapter while preserving the existing Set<string>
| null conservative behavior and runtime environment handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 076f53a7-5ae2-4880-a3da-d1168dedbed9
📒 Files selected for processing (2)
src/lib/actions/uninstall/run-plan-gateway-segregation.test.tssrc/lib/actions/uninstall/run-plan.ts
Signed-off-by: Rui Luo <ruluo@nvidia.com>
cjagwani
left a comment
There was a problem hiding this comment.
The new liveness probe needs to fail closed on partially malformed JSON. collectLiveOpenShellGatewayNames() accepts any array and silently skips entries whose name is missing or non-string, so [{}] or a mixed valid/malformed response becomes an empty or incomplete trusted set. Both downstream callers interpret absence from that set as proof that sibling state is orphaned, which can select the non-scoped uninstall path and remove host-shared resources even though the response did not prove the sibling absent.
Please return null when any gateway-list entry lacks a valid non-empty string name, and add a regression test with a malformed or mixed array proving that uninstall conservatively preserves sibling/shared state. This matches the function contract that unparseable output must not authorize cleanup.
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Signed-off-by: Rui Luo <ruluo@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
|
🌿 Preview your docs: https://nvidia-preview-pr-7351.docs.buildwithfern.com/nemoclaw |
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Dismissed as stale after the requested fail-closed fix landed. Current head b752fe1 rejects every null, non-object, missing, non-string, or empty gateway name and returns unknown liveness; the mixed valid/malformed regression proves shared resources stay scoped. This dismissal removes the superseded changes-requested state and is not an approval.
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
There was a problem hiding this comment.
Approved PR #7351 at head 4eed094 against base 2e743da. I reviewed the Files changed diff, including the fail-closed behavior when OpenShell is unavailable, and approve the product scope. Merge remains conditional on fresh required CI, exact-pair E2E gates, Verified commits, and no actionable automated-review findings.
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
senthilr-nv
left a comment
There was a problem hiding this comment.
Approved PR #7351 at head 955fd5f against base d399e58. I reviewed the Files changed diff, including the fail-closed unavailable-OpenShell behavior, deterministic PTY fixture, and redundant gateway-guard cleanup, and approve the product scope. Merge remains conditional on fresh required CI, exact-pair E2E gates, Verified commits, and no actionable automated-review findings.
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
<!-- markdownlint-disable MD041 --> ## Summary Adds the canonical pre-tag `## v0.0.95` release entry to `docs/changelog/2026-07-24.mdx`, before the existing v0.0.94 entry. The entry summarizes approved user-visible changes merged since v0.0.94 and excludes internal-only prerequisites. ## Changes - Adds the v0.0.95 summary and detailed bullets for gateway lifecycle, recovery, state transfer, inference compatibility, sandbox security, Discord policy, and E2E evidence. - Links each user-facing theme to the most specific published documentation. - Records the release entry in the shared native changelog used by the OpenClaw, Hermes, and Deep Agents guides. Source summary: - [#7246](#7246), [#7228](#7228), [#7267](#7267), [#7489](#7489), [#7509](#7509), [#7351](#7351), and [#7290](#7290) -> `docs/changelog/2026-07-24.mdx`: Gateway authority, forward teardown and retry, managed recovery, Hermes restart recovery, scoped uninstall, and orphan-aware backup behavior. - [#7344](#7344) and [#7416](#7416) -> `docs/changelog/2026-07-24.mdx`: Atomic SQLite restore and host download verification. - [#7476](#7476), [#7347](#7347), [#7281](#7281), [#7485](#7485), [#7491](#7491), and [#7422](#7422) -> `docs/changelog/2026-07-24.mdx`: Windows Ollama reuse, CDI fallback, bounded OpenRouter connection setup, Nemotron-3 request compatibility, and managed Deep Agents retry and provider-error behavior. - [#6884](#6884), [#7481](#7481), [#6878](#6878), [#7467](#7467), [#7502](#7502), [#7503](#7503), [#7504](#7504), and [#7486](#7486) -> `docs/changelog/2026-07-24.mdx`: Trusted base-image overrides, local rebuild images, runtime validation, config preservation, reviewed package updates, and fewer final-image payload layers. - [#7303](#7303) -> `docs/changelog/2026-07-24.mdx`: Scoped Discord application-command management. - [#7488](#7488), [#7465](#7465), [#7497](#7497), [#7464](#7464), [#7501](#7501), [#7494](#7494), and [#7493](#7493) -> `docs/changelog/2026-07-24.mdx`: Selected-test risk signals, retry cleanup, full root-image validation, direct-main Hermes setup, executed PR-gate evidence, nightly history, and runner wait reporting. - [#7447](#7447) is an internal pinned-runtime prerequisite and is intentionally excluded from canonical supported-integration documentation. - [#7370](#7370) adds maintainer-only advisory reconciliation tooling and does not change supported user behavior. - [#7495](#7495) updates existing documentation and does not add a new v0.0.95 behavior claim. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [x] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [ ] Tests added or updated for changed behavior - [x] Existing tests cover changed behavior — justification: `test/changelog-docs.test.ts` validates the dated changelog structure, heading uniqueness, and published links. - [ ] Tests not applicable — justification: - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [ ] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [ ] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: `docs/changelog/2026-07-24.mdx`; writing rules, documentation style, factual release meaning, and published links reviewed at exact head `58b02f2bf`. - Agent: Codex documentation writer reviewer <!-- docs-review-head-sha: 58b02f2 --> <!-- docs-review-agents-blob-sha: 9c9b36d --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: `npx vitest run test/changelog-docs.test.ts` passed 6 tests. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) — the build passed with 0 errors and 2 Fern warnings. - [x] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added a new v0.0.95 changelog entry above v0.0.94. * Documented improved externally supervised gateway lifecycle ownership. * Improved snapshot restore reliability and SQLite state handling. * Tightened CLI `backup-all` behavior and host artifact verification. * Updated Windows onboarding guidance (including Ollama service reuse and CDI directory fallback). * Noted inference compatibility fixes, deeper agent failure classification, stricter base-image validation, updated Discord bot command permissions, and refined E2E release automation evidence handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Summary
nemoclaw uninstallpreviously treated stale sibling gateway directories and registry rows as live siblings. It now reconciles those records with OpenShell's live gateway registry, removes host-shared resources when only orphaned state remains, and preserves those resources when a live sibling exists or liveness cannot be proved.Related Issue
Fixes #7315
Product Scope
PASS — this fixes the existing supported
nemoclaw uninstallcontract described by #7315 and the current uninstall documentation. It adds no integration, recipe, custom image, third-party stack, configuration, API, or supported product surface. This verdict is independent of GitHub'smergeStateStatus.Changes
openshell gateway list -o jsononce per sibling inspection and use its names to distinguish live gateways from orphaned per-port directories and shared registry rows.run-plan-gateway-segregation.test.ts.Type of Change
Quality Gates
c4edc0e13against base SHAcd87ccc56across all nine security categories. All categories passed with no findings. This is agent evidence, not human review or approval.Documentation Writer Review
docs-updateddocs/manage-sandboxes/uninstall-nemoclaw.mdxanddocs/reference/commands.mdxfor fail-closed shared-resource and provider cleanup, including the unavailable-OpenShell nonzero retry path. The documentation writer verified completed headc4edc0e13against basecd87ccc56, including the deterministic PTY-driver correction, signed main refreshes, behavior-neutral redundant-guard cleanup, and test-size budget restoration, with no findings.npm run docspassed with 0 errors and 2 existing warnings.DGX Station Hardware Evidence
Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablenpx vitest run --project cli src/lib/actions/uninstall/*.test.tspassed 91 tests in 7 files;npx vitest run --project integration test/uninstall.test.tspassed 6 tests;npx vitest run --project integration test/sandbox-provisioning.test.tspassed 62 tests; andnpm run test-size:checkpassed across 1,788 files. The PTY driver completed its typed-yes full-cleanup path with exit 0; its Linux-only Vitest wrapper is skipped locally on macOS and will run in CI. The canonical-base diff-aware pre-push hook passed CLI type-checking.npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result: Not applicable; the change is limited to uninstall sibling detection and its focused tests.npm run docsbuilds without warnings (doc changes only)Signed-off-by: Rui Luo ruluo@nvidia.com