Skip to content

Tell the user when another NodeSpace product's daemon is running or registered #3356

Closed as not planned

Description

@mstomar125

Summary

Core's side of the two notices in ADR-084 §4.3 (proposed). Both are generic, and neither names a product.

  1. Another daemon is still serving the socket.
    • When it happens: Check the running daemon's executable against the app's DaemonProfile at startup #3353 re-registers the app's daemon, but the socket is still served by a daemon whose executable doesn't match the profile. That daemon is outside the app's registration, such as a Homebrew service or one started by hand.
    • What the backend does: it records the daemon and reports a new status, foreign_daemon, with that daemon's executable path.
    • What the app shows: a non-blocking banner with a Retry button: "Another NodeSpace background service is running (‹executable path›). Stop it, then choose Retry."
  2. Another daemon is registered for every user (macOS only).
    • When it happens: /Library/LaunchAgents/app.nodespace.daemon.plist exists, and its ProgramArguments[0] (or Program) has a file name other than the profile's binary_name.
    • What the app shows: "Another NodeSpace product's background service is registered for all users of this Mac and starts at login. To remove it, run that product's uninstall, or install NodeSpace with its installer package."
    • The file is owned by root, so the app can't delete it.

Context

  • Backend today.
    • check_daemon_status and daemon_status_body (lib.rs 88-122) return healthy, starting, not_running or incompatible_database.
    • The startup task (lib.rs ~500-535) emits daemon-status.
  • The pattern to follow. The incompatible-database state already works end to end:
    • backend: incompatible_database.rs, with get_incompatible_database, and reset_incompatible_database, which re-runs ensure_daemon_running;
    • frontend: services/daemon-status.ts (the incompatibleDatabase flag and refreshDaemonStatus) and components/layout/incompatible-database-banner.svelte, with its test;
    • test helper: src/tests/helpers/mock-tauri-core.ts.
  • The banner is non-blocking by design. The app keeps working against the running daemon, as it does today. Blocking would lock free users out whenever an older Homebrew-service daemon holds the socket.
  • Core's own .pkg registration never triggers the notice. scripts/pkg-resources/app.nodespace.daemon.plist runs /usr/local/bin/nodespaced, which matches the community profile.
  • Push-time checks.
    • The design-tokens check runs at push time. A new component must pass bun run --cwd packages/desktop-app quality:design-tokens; reuse the incompatible-database banner's tokens.
    • Frontend text must not name Pro, because the ratchet counts that word.

Scope

Backend (packages/desktop-app/src-tauri/src)

  • New module foreign_daemon.rs. It holds:
    • the in-memory record of a foreign serving daemon (its path);
    • #[tauri::command] get_foreign_daemon_notices() -> ForeignDaemonNotices { running_executable: Option<String>, machine_wide_program: Option<String> };
    • #[tauri::command] retry_foreign_daemon(app) -> String, which re-runs ensure_daemon_running and returns the resulting status, as reset_incompatible_database does.
  • Re-check after registering. In daemon_setup::ensure_daemon_running, after the register path's wait_for_daemon_or_refusal returns Healthy, re-run Check the running daemon's executable against the app's DaemonProfile at startup #3353's check (unix only).
    • On Mismatch, record the path.
    • On Match, clear the record.
  • Report the status.
    • daemon_status_body returns foreign_daemon while the socket is healthy and the record stands.
    • In that case the startup task emits foreign_daemon instead of healthy.
  • Machine-wide registration (macOS). Read the plist with the plist crate. Add it as a direct dependency; it is already in Cargo.lock.
  • Register both commands in the core command list.

Frontend (packages/desktop-app/src)

  • services/daemon-status.ts:
    • Add foreignDaemon: boolean to DaemonStatusState, set by the foreign_daemon status.
    • For gRPC readiness, treat it like healthy: data calls go ahead.
    • Add the wrappers getForeignDaemonNotices() and retryForeignDaemon().
  • New banner components/layout/foreign-daemon-banner.svelte, rendered in app-shell.svelte next to the incompatible-database banner:
    • the running-daemon message, with the path and Retry;
    • the machine-wide notice, which the user can dismiss for the session.
  • Test helper: update mock-tauri-core.ts.

Out of scope

  • Removing the other product's registration. That is the job of that product's uninstall.
  • Windows.

Steps

  1. Run the startup sequence, and assign the issue at pickup.
  2. Build the backend module, the status and the commands, with their Rust tests.
  3. Build the frontend state and the banner, with their tests.
  4. Run bun run --cwd packages/desktop-app quality:fix, which includes the design-tokens check.
  5. Run bun run scripts/check-pro-boundary.ts and paste BASELINES.
  6. Run bun run test:changed, push, and open the PR.

Acceptance criteria

  • When a mismatched daemon is still serving after re-registration, the status is foreign_daemon and the banner shows the daemon's path.
  • Retry re-runs setup, and the banner clears once the daemon matches.
  • A foreign machine-wide registration shows the notice. Core's own .pkg registration does not.
  • With no foreign daemon and no foreign registration, the free app's flows are unchanged.
  • bun run scripts/check-pro-boundary.ts passes, with BASELINES pasted. No change is expected.

Tests and verification

  • Rust:
    • the pure machine-wide-registration check, against fixture plists: matching program, other program, Program key only, file absent, and unparseable;
    • the status mapping: a healthy socket plus a record gives foreign_daemon.
  • Frontend (Vitest, Happy-DOM), following incompatible-database-banner.test.ts:
    • in daemon-status.test.ts, the foreign_daemon status;
    • a new foreign-daemon-banner.test.ts: it renders the path, Retry calls the command, and the notice can be dismissed.
  • Commands:
    • bun run test:changed
    • bun run --cwd packages/desktop-app quality:fix
  • Optional manual check: on a dev Mac, start a second nodespaced by hand on the dev socket before you launch the dev app. The banner must appear.

Dependencies

Risks and rollback

  • Banner noise for users with an older Homebrew-service daemon. This is intended, and the text tells them what to do.
  • Rollback: revert the PR.

Plan key: C8.11 (pro-boundary DAG).

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Sep 30, 2026
  2. added
    pro-boundary
    on Sep 30, 2026
  3. mstomar125 commented on Oct 1, 2026

    @mstomar125
    ContributorAuthor

    Superseded by #3415 (umbrella against the final ADR-081–085)

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

Metadata

Metadata

Assignees

Labels

pro-boundary

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions