Skip to content

feat(cli): add connection info command to reprint the connection block#7478

Open
laitingsheng wants to merge 1 commit into
mainfrom
feat/connection-info-command
Open

feat(cli): add connection info command to reprint the connection block#7478
laitingsheng wants to merge 1 commit into
mainfrom
feat/connection-info-command

Conversation

@laitingsheng

@laitingsheng laitingsheng commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a read-only nemoclaw <name> connection info command that reprints the connection block onboarding shows at the end of setup — the dashboard URL, terminal connect command, and management commands — so a user who scrolls past it can recover the details without onboarding again. Before this change no supported command reprinted that block; show-connection-info fell through to the Unknown action path.

Related Issue

Resolves #7473

Changes

  • Add the sandbox:connection:info oclif command (nemoclaw <name> connection info). It routes through the existing public sandbox-action grammar and auto-registers as a valid action from its command metadata, mirroring the nested gateway restart command.
  • Add runConnectionInfoCommand, which resolves the sandbox registry entry (model, provider, agent) and reprints the block from live state: OpenClaw and other dashboard agents reuse the onboarding renderer, terminal-runtime agents print their connect and run commands, and a stopped OpenClaw sandbox reports an honest "not running" message instead of a half-rendered block.
  • Export printDashboard from onboard so the command reuses the exact onboarding renderer rather than duplicating it and drifting. The current and only new consumer is this command; src/lib/connection-info-command.test.ts protects the wiring.
  • Add a public display-metadata entry for the new command and a reference section under docs/reference/commands.mdx.
  • Update the command-registry contract test for the new action token and command counts.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification:
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: the change is additive and read-only. The new command reprints existing onboarding output; the only onboarding-code edit exports the existing printDashboard renderer with no behaviour change; no credential, policy, gateway, or state mutation occurs. Pending maintainer sensitive-path review.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: docs-updated
  • Evidence: docs/reference/commands.mdx (new connection info reference section). Writer-review findings applied: split the security warning into one instruction per sentence, and scoped the description by agent runtime (dashboard agents show the browser URL; terminal-runtime agents show connect and run commands). npm run docs reported 0 errors (2 pre-existing repo-wide warnings unrelated to this change).
  • Agent: Claude Code

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result: npx vitest run src/lib/connection-info-command.test.ts src/lib/cli/connection-info-route.test.ts → 8 passed; npx vitest run test/package-contract/cli/command-registry.test.ts → passed; npm run typecheck:cli → 0 errors
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Tinson Lai tinsonl@nvidia.com

Summary by CodeRabbit

  • New Features

    • Added nemoclaw <name> connection info to reprint connection details for a running sandbox.
    • Displays dashboard and terminal connection commands based on the sandbox runtime.
    • Added guidance when the sandbox is unavailable or connection credentials cannot be retrieved.
    • Included a security warning for OpenClaw dashboard URLs, which should be treated as secrets.
  • Documentation

    • Added CLI reference documentation for the new command, including its read-only behavior.

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds nemoclaw <name> connection info, which retrieves sandbox state and reprints dashboard or terminal connection details. The command includes runtime wiring, error handling, public CLI registration, tests, exported dashboard rendering, and reference documentation.

Changes

Connection info flow

