fix(cli): add --json flag to per-sandbox status command#4323
Conversation
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
E2E Scenario Advisor RecommendationRequired scenario E2E: Dispatch required scenario E2E:
Full scenario advisor summaryE2E Scenario AdvisorBase: Required scenario E2E
Optional scenario E2E
Relevant changed files
|
|
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds structured JSON output to per-sandbox ChangesPer-sandbox status JSON output support
Sequence DiagramsequenceDiagram
participant CLI
participant SandboxStatusCommand
participant StatusLib
participant Gateway
participant OpenShell
participant Registry
CLI->>SandboxStatusCommand: nemoclaw <name> status --json
SandboxStatusCommand->>StatusLib: getSandboxStatusReport(name)
StatusLib->>Gateway: reconcile gateway state
Gateway-->>StatusLib: gatewayState / gateway metadata
alt gateway present
StatusLib->>OpenShell: inference.get() probe
OpenShell-->>StatusLib: inference output or rpcIssue
StatusLib->>Registry: lookup model/provider fallback
Registry-->>StatusLib: registry metadata
end
StatusLib-->>SandboxStatusCommand: SandboxStatusReport
SandboxStatusCommand->>CLI: emit JSON (redacted) and set exitCode if found=false or gatewayState != "present" or rpcIssue present
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 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 docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
PR Review AdvisorFindings: 1 needs attention, 5 worth checking, 0 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Since last review detailsCurrent findings:
This is an automated advisory review. A human maintainer must make the final merge decision. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@test/cli.test.ts`:
- Around line 946-1045: Add assertions to check the process exit code for both
JSON sandbox-status tests: after the runWithEnv call in the "sandbox status
--json emits structured per-sandbox report" test (the const r = runWithEnv(...)
line) add expect(r.code).toBe(0), and do the same in the "sandbox status --json
defaults openshell driver/version to 'unknown' strings" test right after its
runWithEnv invocation; this ensures the command both prints valid JSON and exits
successfully.
🪄 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: e9cd54a5-ef41-46f1-b540-4675572797e3
📒 Files selected for processing (3)
src/commands/sandbox/status.tssrc/lib/actions/sandbox/status.tstest/cli.test.ts
Selective E2E Results — ✅ All requested jobs passedRun: 26521718076
|
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
|
🌿 Preview your docs: https://nvidia-preview-pr-4323.docs.buildwithfern.com/nemoclaw |
Selective E2E Results — ✅ All requested jobs passedRun: 26523240116
|
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Selective E2E Results — ✅ All requested jobs passedRun: 26525838187
|
…ontracts Address PR Review Advisor findings on #4323: - Route SandboxStatusReport through redactForLog before returning to oclif's enableJsonFlag serializer, so inferenceHealth.endpoint, .detail, and nested subprobes cannot leak token-shaped values into automation that persists CLI JSON output. Reuses the centralized source-of-truth in src/lib/security/redact.ts. - Add JSON regression tests pinning two previously untested negative paths consumers depend on: * canonical 'sandbox status <unknown> --json' emits found:false, gatewayState != present, exit code 1 * 'sandbox status <known> --json' with a NotFound gateway lookup emits found:true, gatewayState != present, inferenceHealth=null, falls back to registry model/provider, exit code 1 Refs #4310 Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
## Summary - Adds the v0.0.56 release notes section with links to the deeper docs pages for installer, status, inference, messaging, policy, and lifecycle changes. - Updates source docs for the remaining release-prep gaps around `uv` in the PyPI preset, compact WhatsApp pairing guidance, and `nemoclaw inference set` command boundaries. - Refreshes generated `nemoclaw-user-*` skills and removes skipped experimental command terms from generated skill surfaces. ## Source summary - #4613 -> `docs/manage-sandboxes/lifecycle.mdx`, `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Documents that public installs and `nemoclaw update` follow the maintained `lkg` tag by default. - #4419 -> `docs/about/release-notes.mdx`: Notes that non-interactive Linux installs can reactivate Docker group membership and continue in one installer run when `sg docker` is available. - #4550 -> `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Captures live sandbox agent-version probing for status, connect, and upgrade checks. - #4609 -> `docs/inference/use-local-inference.mdx`, `docs/about/release-notes.mdx`: Captures the GPU Docker-driver host-network local-inference reachability gate. - #4607 -> `docs/manage-sandboxes/messaging-channels.mdx`, `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Documents compact WhatsApp QR pairing guidance and gateway/session diagnostics. - #4582 -> `docs/manage-sandboxes/messaging-channels.mdx`, `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Reflects Slack credential validation before enabling the channel. - #4554 -> `docs/manage-sandboxes/messaging-channels.mdx`, `docs/reference/troubleshooting.mdx`, `docs/about/release-notes.mdx`: Keeps Telegram allowlist alias guidance in the generated user skills and release notes. - #4563 -> `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Includes the new `nemoclaw <name> skill remove <skill>` command in command docs and release notes. - #4566 -> `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Documents the `nemoclaw inference set` redirect boundary when `--provider` or `--model` is missing. - #4323 -> `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Captures per-sandbox status JSON support. - #4506 -> `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Captures debug command sandbox-name validation and safer tarball writing. - #4569 -> `docs/network-policy/integration-policy-examples.mdx`, `docs/about/release-notes.mdx`: Documents that the `pypi` preset allows `/usr/local/bin/uv`. - #4579 -> `docs/network-policy/integration-policy-examples.mdx`, `docs/about/release-notes.mdx`: Captures observable Jira preset validation guidance. - #4229 -> `docs/manage-sandboxes/lifecycle.mdx`, `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Documents user-data preservation defaults for uninstall. - #4399 -> `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Captures CPU-only sandbox intent preservation across rebuilds. - #4058 -> `docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Captures safer snapshot restore behavior around existing destinations. - #4155 and #4460 -> skipped by `docs/.docs-skip`: Removed skipped experimental command terms from source docs and generated skill evals instead of documenting those features. ## Verification - `python3 scripts/docs-to-skills.py docs/ .agents/skills/ --prefix nemoclaw-user --doc-platform fern-mdx` - `npm run docs` (passes; Fern reports the pre-existing light-mode accent contrast warning) - `rg "permissive mode|shields down|shields up|shields status|config rotate-token|rotate-token" .agents/skills` (no matches) - `npm run build:cli` (run to refresh local CLI artifacts for the pre-push TypeScript hook) - Commit hooks passed, including `NEMOCLAW_* env-var documentation gate`, `Verify docs-to-skills output`, `markdownlint-cli2`, `gitleaks`, and `Test (skills YAML)`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Expanded Model Router setup with YAML examples, flow diagrams, and credential handling; strengthened agent-config immutability and integrity guidance; messaging channels updated (Telegram aliases, WhatsApp pairing/diagnostics); CLI docs revised (GPU detection, inference set behavior, uninstall/rebuild preservation); overview rebranded to NemoClaw and added v0.0.56 release notes. * **New Features** * Added `nemoclaw <name> channels status` (messaging diagnostics, JSON); added `nemoclaw <name> skill remove`; Hermes no longer marked experimental; DGX Spark quickstart sandbox-name note. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
nemoclaw <name> statusnow accepts--jsonand emits a structured per-sandbox report, mirroring what the globalnemoclaw status --json(added in #2790 / #2822) already exposes. Automation can readhostGpuDetected,sandboxGpuEnabled,sandboxGpuMode,sandboxGpuDevice,openshellDriver, andopenshellVersionfor a specific sandbox without scraping the text renderer.Related Issue
Fixes #4310. Enhances #2790 (resolved by #2822) by extending the JSON renderer to the per-sandbox status variant.
Changes
src/commands/sandbox/status.tsopts intostatic enableJsonFlag = true, updates the usage/examples to advertise--json, and branches onthis.jsonEnabled()so the existing text path is unchanged.getSandboxStatusReport(sandboxName)insrc/lib/actions/sandbox/status.tsreturns aSandboxStatusReport:schemaVersion,name,found,model,provider,phase,gatewayState,inferenceHealth,hostGpuDetected,sandboxGpuEnabled,sandboxGpuMode,sandboxGpuDevice,openshellDriver,openshellVersion,policies.openshellDriverandopenshellVersionare normalised to the string"unknown"when missing so consumers can rely ontypeofchecks.process.exitCode = 1when the sandbox is missing locally or the gateway state is notpresent, so scripts can distinguish "ready" from "drift/unreachable" without parsing the body.test/cli.test.tscovers the populated JSON shape, the"unknown"string fallback foropenshellDriver/openshellVersion, the protobuf-mismatch path (asserts exit code1,rpcIssue = { kind: "protobuf_mismatch" },inferenceHealth = null, andmodel/provider="unknown"), and the--helpadvertising--json.collectSandboxStatusSnapshotis shared byshowSandboxStatusandgetSandboxStatusReport; it fail-closes ondetectOpenShellStateRpcResultIssueso the JSON path no longer emits inferredmodel/provider/inferenceHealthalongside anrpcIssue. The host-side gateway-chain subprobe is appended in the collector so both text and JSON paths surface it.docs/reference/commands.mdxdocuments the--jsonflag in the per-sandbox status section (fields, fallback, exit-code contract) so the CLI/docs parity check stays green.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Signed-off-by: Tinson Lai tinsonl@nvidia.com
Summary by CodeRabbit
New Features
sandbox statusgains a--jsonmode that emits a structured per-sandbox JSON report (gateway state, inference health, GPU details, policies, model/provider, OpenShell driver/version).Behavior
openshellDriver/openshellVersiondefault to"unknown"when unset.--jsonreturns structured data and sets non‑zero exit codes for missing sandbox, non‑present gateway, or RPC/schema issues; text output unchanged without--json.Tests
Documentation
--jsonbehavior, fields, exit conditions, and examples.