Skip to content

Launching the desktop app with a scratch HOME still writes a database and registry into the real home #4202

Closed

Description

@malibio

Overview

The run-app skill says a scratch HOME keeps the Tauri app's files and database out of the real home. In practice, launching bun run dev:tauri with HOME=/tmp/nsh created a database and a registry in the real ~/.nodespace, and the webview kept the previous install's localStorage. A session that believes it is isolated is not.

Problem Statement

Observed on a machine whose ~/.nodespace held only models/:

  • Launched with HOME=/tmp/nsh, CARGO_HOME and RUSTUP_HOME set to the real paths, as the skill describes.
  • During that launch, ~/.nodespace/databases.toml was created (the file's birth time is the app's launch), registering a default database at ~/.nodespace/database/nodespace.db. That database file was also created at launch and written to for the following 10 minutes. .model-verify-key was created too.
  • The daemon and the app then disagreed about which database was default (01M691W94… in the real-home registry, a different id in the scratch one), and every call failed with no database registered with id …. A tab click closed the tab as a result.
  • The webview's localStorage still held the previous install's tab state and active database id, so WebKit storage was not relocated by HOME either.
  • The mechanism (how the app resolves its home) was not determined; it is evidently not $HOME alone.

Proposed Solution

Make a scratch launch write nothing to the real home, or state exactly what it does write and how to avoid it, so the person running it is not surprised.

Documentation

  • Local Builds - how the dev app is built and launched.
  • ADR-053 - the database registry and where it lives.
  • Daemon and CLI Lifecycle - how the app starts and registers the daemon.
  • Updates: the run-app skill (.claude/skills/run-app/SKILL.md), whose isolation claims must match.

Acceptance Criteria

  • The cause is identified: which code resolves the home or registry directory and why HOME does not move it.
  • A launch with HOME pointed at a scratch directory creates no file in the real ~/.nodespace, or the run-app skill states each path that is written outside the scratch home and how to relocate it.
  • The webview's persisted storage is either relocated by the same setting or the skill says how to start from empty storage.
  • A test or script check covers the home resolution used by the app and the daemon, so the two cannot select different registries.
  • The run-app skill's isolation section matches the behavior.
  • Code passes bun run quality:fix; bun run test:changed passes.

Technical Specifications

Reference Files

  • .claude/skills/run-app/SKILL.md - the isolation claims for browser and desktop launches
  • packages/desktop-app/app-lib/src/daemon_setup.rs - app-side daemon installation and registration
  • packages/daemon/src/lib.rs - how the state directory and registry path are resolved (NODESPACE_HOME, NODESPACED_DB_PATH)

Related Issues

  • None

Activity

  1. added
    bug
    on Oct 31, 2026
  2. self-assigned this
    on Nov 2, 2026
  3. mstomar125 commented on Nov 2, 2026

    @mstomar125
    Contributor

    Picking this up (sweep drain).

  4. mstomar125 commented on Nov 3, 2026

    @mstomar125
    Contributor

    Picking this up (sweep drain).

  5. mstomar125 commented on Nov 3, 2026

    @mstomar125
    Contributor

    Merged: the Linux systemd unit now forwards HOME and NODESPACE_HOME like the launchd plist, with tests for the unit lines and for a plist whose paths contain spaces and XML metacharacters. Still open: the cause of the webview localStorage carry-over, a test that the app and daemon pick the same registry, the live macOS scratch-HOME check, and the Linux systemd run (a scratch HOME alone does not isolate systemctl --user).

    🤖 Generated with Claude Code

  6. mstomar125 commented on Nov 5, 2026

    @mstomar125
    Contributor

    Closing: the part that needs no device is merged (the Linux systemd unit forwards HOME and NODESPACE_HOME like the launchd plist, with tests). The remaining work, which needs a real desktop app and a systemd host, is tracked in #4244.

    🤖 Generated with Claude Code

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

Metadata

Metadata

Assignees

Labels

bugdeveloper-experience

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions