Skip to content

fix(cli): point OpenShell commands to openshell#3447

Merged
cv merged 6 commits into
NVIDIA:mainfrom
nvshaxie:fix/openshell-command-hints-3388
May 25, 2026
Merged

fix(cli): point OpenShell commands to openshell#3447
cv merged 6 commits into
NVIDIA:mainfrom
nvshaxie:fix/openshell-command-hints-3388

Conversation

@nvshaxie

@nvshaxie nvshaxie commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Point OpenShell-only command shapes such as nemoclaw term, nemoclaw policy set, and nemoclaw gateway stop to the corresponding openshell commands instead of suggesting sandbox connect.
  • Treat oclif failed flag validation as a handled parse error so nemoclaw inference set no longer prints a raw stack trace.

Fixes #3388.

Test plan

  • npm install --ignore-scripts
  • npm run build:cli
  • nemoclaw term; echo "EXIT=$?"
  • nemoclaw inference set; echo "EXIT=$?"
  • nemoclaw policy set; echo "EXIT=$?"
  • nemoclaw gateway stop; echo "EXIT=$?"
  • npx vitest run test/cli.test.ts -t "OpenShell-only|validation failures|unknown command with non-sandbox action|suggests list"

Summary by CodeRabbit

  • New Features

    • Added OpenShell-specific unknown-command guidance for certain commands (e.g., term, policy set, gateway stop).
  • Bug Fixes

    • Enhanced CLI error validation to correctly detect and report invalid flag/parse errors without exposing internal traces.
  • Tests

    • Added regression tests for CLI dispatch behavior and OpenShell command handling.

Review Change Stack

Signed-off-by: Shawn Xie shaxie@nvidia.com

Clarify misrouted OpenShell command errors and suppress raw oclif validation stacks so users get actionable CLI guidance.
@copy-pr-bot

copy-pr-bot Bot commented May 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 20d788a4-6c2a-4b17-934f-3dd2766345db

📥 Commits

Reviewing files that changed from the base of the PR and between f70872f and 363b6b5.

📒 Files selected for processing (3)
  • src/lib/cli/oclif-runner.ts
  • src/lib/cli/public-dispatch.ts
  • test/cli.test.ts
💤 Files with no reviewable changes (1)
  • test/cli.test.ts

📝 Walkthrough

Walkthrough

The PR adds OpenShell command hinting to the NemoClaw CLI dispatcher. When users invoke OpenShell-only commands (term, policy set, gateway stop) through nemoclaw, the system now detects the pattern and prints targeted guidance pointing to the correct openshell ... invocation instead of generic NemoClaw sandbox suggestions. Supporting changes include improved oclif parse-error detection for flag-validation failures and regression tests validating the messaging.

Changes

OpenShell Command Detection and Error Routing

Layer / File(s) Summary
OpenShell hint detection and dispatcher integration
src/lib/cli/public-dispatch.ts
New OpenShellCommandHint type and helper functions map argv patterns (term, policy set, gateway stop) to openshell command guidance; hint generation is integrated into the dispatcher's unknown-command path to emit targeted error messages and exit.
Parse error detection for oclif validation
src/lib/cli/oclif-runner.ts
isOclifParseError is extended to recognize FailedFlagValidationError constructor name alongside existing checks, enabling clean flag-validation error output without stack traces or internal error identifiers.
CLI regression tests
test/cli.test.ts
Two new tests assert that OpenShell-only commands produce error output routing to openshell ... (not nemoclaw <sandbox> connect) and that oclif flag-validation failures for inference set emit clean missing-flag errors and exit with code 2.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • ericksoa

Poem

🐰 I nibble code and hop in tune,
Guiding users to openshell soon.
When nemo strays from where it ought,
I point the path that help had taught.
Run openshell — the shortcut boon!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.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 'fix(cli): point OpenShell commands to openshell' directly and clearly summarizes the main change—redirecting OpenShell-only command hints from 'nemoclaw connect' to proper 'openshell' invocations.
Linked Issues check ✅ Passed The pull request fully addresses all coding requirements from issue #3388: routing OpenShell commands to correct openshell invocations, treating oclif validation failures as parse errors to eliminate stack traces, and providing non-zero exit codes with clear actionable guidance.
Out of Scope Changes check ✅ Passed All changes in the pull request are directly scoped to addressing issue #3388: oclif error handler improvements, OpenShell hint detection and routing, and regression tests validating the new behavior.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

@wscurran

Copy link
Copy Markdown
Contributor

@nvshaxie nvshaxie requested review from cv and ericksoa May 18, 2026 04:00
ericksoa and others added 5 commits May 17, 2026 21:36
Resolutions:
- src/lib/cli/oclif-runner.ts: union both sides — keep
  FailedFlagValidationError (this PR) alongside RequiredArgsError +
  'Parsing --' message check added on main.
- src/nemoclaw.ts: take main's slimmed-down 16-line shim; port the
  OpenShell command-hint logic to src/lib/cli/public-dispatch.ts where
  dispatch now lives. Hint runs before recovery so bare 'nemoclaw term'
  isn't swallowed by the 'Sandbox does not exist' error path.

Tested: full test/cli.test.ts (159/159 passing) including the
NVIDIA#3447 OpenShell-hint and validation-failure tests.

Signed-off-by: Shawn Xie <shaxie@nvidia.com>
… term' isn't swallowed

The hint was placed AFTER recoverRequestedSandboxIfNeeded(), so for
'nemoclaw term' (which normalizes to sandboxName='term', action='connect'
— a known sandbox action), recovery walks the full not-found path and
prints "Sandbox 'term' does not exist" before the hint can fire.

Moving the check above recovery — with the &&!registry().getSandbox(cmd)
guard so real sandboxes named e.g. 'term' still work — lets the OpenShell
hint print as the test expected. cli.test.ts now passes locally.

Signed-off-by: Shawn Xie <shaxie@nvidia.com>
@cv cv merged commit 50c208b into NVIDIA:main May 25, 2026
21 checks passed
@cv cv added the v0.0.51 Release target label May 25, 2026
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression and removed NemoClaw CLI labels Jun 3, 2026
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 area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression v0.0.51 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ubuntu 24.04][CLI&UX] nemoclaw <openshell-op> error suggests connect instead of naming openshell cmd

4 participants