Layer / File(s) Summary
Connection info resolution and rendering
src/lib/connection-info-command.ts, src/lib/connection-info-command.test.ts
Resolves sandbox and agent definitions, handles gateway token failures, renders dashboard or terminal connection blocks, and validates the command flow across runtime scenarios.
CLI exposure and public command registration
src/commands/sandbox/connection/info.ts, src/lib/onboard.ts, src/lib/cli/*, test/package-contract/cli/command-registry.test.ts
Adds the oclif command, wires runtime dependencies, exports printDashboard, registers public routing and display metadata, and updates command-count expectations.
Command usage documentation
docs/reference/commands.mdx
Documents dashboard and terminal output, read-only behavior, stopped-sandbox guidance, and the OpenClaw dashboard URL warning.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: cv, ericksoa, dongni-yang

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ConnectionInfoCliCommand
  participant runConnectionInfoCommand
  participant SandboxRegistry
  participant GatewayToken
  participant printDashboard
  User->>ConnectionInfoCliCommand: run connection info
  ConnectionInfoCliCommand->>runConnectionInfoCommand: pass sandbox name and runtime bridge
  runConnectionInfoCommand->>SandboxRegistry: retrieve sandbox state
  runConnectionInfoCommand->>GatewayToken: fetch token for dashboard runtime
  runConnectionInfoCommand->>printDashboard: render connection block
  printDashboard-->>User: display dashboard and management commands
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly names the new connection info CLI command and its purpose of reprinting the connection block.
Linked Issues check ✅ Passed The new command, docs, tests, and registry updates implement the requested supported reprint of the onboarding connection block.
Out of Scope Changes check ✅ Passed The changes stay focused on the connection-info command, its docs, tests, and supporting registry/display wiring.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/connection-info-command

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit a3504c8 in the feat/connection-info... branch remains at 96%, unchanged from commit 46ecb86 in the main branch.

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Blocking findings reported

Advisor assessment: Blockers require maintainer review
Next action: Review the blockers below.
Findings: 1 blocker · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 1 blocker · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings differ; normalized E2E selections differ; Nemotron reported 1 fewer blocker, the same number of warnings, the same number of suggestions.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: onboard-repair, onboard-resume, cloud-onboard

1 optional E2E recommendation
  • sandbox-operations

Blockers

PRA-1 Blocker — Check runtime state before printing non-OpenClaw connection details

  • Location: src/lib/connection-info-command.ts:96
  • Category: correctness
  • Problem: The terminal-agent branch returns connection instructions after only a registry lookup. Other non-OpenClaw agents also call `printDashboard` without a runtime check. A stopped or stale registered sandbox can therefore receive connection details although the command documentation says it fails when the sandbox is not running.
  • Impact: Users can receive a connect or dashboard block for a sandbox that is not running. This contradicts the documented command contract and can misrepresent lifecycle state.
  • Fix: Use an existing runtime-readiness probe for every agent branch before rendering the connection block. Return the same status guidance when the sandbox is not running.
  • Verification: With a registered stopped terminal-agent sandbox and a registered stopped dashboard-agent sandbox, inspect command output and confirm both fail before printing connection instructions.
  • Test coverage: Add unit coverage for stopped terminal and non-OpenClaw dashboard agents. Assert that neither calls `printDashboard` or logs a terminal block and both return the documented status guidance.
  • Evidence: `runConnectionInfoCommand` returns for terminal agents at src/lib/connection-info-command.ts:94-98 before any token or runtime probe. For non-terminal non-OpenClaw agents, src/lib/connection-info-command.ts:101-112 directly calls `printDashboard` without a runtime check. docs/reference/commands.mdx states that if the sandbox is not running, the command reports that it could not read connection details and points to `status`.

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@laitingsheng laitingsheng added NV QA Bugs found by the NVIDIA QA Team area: cli Command line interface, flags, terminal UX, or output feature PR adds or expands user-visible functionality labels Jul 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lib/connection-info-command.ts (1)

45-49: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Do not silently relabel dependency failures as missing sandbox metadata.

These catch-all fallbacks turn registry/agent-loading failures into either “sandbox does not exist” or an OpenClaw-style dashboard path, hiding the actionable error.

  • src/lib/connection-info-command.ts#L45-L49: let unexpected loadAgent failures propagate; its declared null result already represents an unknown agent.
  • src/lib/connection-info-command.ts#L74-L79: do not convert a registry failure into a nonexistent sandbox.
  • src/commands/sandbox/connection/info.ts#L44-L50: remove the duplicate registry-error fallback.

Based on learnings, avoid defensive catch-and-fallback handling around internal helpers without an actionable recovery path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/connection-info-command.ts` around lines 45 - 49, Remove catch-all
registry-error fallbacks around the connection-info flow: in
src/lib/connection-info-command.ts lines 45-49, let unexpected loadAgent
failures propagate while preserving its null result for unknown agents; in lines
74-79, stop converting registry failures into nonexistent-sandbox results; and
in src/commands/sandbox/connection/info.ts lines 44-50, remove the duplicate
registry-error fallback.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/connection-info-command.test.ts`:
- Around line 14-15: Update the parent suite title in
src/lib/connection-info-command.test.ts at lines 14-15 and
src/lib/cli/connection-info-route.test.ts at lines 9-10 to include the final
issue suffix (`#7473`). In test/package-contract/cli/command-registry.test.ts at
lines 59-60 and 229-231, replace the count-only test titles with
behavior-oriented descriptions of connection-info registration and the
connection action token, respectively, and append (`#7473`) as the final suffix.

In `@src/lib/connection-info-command.ts`:
- Around line 90-92: Update the terminal-agent branch in the connection-info
command so it includes the shared management-command section before returning,
while preserving the existing terminal connection instructions. Reuse the
existing management-section helper or rendering path rather than duplicating its
content.

---

Nitpick comments:
In `@src/lib/connection-info-command.ts`:
- Around line 45-49: Remove catch-all registry-error fallbacks around the
connection-info flow: in src/lib/connection-info-command.ts lines 45-49, let
unexpected loadAgent failures propagate while preserving its null result for
unknown agents; in lines 74-79, stop converting registry failures into
nonexistent-sandbox results; and in src/commands/sandbox/connection/info.ts
lines 44-50, remove the duplicate registry-error fallback.
🪄 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: Enterprise

Run ID: 34bb96c9-4e7b-42cd-a139-bec0a3376288

📥 Commits

Reviewing files that changed from the base of the PR and between 46ecb86 and a3504c8.

📒 Files selected for processing (8)
  • docs/reference/commands.mdx
  • src/commands/sandbox/connection/info.ts
  • src/lib/cli/connection-info-route.test.ts
  • src/lib/cli/public-display-defaults.ts
  • src/lib/connection-info-command.test.ts
  • src/lib/connection-info-command.ts
  • src/lib/onboard.ts
  • test/package-contract/cli/command-registry.test.ts

Comment on lines +14 to +15
describe("connection info command", () => {
it("reprints the connection block for a running OpenClaw sandbox", () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add behavior-oriented, issue-linked test titles.

Issue #7473 is known, but these new tests lack its required final suffix.

As per coding guidelines, “Tests must use behavior-oriented titles and put local issue references in a final (#1234) suffix.”

📍 Affects 3 files
  • src/lib/connection-info-command.test.ts#L14-L15 (this comment)
  • src/lib/cli/connection-info-route.test.ts#L9-L10
  • test/package-contract/cli/command-registry.test.ts#L59-L60
  • test/package-contract/cli/command-registry.test.ts#L229-L231
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/connection-info-command.test.ts` around lines 14 - 15, Update the
parent suite title in src/lib/connection-info-command.test.ts at lines 14-15 and
src/lib/cli/connection-info-route.test.ts at lines 9-10 to include the final
issue suffix (`#7473`). In test/package-contract/cli/command-registry.test.ts at
lines 59-60 and 229-231, replace the count-only test titles with
behavior-oriented descriptions of connection-info registration and the
connection action token, respectively, and append (`#7473`) as the final suffix.

Source: Coding guidelines

Comment on lines +90 to +92
if (agent && deps.isTerminalAgent(agent)) {
printTerminalConnectionBlock(sandboxName, agent, deps.log);
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Include management commands for terminal agents.

This early return emits only terminal-connect instructions, so terminal runtimes never receive the required management-command portion of the connection block. Reuse or append the shared management section before returning.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/connection-info-command.ts` around lines 90 - 92, Update the
terminal-agent branch in the connection-info command so it includes the shared
management-command section before returning, while preserving the existing
terminal connection instructions. Reuse the existing management-section helper
or rendering path rather than duplicating its content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output feature PR adds or expands user-visible functionality NV QA Bugs found by the NVIDIA QA Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[All Platforms][CLI&UX] no command reprints the "OpenClaw is ready" connection block after onboarding

1 participant