Skip to content

Keep the daemon running after the app window closes; only the tray Quit stops it #3822

Closed

Description

@malibio

Problem

Quitting the NodeSpace window stops the daemon. app-lib/src/lib.rs (the shutdown function near the ExitRequested/Exit handling) deliberately stops the daemon on any exit that reaches it (Cmd+Q, the red traffic-light button, any other path), "instead of leaving it, and its tray icon, running invisibly". The daemon exits 0 and the launchd plist's KeepAlive: {SuccessfulExit: false} (daemon_setup.rs, the plist writer) does not restart a clean exit.

The daemon is what every client talks to: the GUI, the CLI and agent skills. Closing a window should not take the CLI and headless agents away. Observed: after quitting the app, launchctl list shows - 0 app.nodespace.daemon, the daemon is down, and nodespace finds nothing to talk to, with no hint to relaunch the app.

Expected

The window is a client of the service, not its owner.

  • Closing the window, Cmd+Q and the red traffic-light button end the UI only; the daemon and its tray icon keep running, so the tray makes the running service visible rather than invisible.
  • The tray's "Quit" is the explicit way to stop the daemon (and closes the UI), as it does today.
  • Opening the app again attaches to the running daemon (the existing "already healthy: no-op" path).
  • The same holds on every platform the app registers a service on: launchd, systemd and the Windows direct spawn (the daemon must outlive the app process there).
  • When the daemon is not running, the CLI's error says so and how to start it.

Scope

  • app-lib: stop the daemon half of shutdown on window close / ExitRequested / Exit; keep the tray-Quit path that stops both; update the comments that describe the old behaviour
  • plist / unit / Windows spawn: confirm a daemon started by the app is not tied to the app's process lifetime
  • CLI: a "daemon not running" message that names the ways to start it
  • tests: the shutdown and tray-quit tests that assert the daemon stops on window close
  • nodespace-docs: state the lifecycle once (window vs service) where the app and daemon relationship is described, and check the sync-architecture statement that the last-active database keeps syncing while the app window is closed against the new behaviour

Verify

Quit the window with Cmd+Q: launchctl list still shows a PID for the daemon, nodespace answers, an agent can read the workspace. Tray "Quit" then stops it, and the CLI reports the daemon is not running and how to start it. Relaunching the app after a window quit attaches to the same daemon.

Activity

  1. self-assigned this
    on Oct 15, 2026
  2. added a commit that references this issue on Oct 15, 2026
    9b252ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions