fix(onboard): add sudo prefix to lsof port-conflict suggestions#1073
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughPrefixed Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
On Linux, lsof requires root privileges to see processes owned by other users. Without sudo, the suggested command returns empty output, leaving users unable to identify the conflicting process. Closes NVIDIA#726
5d33433 to
2ab6426
Compare
|
The change itself does appear to miss two user-facing doc copies of the same guidance:
Please add these updates. Code-wise looks good to me. |
Update the two remaining doc copies that still showed lsof without sudo: docs/reference/troubleshooting.md and the agent skill reference. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
|
Good catch — added
Ready for re-review. |
|
✨ Thanks for submitting this PR with a detailed summary, it addresses a bug with lsof port-conflict suggestions and proposes a fix to improve the user experience of NemoClaw. |
…IA#1073) * fix(onboard): add sudo prefix to lsof port-conflict suggestions On Linux, lsof requires root privileges to see processes owned by other users. Without sudo, the suggested command returns empty output, leaving users unable to identify the conflicting process. Closes NVIDIA#726 * fix(docs): add sudo prefix to lsof in troubleshooting guides Update the two remaining doc copies that still showed lsof without sudo: docs/reference/troubleshooting.md and the agent skill reference. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> --------- Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: KJ <kejones@nvidia.com>
## Summary - restore the dashboard forward on all onboarding paths, including existing-sandbox reuse - bind the dashboard forward to `0.0.0.0:18789` only when `CHAT_UI_URL` points at a non-loopback host - show `launchctl` guidance on macOS instead of `systemctl` for dashboard port conflicts - add regression coverage for dashboard bind resolution, sandbox reuse, and platform-specific port-help output ## Issues - Closes #957 - Fixes #1067 - Addresses #1088 ## Why Current onboarding only restored the dashboard forward on the full sandbox-create path. If onboarding reused an existing ready sandbox, the flow returned early and left the dashboard unreachable when the forward was missing. The port-conflict help text also still showed Linux `systemctl` guidance on macOS. ## Implementation - added `isLoopbackHostname(...)`, `resolveDashboardForwardTarget(...)`, and `ensureDashboardForward(...)` in `bin/lib/onboard.js` - reused that helper in both: - the normal sandbox-create success path - the existing ready sandbox reuse path - kept loopback binding for localhost / 127.0.0.0/8 / ::1 - switched to `0.0.0.0:18789` only for explicit non-loopback `CHAT_UI_URL` targets - added `getPortConflictServiceHints(...)` so preflight output stays platform-specific without duplicating logic ## Validation ```bash npx vitest run test/onboard.test.js npx eslint bin/lib/onboard.js test/onboard.test.js npx tsc -p jsconfig.json --noEmit npx vitest run ``` Results: - targeted onboarding suite: passed - ESLint: passed - TypeScript: passed - full Vitest suite: `39` files passed, `680` tests passed, `3` skipped ### Cross-platform validation Validated PR `#1192` / commit `4ef7a07` on: - `mac` - passed - commands: - `npx vitest run test/onboard.test.js` - `npx eslint bin/lib/onboard.js test/onboard.test.js` - `npx tsc -p jsconfig.json --noEmit` - `brev-cpu` (`kj-nemoclaw-cpu-test`) - passed - used Node `v22.22.2` from `~/.nvm` - ran in a disposable worktree with fresh dev dependency install - `brev-gpu` (`kj-nemoclaw-l40s-test`) - passed - used Node `v22.22.1` from `~/.nvm` - ran in a disposable worktree with fresh dev dependency install - one initial timeout occurred on the long-running “create stream never closes” test; immediate rerun passed cleanly - `spark` (`spark-d8c8`) - passed - used Node `v22.22.1` - ran in a disposable worktree with fresh dev dependency install Remote commands used: ```bash npx vitest run test/onboard.test.js npx eslint bin/lib/onboard.js test/onboard.test.js npx tsc -p jsconfig.json --noEmit ``` Environment notes: - Brev CPU/GPU already had usable Node 22 installs, but not on the default shell `PATH` - Spark needed a disposable `npm install --include=dev` because the base checkout did not have the full JS dev toolchain ## Related prior work This PR pulls in the good ideas, but reimplements them cleanly on top of current `main`. Credit to: - `WuKongAI-CMU` / Peter for the dashboard-forward direction in #958 - `dinuduke` / Dinesh Singh for the macOS launchctl guidance direction in #1167 - `latenighthackathon` for the already-merged sudo/lsof fix in #1073, which this PR preserves while making the service hint platform-specific Signed-off-by: Kevin Jones <kejones@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Platform-specific port-conflict guidance with OS-appropriate service-stop instructions for macOS and Linux. * Smarter dashboard port forwarding: onboarding now ensures the dashboard binds to loopback or to all interfaces based on the chat UI URL, and restores forwarding when reusing an existing sandbox. * **Tests** * Expanded coverage for port-conflict hints, loopback detection, forward-target resolution, and dashboard-forward behavior across sandbox scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
* fix(onboard): add sudo prefix to lsof port-conflict suggestions On Linux, lsof requires root privileges to see processes owned by other users. Without sudo, the suggested command returns empty output, leaving users unable to identify the conflicting process. Closes #726 * fix(docs): add sudo prefix to lsof in troubleshooting guides Update the two remaining doc copies that still showed lsof without sudo: docs/reference/troubleshooting.md and the agent skill reference. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> --------- Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: KJ <kejones@nvidia.com>
## Summary - restore the dashboard forward on all onboarding paths, including existing-sandbox reuse - bind the dashboard forward to `0.0.0.0:18789` only when `CHAT_UI_URL` points at a non-loopback host - show `launchctl` guidance on macOS instead of `systemctl` for dashboard port conflicts - add regression coverage for dashboard bind resolution, sandbox reuse, and platform-specific port-help output ## Issues - Closes #957 - Fixes #1067 - Addresses #1088 ## Why Current onboarding only restored the dashboard forward on the full sandbox-create path. If onboarding reused an existing ready sandbox, the flow returned early and left the dashboard unreachable when the forward was missing. The port-conflict help text also still showed Linux `systemctl` guidance on macOS. ## Implementation - added `isLoopbackHostname(...)`, `resolveDashboardForwardTarget(...)`, and `ensureDashboardForward(...)` in `bin/lib/onboard.js` - reused that helper in both: - the normal sandbox-create success path - the existing ready sandbox reuse path - kept loopback binding for localhost / 127.0.0.0/8 / ::1 - switched to `0.0.0.0:18789` only for explicit non-loopback `CHAT_UI_URL` targets - added `getPortConflictServiceHints(...)` so preflight output stays platform-specific without duplicating logic ## Validation ```bash npx vitest run test/onboard.test.js npx eslint bin/lib/onboard.js test/onboard.test.js npx tsc -p jsconfig.json --noEmit npx vitest run ``` Results: - targeted onboarding suite: passed - ESLint: passed - TypeScript: passed - full Vitest suite: `39` files passed, `680` tests passed, `3` skipped ### Cross-platform validation Validated PR `#1192` / commit `4ef7a07` on: - `mac` - passed - commands: - `npx vitest run test/onboard.test.js` - `npx eslint bin/lib/onboard.js test/onboard.test.js` - `npx tsc -p jsconfig.json --noEmit` - `brev-cpu` (`kj-nemoclaw-cpu-test`) - passed - used Node `v22.22.2` from `~/.nvm` - ran in a disposable worktree with fresh dev dependency install - `brev-gpu` (`kj-nemoclaw-l40s-test`) - passed - used Node `v22.22.1` from `~/.nvm` - ran in a disposable worktree with fresh dev dependency install - one initial timeout occurred on the long-running “create stream never closes” test; immediate rerun passed cleanly - `spark` (`spark-d8c8`) - passed - used Node `v22.22.1` - ran in a disposable worktree with fresh dev dependency install Remote commands used: ```bash npx vitest run test/onboard.test.js npx eslint bin/lib/onboard.js test/onboard.test.js npx tsc -p jsconfig.json --noEmit ``` Environment notes: - Brev CPU/GPU already had usable Node 22 installs, but not on the default shell `PATH` - Spark needed a disposable `npm install --include=dev` because the base checkout did not have the full JS dev toolchain ## Related prior work This PR pulls in the good ideas, but reimplements them cleanly on top of current `main`. Credit to: - `WuKongAI-CMU` / Peter for the dashboard-forward direction in #958 - `dinuduke` / Dinesh Singh for the macOS launchctl guidance direction in #1167 - `latenighthackathon` for the already-merged sudo/lsof fix in #1073, which this PR preserves while making the service hint platform-specific Signed-off-by: Kevin Jones <kejones@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Platform-specific port-conflict guidance with OS-appropriate service-stop instructions for macOS and Linux. * Smarter dashboard port forwarding: onboarding now ensures the dashboard binds to loopback or to all interfaces based on the chat UI URL, and restores forwarding when reusing an existing sandbox. * **Tests** * Expanded coverage for port-conflict hints, loopback detection, forward-target resolution, and dashboard-forward behavior across sandbox scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…IA#1073) * fix(onboard): add sudo prefix to lsof port-conflict suggestions On Linux, lsof requires root privileges to see processes owned by other users. Without sudo, the suggested command returns empty output, leaving users unable to identify the conflicting process. Closes NVIDIA#726 * fix(docs): add sudo prefix to lsof in troubleshooting guides Update the two remaining doc copies that still showed lsof without sudo: docs/reference/troubleshooting.md and the agent skill reference. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> --------- Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: KJ <kejones@nvidia.com>
…#1192) ## Summary - restore the dashboard forward on all onboarding paths, including existing-sandbox reuse - bind the dashboard forward to `0.0.0.0:18789` only when `CHAT_UI_URL` points at a non-loopback host - show `launchctl` guidance on macOS instead of `systemctl` for dashboard port conflicts - add regression coverage for dashboard bind resolution, sandbox reuse, and platform-specific port-help output ## Issues - Closes NVIDIA#957 - Fixes NVIDIA#1067 - Addresses NVIDIA#1088 ## Why Current onboarding only restored the dashboard forward on the full sandbox-create path. If onboarding reused an existing ready sandbox, the flow returned early and left the dashboard unreachable when the forward was missing. The port-conflict help text also still showed Linux `systemctl` guidance on macOS. ## Implementation - added `isLoopbackHostname(...)`, `resolveDashboardForwardTarget(...)`, and `ensureDashboardForward(...)` in `bin/lib/onboard.js` - reused that helper in both: - the normal sandbox-create success path - the existing ready sandbox reuse path - kept loopback binding for localhost / 127.0.0.0/8 / ::1 - switched to `0.0.0.0:18789` only for explicit non-loopback `CHAT_UI_URL` targets - added `getPortConflictServiceHints(...)` so preflight output stays platform-specific without duplicating logic ## Validation ```bash npx vitest run test/onboard.test.js npx eslint bin/lib/onboard.js test/onboard.test.js npx tsc -p jsconfig.json --noEmit npx vitest run ``` Results: - targeted onboarding suite: passed - ESLint: passed - TypeScript: passed - full Vitest suite: `39` files passed, `680` tests passed, `3` skipped ### Cross-platform validation Validated PR `NVIDIA#1192` / commit `4ef7a07` on: - `mac` - passed - commands: - `npx vitest run test/onboard.test.js` - `npx eslint bin/lib/onboard.js test/onboard.test.js` - `npx tsc -p jsconfig.json --noEmit` - `brev-cpu` (`kj-nemoclaw-cpu-test`) - passed - used Node `v22.22.2` from `~/.nvm` - ran in a disposable worktree with fresh dev dependency install - `brev-gpu` (`kj-nemoclaw-l40s-test`) - passed - used Node `v22.22.1` from `~/.nvm` - ran in a disposable worktree with fresh dev dependency install - one initial timeout occurred on the long-running “create stream never closes” test; immediate rerun passed cleanly - `spark` (`spark-d8c8`) - passed - used Node `v22.22.1` - ran in a disposable worktree with fresh dev dependency install Remote commands used: ```bash npx vitest run test/onboard.test.js npx eslint bin/lib/onboard.js test/onboard.test.js npx tsc -p jsconfig.json --noEmit ``` Environment notes: - Brev CPU/GPU already had usable Node 22 installs, but not on the default shell `PATH` - Spark needed a disposable `npm install --include=dev` because the base checkout did not have the full JS dev toolchain ## Related prior work This PR pulls in the good ideas, but reimplements them cleanly on top of current `main`. Credit to: - `WuKongAI-CMU` / Peter for the dashboard-forward direction in NVIDIA#958 - `dinuduke` / Dinesh Singh for the macOS launchctl guidance direction in NVIDIA#1167 - `latenighthackathon` for the already-merged sudo/lsof fix in NVIDIA#1073, which this PR preserves while making the service hint platform-specific Signed-off-by: Kevin Jones <kejones@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Platform-specific port-conflict guidance with OS-appropriate service-stop instructions for macOS and Linux. * Smarter dashboard port forwarding: onboarding now ensures the dashboard binds to loopback or to all interfaces based on the chat UI URL, and restores forwarding when reusing an existing sandbox. * **Tests** * Expanded coverage for port-conflict hints, loopback detection, forward-target resolution, and dashboard-forward behavior across sandbox scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…IA#1073) * fix(onboard): add sudo prefix to lsof port-conflict suggestions On Linux, lsof requires root privileges to see processes owned by other users. Without sudo, the suggested command returns empty output, leaving users unable to identify the conflicting process. Closes NVIDIA#726 * fix(docs): add sudo prefix to lsof in troubleshooting guides Update the two remaining doc copies that still showed lsof without sudo: docs/reference/troubleshooting.md and the agent skill reference. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> --------- Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: KJ <kejones@nvidia.com>
…#1192) ## Summary - restore the dashboard forward on all onboarding paths, including existing-sandbox reuse - bind the dashboard forward to `0.0.0.0:18789` only when `CHAT_UI_URL` points at a non-loopback host - show `launchctl` guidance on macOS instead of `systemctl` for dashboard port conflicts - add regression coverage for dashboard bind resolution, sandbox reuse, and platform-specific port-help output ## Issues - Closes NVIDIA#957 - Fixes NVIDIA#1067 - Addresses NVIDIA#1088 ## Why Current onboarding only restored the dashboard forward on the full sandbox-create path. If onboarding reused an existing ready sandbox, the flow returned early and left the dashboard unreachable when the forward was missing. The port-conflict help text also still showed Linux `systemctl` guidance on macOS. ## Implementation - added `isLoopbackHostname(...)`, `resolveDashboardForwardTarget(...)`, and `ensureDashboardForward(...)` in `bin/lib/onboard.js` - reused that helper in both: - the normal sandbox-create success path - the existing ready sandbox reuse path - kept loopback binding for localhost / 127.0.0.0/8 / ::1 - switched to `0.0.0.0:18789` only for explicit non-loopback `CHAT_UI_URL` targets - added `getPortConflictServiceHints(...)` so preflight output stays platform-specific without duplicating logic ## Validation ```bash npx vitest run test/onboard.test.js npx eslint bin/lib/onboard.js test/onboard.test.js npx tsc -p jsconfig.json --noEmit npx vitest run ``` Results: - targeted onboarding suite: passed - ESLint: passed - TypeScript: passed - full Vitest suite: `39` files passed, `680` tests passed, `3` skipped ### Cross-platform validation Validated PR `NVIDIA#1192` / commit `4ef7a07` on: - `mac` - passed - commands: - `npx vitest run test/onboard.test.js` - `npx eslint bin/lib/onboard.js test/onboard.test.js` - `npx tsc -p jsconfig.json --noEmit` - `brev-cpu` (`kj-nemoclaw-cpu-test`) - passed - used Node `v22.22.2` from `~/.nvm` - ran in a disposable worktree with fresh dev dependency install - `brev-gpu` (`kj-nemoclaw-l40s-test`) - passed - used Node `v22.22.1` from `~/.nvm` - ran in a disposable worktree with fresh dev dependency install - one initial timeout occurred on the long-running “create stream never closes” test; immediate rerun passed cleanly - `spark` (`spark-d8c8`) - passed - used Node `v22.22.1` - ran in a disposable worktree with fresh dev dependency install Remote commands used: ```bash npx vitest run test/onboard.test.js npx eslint bin/lib/onboard.js test/onboard.test.js npx tsc -p jsconfig.json --noEmit ``` Environment notes: - Brev CPU/GPU already had usable Node 22 installs, but not on the default shell `PATH` - Spark needed a disposable `npm install --include=dev` because the base checkout did not have the full JS dev toolchain ## Related prior work This PR pulls in the good ideas, but reimplements them cleanly on top of current `main`. Credit to: - `WuKongAI-CMU` / Peter for the dashboard-forward direction in NVIDIA#958 - `dinuduke` / Dinesh Singh for the macOS launchctl guidance direction in NVIDIA#1167 - `latenighthackathon` for the already-merged sudo/lsof fix in NVIDIA#1073, which this PR preserves while making the service hint platform-specific Signed-off-by: Kevin Jones <kejones@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Platform-specific port-conflict guidance with OS-appropriate service-stop instructions for macOS and Linux. * Smarter dashboard port forwarding: onboarding now ensures the dashboard binds to loopback or to all interfaces based on the chat UI URL, and restores forwarding when reusing an existing sandbox. * **Tests** * Expanded coverage for port-conflict hints, loopback detection, forward-target resolution, and dashboard-forward behavior across sandbox scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
On Linux, lsof requires root privileges to see processes owned by other users. The onboarding port-conflict message suggested lsof without sudo, which returns empty output.
Related Issue
Closes #726
Changes
Type of Change
Testing
npx prek run --all-filespasses (or equivalentlymake check).npm testpasses.make docsbuilds without warnings. (for doc-only changes)Checklist
General
Code Changes
Summary by CodeRabbit