Skip to content

Make NODESPACE_HOME alone isolate a daemon: the socket follows it, the app stops reading it - #3658

Merged
mstomar125 merged 1 commit into
mainfrom
issue-3640-nodespace-home-isolation
Oct 6, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-3640-nodespace-home-isolation

Conversation

@mstomar125

@mstomar125 mstomar125 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3640

NODESPACE_HOME alone now isolates a daemon and the CLI that talks to it.

  • The daemon and the CLI resolve the default socket in the state directory of the shared home rule (nodespace_dir()); the single-instance lock already follows the socket. NODESPACED_SOCKET and --socket still override. With NODESPACE_HOME unset every path is unchanged. default_socket_path_for still reads no environment; it now takes the state directory.
  • An agent session already receives the serving daemon's socket as NODESPACED_SOCKET (the daemon sets it after the PTY allowlist clears the environment), so packages/agent is untouched. The launch test now has the stand-in agent report it, with the daemon's own environment naming a different socket.
  • The app's read of NODESPACE_HOME in bundled_model.rs is removed; the model copies under the user's home. The app/daemon socket agreement tests are unchanged and pass.

Tests (all mutation-checked, each fails with the fix reverted)

  • daemon home_isolation::nodespace_home_alone_moves_the_socket_and_its_lock: real nodespaced, HOME at a temp real home, NODESPACE_HOME elsewhere, no socket override; socket and lock sit in the redirected home, none in the real one. Companion test: no redirect puts them in the home.
  • cli home_isolation: counting listeners in both homes; the redirected one is dialed, the real one is not; no redirect dials the home; env and --socket overrides win.
  • cli launched_session: the agent's NODESPACED_SOCKET is the served socket.
  • app bundled_model::the_copy_ignores_nodespace_home.

Not covered: the local-agent model manager (packages/agent/src/local_agent/model_manager.rs) still creates models/ under $HOME regardless of NODESPACE_HOME; it is outside this issue and in the agent package.

Documentation

Companion docs PR: https://github.com/NodeSpaceAI/nodespace-docs/pull/114 (daemon-cli-protocol.md, daemon-cli-lifecycle.md, ADR-033 note, agent-eval.md).

🤖 Generated with Claude Code

@mstomar125

Copy link
Copy Markdown
Contributor Author

Review round 1 (pragmatic-code-reviewer, medium): APPROVE, no critical findings. Follow-ups addressed: (1) the production set_daemon_socket calls on all four serve paths (unix/windows, headless/tray) predate this change and are unchanged; the new test covers the session-environment service level, and this PR does not add a source-shape guard. (2) ADR-032 already carries the amendment that the session environment names the daemon socket, and ADR-052 section 3 is unchanged because the parent directory is still created owner-only; no edit needed. (3) Windows and socket-path-length caveats added to the protocol doc (docs PR 114). Nits on agent-eval wording fixed. Not re-reviewed: only documentation text changed after the review.

🤖 Generated with Claude Code

…s it, the app stops reading it

The daemon and the CLI resolve the default socket (and the lock beside it) under
the shared home rule, so no NODESPACED_SOCKET is needed for isolation. The app's
bundled-model copy goes under the user's home. A launched agent session already
receives the daemon's socket; the launch test now pins it against a daemon whose
own environment names another.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make NODESPACE_HOME alone isolate a daemon: the socket follows it, agents get the daemon's socket, and the app stops reading it

1 participant