Skip to content

Windows nodespace uninstall leaves the daemon and HKCU Run autorun entry, then prints success #4050

Closed

Description

@mstomar125

Severity: P2

Where

packages/cli/src/commands/uninstall.rs:196-197: #[cfg(not(any(target_os = "macos", target_os = "linux")))] fn stop_daemon() {}; also remove_bin_dir (:199-201, let _ = fs::remove_dir_all(...)) and the unconditional success print at :75-78 (println!("NodeSpace uninstalled. ...")).

What goes wrong

The command is registered on every platform (packages/cli/src/lib.rs:207-208, :871) and its help says "stop daemon, remove binaries and service registration". On Windows stop_daemon does nothing, so the running nodespaced keeps running and the NodeSpaceDaemon value under HKCU\Software\Microsoft\Windows\CurrentVersion\Run stays, so the daemon starts again at next login. remove_bin_dir discards the remove_dir_all error, which on Windows fails while nodespaced.exe (or the running nodespace.exe) is open, and the command still prints "NodeSpace uninstalled." This contradicts packages/skill/references/cli.md:1022.

Evidence

  • Verified on current main: stop_daemon is still the empty Windows stub; remove_bin_dir and remove_sock still ignore errors; the success line is unconditional.
  • The app registers the autorun in packages/desktop-app/app-lib/src/daemon_setup.rs (register_autorun_windows, value WINDOWS_AUTORUN_VALUE = "NodeSpaceDaemon", ~:2621, :3046). The only remover, remove_autorun_windows (:3121), is pub(crate) in app-lib and reachable only from the Settings UI; the CLI never calls it.
  • The CLI has Named Pipe transport (packages/cli/src/lib.rs:291-333), so it can reach the daemon on Windows.
  • Related, closed: Show an uninstall path for the Windows daemon autorun entry #1519 added the in-app removal only. No open issue covers the CLI path.

Suggested fix

Make the Windows path of uninstall do what the other platforms do, and never print success on failure:

  1. Implement a Windows stop_daemon: ask the daemon to shut down over its pipe (or, failing that, terminate the nodespaced.exe process by image path under the state bin dir), then wait for the pipe to disappear.
  2. Remove the autorun value: reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v NodeSpaceDaemon /f (check presence first so "not present" is not an error). Move the small registry helper somewhere the CLI can use (the CLI cannot depend on app-lib), or duplicate the few lines.
  3. Stop swallowing remove_dir_all errors: return them (or collect them), print which paths could not be removed and why, and exit non-zero without printing "NodeSpace uninstalled." If the running nodespace.exe sits in the directory being deleted, remove everything else and report that file as the one the user must delete after the command exits.
  4. Add tests for the error-reporting branch (a bin dir that cannot be removed yields Err and no success line).

Found by

Found by an automated whole-codebase review on 2026-10-26; confirmed by independent verification against main on 2026-10-29.

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Oct 29, 2026
  2. mstomar125 commented on Nov 2, 2026

    @mstomar125
    ContributorAuthor

    Picking this up (sweep drain).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions