NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[All Platforms][CLI&UX] tunnel start always tunnels port 18789 instead of the sandbox's dashboard port

Open PicoNVIDIA opened this issue 2 months ago • 0 comments

Description

nemoclaw tunnel start works out the default sandbox but doesn't pass its dashboardPort to startAll(). startAll() falls back to DASHBOARD_PORT, which is 18789 unless NEMOCLAW_DASHBOARD_PORT is set in the current shell, and runs cloudflared tunnel --url http://localhost:18789 (src/lib/tunnel/service-command.ts:33, src/lib/tunnel/services.ts:667). tunnel status uses the same fallback at services.ts:497.

A sandbox can easily end up on another port. Onboard takes the next free port in 18789-18799 when 18789 is in use, and --control-ui-port sets one explicitly. nemoclaw <sandbox> dashboard-url uses the recorded port, so it and tunnel start point at different places.

This is separate from #12405.

Reproduction Steps

  1. In an isolated HOME, register a sandbox with dashboardPort: 18791. It becomes the default sandbox. Put stub openshell and docker on PATH, plus a cloudflared stub that logs its arguments.
  2. Run nemoclaw tunnel start.
  3. Run nemoclaw <sandbox> dashboard-url --quiet.
  4. Repeat with dashboardPort: 18789 as a control.

Environment

  • macOS 26.5.2 (arm64), Node.js v22.22.3
  • NemoClaw main at 4c44f7cc8; the files involved are unchanged on d61268122
  • Real CLI (node bin/nemoclaw.js) with stubbed OpenShell and cloudflared. No real Cloudflare tunnel was started.

Debug Output

dashboardPort 18791 (same result for an OpenClaw and a Hermes sandbox):
$ nemoclaw tunnel start
[services] cloudflared started (PID 1812)
  │  Public URL:  https://verify-fake.trycloudflare.com/        │
cloudflared argv: cloudflared tunnel --url http://localhost:18789
$ nemoclaw <sandbox> dashboard-url --quiet
http://127.0.0.1:18791/#token=<redacted>

dashboardPort 18789 (control):
cloudflared argv: cloudflared tunnel --url http://localhost:18789
dashboard-url: http://127.0.0.1:18789/#token=<redacted>

Logs

With two sandboxes on one host, the public URL printed for the default sandbox serves the other sandbox's dashboard. With a single sandbox on a custom port, it serves nothing. Both times tunnel start exits 0 and prints the URL. For OpenClaw, the tunnel origin is also added to the default sandbox's allowed origins while the traffic goes to a different one.

Looking up registry.getSandbox(name)?.dashboardPort in runStartCommand() and in the status path, and only falling back to DASHBOARD_PORT when nothing is recorded, would fix it. The tests in services.test.ts always pass an explicit port, so a service-command test with a non-default registered port would catch this.

Checklist

  • [x] I confirmed this bug is reproducible
  • [x] I searched existing issues and this is not a duplicate

PicoNVIDIA avatar Sep 28 '26 21:09 PicoNVIDIA