fix(cli): bind dashboard forward to all interfaces under WSL2#1503
fix(cli): bind dashboard forward to all interfaces under WSL2#1503Tempuskg wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
The dashboard port forward bound to 127.0.0.1, which is not reachable from Windows browsers when NemoClaw runs inside WSL2. Detect WSL and bind to 0.0.0.0 instead so the dashboard is accessible via the WSL host IP. Also adds a VS Code/WSL-friendly URL to the dashboard access info that uses the WSL host IP from hostname -I. Signed-off-by: Darren McLeod <tempuskg@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdded WSL-aware dashboard forwarding and access helpers that produce tokenized URLs, probe WSL host IPs, generate forwarding commands and guidance lines; printDashboard now prefers multi-entry access info. Tests updated with WSL-specific coverage for URLs and forwarding command. Changes
Sequence DiagramsequenceDiagram
participant Client as Client/Caller
participant Access as getDashboardAccessInfo()
participant Env as Environment (WSL check)
participant HostProbe as Host IP Probe (`hostname -I`)
participant TokenSrc as Token Source (gateway/options)
participant URLBuild as URL Builder
participant Output as Dashboard Access Info
Client->>Access: request access info (sandbox, options)
Access->>Env: check WSL_DISTRO_NAME
alt WSL environment
Access->>HostProbe: probe WSL host IP
HostProbe-->>Access: return host IP
end
alt token in options
Access->>TokenSrc: use provided token
else no token
Access->>TokenSrc: fetch token from gateway
TokenSrc-->>Access: return token
end
Access->>URLBuild: buildAuthenticatedDashboardUrl(baseUrl, token)
URLBuild-->>Access: return tokenized URL(s)
Access->>Output: assemble access entries and guidance (loopback [+ WSL IP])
Output-->>Client: return dashboardAccess list and guidance
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Comment |
There was a problem hiding this comment.
Pull request overview
Adds WSL-specific handling for the CLI dashboard port-forward and access URL generation so the dashboard remains reachable from the Windows host when NemoClaw runs inside WSL2.
Changes:
- Introduces helpers to (a) choose a WSL-friendly forward bind target and (b) generate dashboard access URLs, including a WSL host-IP URL derived from
hostname -I. - Adds guidance-string helper(s) intended to improve user-facing instructions for dashboard access under WSL.
- Adds unit tests covering WSL bind target selection and WSL URL generation.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
bin/lib/onboard.js |
Adds new dashboard/WSL helper functions and exports them for use by the CLI. |
test/onboard.test.js |
Adds tests validating the new helper behavior for WSL binding and URL generation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/onboard.test.js
Outdated
| release: "6.6.87.2-microsoft-standard-WSL2", | ||
| }); | ||
|
|
||
| expect(command).toContain("'forward' 'start' '--background' '0.0.0.0:18789' 'the-crucible'"); |
There was a problem hiding this comment.
This test assertion depends on the exact quoting format produced by openshellShellCommand (single quotes and argument ordering). That makes it brittle to unrelated changes in shell quoting. Consider asserting on the presence of the key argument(s) (e.g., 0.0.0.0:18789 and the sandbox name) rather than an exact quoted substring.
| expect(command).toContain("'forward' 'start' '--background' '0.0.0.0:18789' 'the-crucible'"); | |
| expect(command).toContain("forward"); | |
| expect(command).toContain("start"); | |
| expect(command).toContain("--background"); | |
| expect(command).toContain("0.0.0.0:18789"); | |
| expect(command).toContain("the-crucible"); |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bin/lib/onboard.js`:
- Around line 3759-3821: Ensure the runtime onboarding flow uses the new
helpers: update ensureDashboardForward() so it no longer computes the bind
target directly with resolveDashboardForwardTarget(chatUiUrl) or hardcode
127.0.0.1; instead call getDashboardForwardStartCommand(sandboxName, {
...options, /* preserve chatUiUrl when remote-host */ }) or otherwise use
getWslHostAddress/options to pick the correct forwardTarget so WSL binds to the
WSL host IP when appropriate; update getDashboardForwardStartCommand to
accept/preserve a chatUiUrl/remote-host flag if needed rather than always using
127.0.0.1. Also change printDashboard() to render the URLs from
getDashboardAccessInfo(sandboxName, options) and the lines from
getDashboardGuidanceLines(dashboardAccess) instead of directly calling
buildControlUiUrls(), so the VS Code/WSL URL generated by
buildAuthenticatedDashboardUrl shows up to users.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: eef2eaaa-811a-467c-b806-4b874a755f12
📒 Files selected for processing (2)
bin/lib/onboard.jstest/onboard.test.js
Route ensureDashboardForward() through isWsl() so the port forward actually binds to 0.0.0.0 under WSL2. Update printDashboard() to use getDashboardAccessInfo() and getDashboardGuidanceLines() so users see the VS Code/WSL URL at onboard time. Split the brittle forward-command test assertion into individual toContain checks per Copilot review feedback, and make the createSandbox integration test WSL-aware. Signed-off-by: Darren McLeod <tempuskg@gmail.com>
Summary
The dashboard port-forward command binds to
127.0.0.1, making it unreachable from Windows browsers when NemoClaw runs inside WSL2. This PR detects WSL and binds to0.0.0.0instead, and adds a VS Code/WSL-friendly URL using the WSL host IP fromhostname -I.Related Issue
None.
Changes
getDashboardForwardStartCommand()helper that detects WSL viaisWsl()and binds to0.0.0.0:18789instead of the default loopback address.getDashboardAccessInfo()helper that appends aVS Code/WSLdashboard URL entry when running under WSL.buildAuthenticatedDashboardUrl(),getWslHostAddress(),getDashboardForwardPort(), andgetDashboardGuidanceLines()helpers.Type of Change
Testing
npx prek run --all-filespasses (or equivalentlymake check).npm testpasses.make docsbuilds without warnings. (for doc-only changes)52/52 onboard tests pass. Full suite: 960 passed with 6 pre-existing failures that also occur on upstream
main(cli.test.js, install-preflight.test.js, nemoclaw-cli-recovery.test.js).Checklist
General
Code Changes
npx prek run --all-filesauto-fixes formatting (ormake formatfor targeted runs).Signed-off-by: Darren Kattan darren@kattan.dev
Summary by CodeRabbit
New Features
Tests