Skip to content

fix(setup): probe daemon sockets without netcat - #772

Merged
vladimirrott merged 2 commits into
lacs-project:mainfrom
CreedTech:fix/setup-socket-probe-755
Nov 15, 2026
Merged

vladimirrott merged 2 commits into
lacs-project:mainfrom
CreedTech:fix/setup-socket-probe-755

Conversation

@CreedTech

Copy link
Copy Markdown
Contributor

Summary

The setup wizard reports a listening daemon as unreachable when nc is absent. Probe local Unix sockets with Node's built-in net module instead. The subprocess keeps the existing synchronous flow and timeout, and sends no data to the daemon.

Related Issue

Closes #755

Validation

  • Tests added or updated
  • Documentation updated if behavior changed: no user instructions need updating
  • Security impact considered: the socket path is passed as an argument without invoking a shell
  • Trust boundary preserved: the probe only opens a connection
  • Upstream CI passes: pending
  • Commit is signed off

The reachable-daemon regression failed on the base implementation with an empty directory on PATH. With the fix, setup detects the listener and exits 0. The dead-socket check still reports unreachable and leaves setup incomplete.

  • npm test --prefix packages/setup: 137 passed.
  • python3 scripts/check_evidence_claims.py
  • git diff --check

Notes for Reviewers

The probe still skips vsock and non-local paths. Retry behavior is unchanged. Implementation and validation were assisted by Codex.

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the probe through process.execPath with the path in argv drops the nc dependency without adding a shell or an npm package. Pointing PATH at an empty directory in the test is the right way to prove it: a machine without netcat is the case #755 describes. I approve this at head c7af2ea15e1e0c52df28ec31fd99f987b288fedf.

I ran your tests in node:24-slim with the network off. That image ships no nc, so it reproduces #755:

HEAD tree: 1 node-probe line(s), nc on PATH: none
== pristine full suite rc=0
# tests 137
# pass 137
# fail 0

Then two mutants in checkSocket:

  • Restoring spawnSync('nc', ['-zU', socket], { timeout: 2000 }) fails your renamed test, and the output shows the bug from the issue:
    not ok 12 - a reachable externally managed daemon makes a skipped install complete without nc
    ⚠  Daemon socket not reachable after 6s: /tmp/sk-sock-24nLLE/sysknife/daemon.sock
    
  • Making the error handler exit 0 (a dead socket reported as alive) fails 16 tests, including a daemon that was not installed is reported as outstanding, whatever the reason, where your new Daemon socket not reachable after 6s: assertion lives. Both directions hold.

Both callers go through this function: the final status check after install (checkSocketWithRetry at index.js:920) and the early probe right after the socket prompt at index.js:487. A user without netcat who has a running daemon now sees Daemon socket reachable and Setup complete instead of an outstanding step. CI is green at this head. I have nothing blocking and nothing optional. I will merge it from my side and write the CHANGELOG line then.

If you want another in the same file, #563 (re-running sysknife-setup while the daemon runs fails with ETXTBSY) and #480 (--uninstall deletes the whole .mcp.json) are both open, and I will hold either for you.

@vladimirrott
vladimirrott merged commit 2e7d15f into lacs-project:main Nov 15, 2026
12 checks passed
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.

sysknife-setup reports a listening daemon as unreachable when nc is not installed

2 participants