You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(uninstall): preserve user data by default (#4229)
## Summary
`nemoclaw uninstall` used to `rm -rf ~/.nemoclaw/`, deleting every
host-side snapshot and workspace backup. Switch to a selective wipe that
keeps `rebuild-backups/`, `backups/`, and `sandboxes.json` by default.
Full purge still available via interactive `y` prompt or
`NEMOCLAW_UNINSTALL_DESTROY_USER_DATA=1`.
## Related Issue
Fixes#4226.
## Changes
- `src/lib/actions/uninstall/run-plan.ts`: new
`PRESERVED_USER_DATA_ENTRIES`, `removePathExcept` (selective wipe with
lstat guard against symlinked state dirs), and `resolvePreserveSet` (env
var + interactive `y/N` prompt).
- `src/lib/actions/uninstall/run-plan.test.ts`: new tests covering
preserve-by-default, env-var purge, interactive `y`/`N`,
`NEMOCLAW_NON_INTERACTIVE=1` on a TTY, symlinked state dir,
no-preservable-on-disk skip, and non-ENOENT lstat failure exiting
non-zero.
- `docs/reference/commands.mdx`: new "User-data preservation under
`~/.nemoclaw/`" subsection with the decision matrix.
- `docs/manage-sandboxes/lifecycle.mdx`: `<Note>` summary above the
uninstall flags table.
## Type of Change
- [ ] Code change (feature, bug fix, or refactor)
- [X] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)
## Verification
- [X] `npx prek run --all-files` passes
- [X] `npm test` passes
- [X] Tests added or updated for new or changed behavior
- [X] No secrets, API keys, or credentials committed
- [X] Docs updated for user-facing behavior changes
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] 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: Tinson Lai <tinsonl@nvidia.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Uninstall now preserves user data in ~/.nemoclaw by default
(rebuild-backups/, backups/, sandboxes.json); other entries are removed.
* **Behavior**
* Interactive runs prompt before also removing preserved items (default:
keep). Non-interactive/--yes preserves by default unless
NEMOCLAW_UNINSTALL_DESTROY_USER_DATA=1 forces full purge. Symlinks to
the state path are not followed.
* **Tests**
* Expanded uninstall tests covering preservation, destructive purge,
interactive/non-interactive prompts, symlink handling, and error paths.
* **Documentation**
* Added notes describing preserved items and prompt/flag behavior.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/4229?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
|`--delete-models`| Also remove NemoClaw-pulled Ollama models. |
259
259
260
+
<Note>
261
+
`nemoclaw uninstall` preserves `~/.nemoclaw/rebuild-backups/` (host-side snapshots that `nemoclaw <name> snapshot create` and `nemoclaw backup-all` write), `~/.nemoclaw/backups/` (workspace backups that `scripts/backup-workspace.sh` writes), and `~/.nemoclaw/sandboxes.json` (the sandbox registry) by default.
262
+
Uninstall removes every other entry under `~/.nemoclaw/`.
263
+
Interactive runs prompt before they remove the preserved entries; the default answer keeps them.
264
+
For non-interactive runs (`--yes`, `NEMOCLAW_NON_INTERACTIVE=1`, or a non-TTY shell), set `NEMOCLAW_UNINSTALL_DESTROY_USER_DATA=1` to acknowledge data loss and remove the preserved entries as well.
265
+
See [`nemoclaw uninstall`](/reference/commands#nemoclaw-uninstall) for the full preservation contract.
266
+
</Note>
267
+
260
268
`nemoclaw uninstall` runs the version-pinned `uninstall.sh` that shipped with your installed CLI, so it does not fetch anything over the network at uninstall time.
261
269
262
270
If the `nemoclaw` CLI is missing or broken, fall back to the hosted script:
To avoid uninstall destroying host-side user data, uninstall preserves the following entries under `~/.nemoclaw/` by default:
1250
+
1251
+
| Entry | What it holds |
1252
+
|---|---|
1253
+
|`rebuild-backups/`| Host-side snapshots that `nemoclaw <name> snapshot create` and `nemoclaw backup-all` write. `nemoclaw <name> snapshot restore` reads them back after you reinstall. |
1254
+
|`backups/`| Host-side workspace backups that `scripts/backup-workspace.sh` writes (see [Backup and Restore](/manage-sandboxes/backup-restore)). |
1255
+
|`sandboxes.json`| Host-side sandbox registry. NemoClaw uses it to map sandbox names back to their persistence directories when you reinstall. |
1256
+
1257
+
Uninstall removes every other entry under `~/.nemoclaw/` (gateway source, runtime state, the Ollama auth proxy PID file, etc.).
0 commit comments