fix(onboard): output dashboard URL with token on completion (Fixes #53)#87
fix(onboard): output dashboard URL with token on completion (Fixes #53)#87deepujain wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
|
Thanks for enhancing the onboarding process and making it more user-friendly, this will definitely improve the user experience for new users. |
86717d0 to
1634d79
Compare
|
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:
📝 WalkthroughWalkthroughAdds token retrieval to onboarding: extracts Changes
Sequence DiagramsequenceDiagram
participant Installer as Installer
participant Runner as openshell CLI
participant Sandbox as Sandbox
Installer->>Installer: write temp script that prints TOKEN:<token> from ~/.openclaw/openclaw.json
Installer->>Runner: run "openshell sandbox connect <sandboxName>" with script fed to stdin (timeout, ignoreError)
Runner->>Sandbox: execute stdin script inside sandbox
Sandbox-->>Runner: stdout (may contain "TOKEN:<value>")
Runner-->>Installer: captured stdout/stderr
Installer->>Installer: parseTokenFromOutput(output)
alt token found
Installer->>Installer: format dashboard URL with token and print
else no token
Installer->>Installer: print fallback dashboard URL (http://localhost:18789/)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Rebased onto latest main to resolve conflicts in bin/lib/onboard.js and test/onboard.test.js. Upstream commented out the Dashboard line and added buildSandboxConfigSyncScript exports/tests; merged both with the dashboard token URL and parseDashboardUrlFromOutput helper. All onboard tests pass. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
bin/lib/onboard.js (1)
9-9: Remove redundant inlineosrequire at line 448.The
osmodule is now imported at the module level (line 9), but there's still an inlineconst os = require("os");at line 448 insidecreateSandbox. This creates unnecessary shadowing. Consider removing the inline require.Suggested fix at line 448
// Stage build context const { mkdtempSync } = require("fs"); - const os = require("os"); const buildCtx = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-build-"));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bin/lib/onboard.js` at line 9, There is a redundant inline require of the "os" module inside createSandbox which shadows the module-level const os declared at the top; remove the inline `const os = require("os");` from the createSandbox function so the function uses the already-imported module-level `os` variable (search for createSandbox to locate the inline require), ensuring no other references rely on a locally scoped os.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@bin/lib/onboard.js`:
- Line 9: There is a redundant inline require of the "os" module inside
createSandbox which shadows the module-level const os declared at the top;
remove the inline `const os = require("os");` from the createSandbox function so
the function uses the already-imported module-level `os` variable (search for
createSandbox to locate the inline require), ensuring no other references rely
on a locally scoped os.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 65853bbe-82b6-4f97-8e17-9ba3e6078771
📒 Files selected for processing (2)
bin/lib/onboard.jstest/onboard.test.js
1634d79 to
41be8a8
Compare
|
Addressed CodeRabbit review comment |
|
Thanks for pushing on this. The UX problem is still real and worth fixing, but this PR is now stale against current The main gaps are:
If you’re still up for it, please rebase/update this PR against current Please tag @kjw3 when it’s ready for review again. |
41be8a8 to
9a395f1
Compare
|
Rebased onto latest main and rewrote the dashboard-token retrieval to use openshell sandbox connect < script (same pattern as setupOpenclaw) instead of the SSH/temp-config flow. The token is now read directly from ~/.openclaw/openclaw.json inside the sandbox, matching nemoclaw-start.sh. No more StrictHostKeyChecking=no. All onboard tests pass. @kjw3 ready for another look. |
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 `@test/onboard.test.js`:
- Around line 77-79: The test uses a realistic-looking API token string in the
variable out and assertion (see parseTokenFromOutput usage), which triggers
secret scanners; replace the long hex token with a non-secret fixture such as
"TOKEN:TEST_TOKEN" (or a short dummy string) in the out value and update the
expect(parseTokenFromOutput(out)).toBe(...) to match that dummy value so the
test still verifies parsing without exposing secret-like data.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f24bb95b-d1bd-4652-a707-c4adf0e68959
📒 Files selected for processing (2)
bin/lib/onboard.jstest/onboard.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
- bin/lib/onboard.js
9a395f1 to
91de335
Compare
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 1087-1090: The call to runCapture that runs `openshell sandbox
connect ${shellQuote(sandboxName)} < ${shellQuote(scriptFile)}` can hang
indefinitely; update the runCapture invocation (the one using sandboxName and
scriptFile) to include a timeout option (for example add timeout: 30000)
alongside the existing ignoreError: true so the call becomes runCapture(..., {
ignoreError: true, timeout: 30000 }) to ensure the onboarding flow falls back
promptly if the sandbox connection blocks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cbe0c723-afdf-4f94-ba11-3749d06ec523
📒 Files selected for processing (2)
bin/lib/onboard.jstest/onboard.test.js
91de335 to
f8d26ba
Compare
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 1059-1062: The token returned from the trimmed line is not
normalized/URL-encoded, so any fragment-reserved chars or stray whitespace can
break the dashboard URL; update the logic that currently returns
trimmed.slice(6) to first normalize and encode the token (e.g., trim the
extracted value and pass it through a URI-encoding function) and use that
encoded token when composing dashboardUrl (wherever dashboardUrl is
interpolated) so the fragment is safe; apply the same normalization/encoding to
the other occurrence that mirrors the trimmed.startsWith("TOKEN:") handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7d38f12d-c2f8-49b7-b841-151886ee0473
📒 Files selected for processing (2)
bin/lib/onboard.jstest/onboard.test.js
✅ Files skipped from review due to trivial changes (1)
- test/onboard.test.js
f8d26ba to
2f23450
Compare
|
Rebased on latest main. Addressed the CodeRabbit review: token is now trimmed and URL-encoded via encodeURIComponent before being interpolated into the dashboard URL fragment. All onboard tests pass. @kjw3 ready for another look! |
|
Nice approach reusing the One thing worth a look: the |
2f23450 to
82550fe
Compare
|
Good call @roselijack, reduced the timeout from 30s to 10s. Token retrieval is best-effort so no reason to block the summary step that long. All onboard tests pass. @kjw3 ready for review! |
82550fe to
44ee1fd
Compare
|
Rebased on latest main . Merged upstream's nimContainer param into printDashboard and picked up the new setupInference credential tests. All 360 tests pass. @kjw3 ready for review! |
|
@deepujain just one issue flagged (log failure to delete the script please), and rebase latest. Looks good otherwise. |
3a1cf34 to
8f73874
Compare
|
Rebased on latest main. Added error logging when temp script cleanup fails (per @brandonpelfrey's feedback). All tests pass. Ready for review! |
8f73874 to
366b01b
Compare
|
Rebased on latest main , 2/3 times in last few minutes. Commits are landing left and right on main :) |
366b01b to
e6a41e5
Compare
|
rebased again to solve one more conflict. |
…IDIA#53) Retrieve gateway auth token from the sandbox via openshell sandbox connect (matching the existing setupOpenclaw pattern) instead of a direct SSH session with StrictHostKeyChecking=no. The token is read from openclaw.json inside the sandbox using a piped script, then appended to the dashboard URL in the onboarding summary so users can log in immediately. Add parseTokenFromOutput helper and unit tests. Fixes NVIDIA#53 Signed-off-by: Deepak Jain <deepujain@gmail.com>
e6a41e5 to
69aa9d2
Compare
|
I've seen #906 from other reviewer has resolved this @deepujain . I'm closing this PR, please reopen if you have a comment. Thank you for your time. We're trying to make sure we avoid this duplicate effort going forward. |
Summary
Fixes #53. After onboarding completes, the installer showed the dashboard URL without the gateway token, so users could not log in. This change retrieves the token from the sandbox via
openclaw dashboard --no-openover SSH and appends it to the dashboard URL in the completion summary.Changes
parseDashboardUrlFromOutput(output): pure helper that parses the dashboard URL with#token=from openclaw dashboard output; normalizes127.0.0.1tolocalhost. Exported for unit tests.getDashboardUrlWithToken(sandboxName): gets SSH config viaopenshell sandbox ssh-config, runsopenclaw dashboard --no-openinside the sandbox via SSH, usesparseDashboardUrlFromOutputon the output, and returns the URL ornull. Uses a temp config file and cleans up; returnsnullon any failure.printDashboard()to callgetDashboardUrlWithToken(sandboxName)and display the URL with token when available; otherwise falls back tohttp://localhost:18789/.parseDashboardUrlFromOutput— returns URL with token when output contains it, normalizes 127.0.0.1 to localhost, returns null when no token URL or empty/non-string input.The model identifier and the rest of the summary output are unchanged.
Testing
npm testpasses (44 tests, including 5 new forparseDashboardUrlFromOutput)../install.shthrough onboarding; the final Dashboard line should show a URL with#token=...when the sandbox is reachable via SSH.Fixes #53
Summary by CodeRabbit
New Features
Tests