Skip to content

refactor(cli): prune dead code and harden onboarding#3632

Merged
cv merged 14 commits into
mainfrom
refactor/delete-unused-code
May 16, 2026
Merged

refactor(cli): prune dead code and harden onboarding#3632
cv merged 14 commits into
mainfrom
refactor/delete-unused-code

Conversation

@cv

@cv cv commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Prunes unused CLI and onboarding code after the TypeScript migration, removes obsolete migration scaffolding, and keeps the command/test surface aligned with current oclif-owned behavior. The PR also preserves the active onboarding behavior by tightening sandbox GPU device selection so device selectors require explicit GPU enablement and do not create disabled-mode drift.

Changes

  • Removed unused compatibility imports, exports, helper functions, and dead modules from src/nemoclaw.ts, src/lib/onboard.ts, runtime recovery, Docker adapters, credentials, dashboard helpers, inference helpers, and command modules.
  • Deleted obsolete post-migration tooling: legacy-path CI workflow, TS migration guard, assist/bulk-fix scripts, move map, and guard tests.
  • Removed unused package dependencies: root execa devDependency and plugin commander dependency.
  • Restored and improved the source-shape test scanner so it catches assert.* source-text assertions while avoiding fixture false positives.
  • Split onboarding helper coverage into focused modules/tests for credential hydration, dashboard ports, sandbox GPU mode, summaries, providers, Dockerfile patching, gateway runtime, messaging, model-router, policy suggestions, and OpenShell version handling.
  • Tightened sandbox GPU device selection: --sandbox-gpu-device / NEMOCLAW_SANDBOX_GPU_DEVICE now requires explicit sandbox GPU mode 1, and disabled GPU configs clear the recorded device to avoid drift.
  • Updated command docs/help text for the explicit sandbox GPU device requirement.

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)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make 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: Carlos Villela cvillela@nvidia.com

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv self-assigned this May 15, 2026
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Removes legacy onboarding/dashboard recovery and migration tooling, relocates GPU/credential helpers, slims CLI/debug contracts, prunes scripts/package deps, and adds many onboarding utilities and tests.

Changes

Onboarding and repository cleanup

Layer / File(s) Summary
Scripts, migration tooling, package edits
scripts/*, .github/workflows/*, package.json, nemoclaw/package.json
Removes ts-migration assist/bulk/guard scripts, legacy-path guard workflow, move-map, and trims dev/runtime deps and related script entries.
Onboard core refactor
src/lib/onboard.ts, src/lib/onboard/*
Deletes legacy policy-preset and dashboard wrapper helpers, rehomes GPU and credential helpers, updates dashboard /health semantics, and adjusts module exports.
New onboarding helpers & tests
src/lib/onboard/credential-env.ts, src/lib/onboard/sandbox-gpu-mode.ts, src/lib/onboard/summary.ts, src/lib/onboard/dashboard-port.ts, test/onboard-*.test.ts, test/onboard-messaging.test.ts, test/onboard-model-router.test.ts
Adds hydrateCredentialEnv, sandbox GPU config/types, onboarding summary formatting, dashboard-port utilities, and extensive onboarding-focused tests.
Dashboard health/recover removal
src/lib/dashboard/*
Removes dashboard/health and dashboard/recover modules and their tests, deleting verify/recover public APIs and types.
CLI entrypoint & debug command
src/nemoclaw.ts, src/lib/diagnostics/debug-command.ts, src/lib/diagnostics/debug-command.test.ts
Slims CLI front controller imports, removes in-file compatibility helpers, narrows debug-command deps and exposes runDebugCommandWithOptions; adjusts tests accordingly.
Credentials & inference/base-image API changes
src/lib/credentials/store.ts, src/lib/inference/*, src/lib/sandbox-base-image.ts
Removes gh-based helpers (isRepoPrivate, ensureGithubToken), drops convenience inference wrappers/exports, and replaces Hermes base-image helper with Openclaw helper.
Runtime recovery refactor
src/lib/runtime-recovery.ts, src/lib/runtime-recovery.test.ts
Refactors runtime-recovery to classification helpers, adds shouldAttemptGatewayRecovery, removes getRecoveryCommand, and simplifies tests.
Tests & import tidy-ups
test/*, src/*
Removes chat-filter module/tests, adjusts many test imports, renames unused params to _, and removes small exported aliases and unused imports across modules.
Misc small tweaks
assorted scripts/*, src/lib/*
Minor edits: narrow node:path imports, remove unused color constant, rename unused replace callback param to _match, and remove minor exported aliases and test helpers.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

refactor, NemoClaw CLI, v0.0.44

Suggested reviewers

  • jyaunches
  • ericksoa
  • cjagwani

"I am a rabbit in the code, so spry,
Hopped through helpers, gave few a nudge, hi!
Trimmed the vines and seeded tests anew,
Watch the onboarding bloom, tidy and true.
🐇🌿"

✨ 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 refactor/delete-unused-code

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: cloud-onboard-e2e, sandbox-operations-e2e, inference-routing-e2e, network-policy-e2e, credential-migration-e2e, gpu-e2e
Optional E2E: cloud-inference-e2e, diagnostics-e2e, device-auth-health-e2e, onboard-resume-e2e, credential-sanitization-e2e, gpu-double-onboard-e2e, launchable-smoke-e2e

Dispatch hint: cloud-onboard-e2e,sandbox-operations-e2e,inference-routing-e2e,network-policy-e2e,credential-migration-e2e,gpu-e2e

Auto-dispatched E2E: cloud-onboard-e2e, sandbox-operations-e2e, inference-routing-e2e, network-policy-e2e, credential-migration-e2e, gpu-e2e via nightly-e2e.yaml at 56ca37c517a8eb54181b1765b57dc230edc3f445nightly run

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • cloud-onboard-e2e (high): Required because onboard orchestration, package manifests, provider selection, Dockerfile staging, policy presets, OpenShell version/preflight behavior, and public install/onboard paths changed.
  • sandbox-operations-e2e (high): Required because sandbox lifecycle, Docker inspect, sandbox config/hosts commands, create streams, session state, and multi-sandbox isolation-adjacent code changed.
  • inference-routing-e2e (medium): Required because NIM/vLLM/local inference configuration, onboard probes, URL validation, and model-router behavior changed; this validates inference.local routing and endpoint error handling.
  • network-policy-e2e (medium): Required because policy channel, initial policy, DNS monkeypatch, shields, and chat filtering changes can alter network/security boundaries.
  • credential-migration-e2e (medium): Required because credential store and credential environment propagation changed; this exercises legacy migration, secure deletion, allowlisting, and OpenShell credential handoff.
  • gpu-e2e (high): Required because sandbox GPU mode/device selector behavior and Docker-driver GPU passthrough code changed; only the GPU E2E validates real GPU-host sandbox creation and local inference.

Optional E2E

  • cloud-inference-e2e (medium): Useful additional confidence for live cloud inference after changes to provider validation, NIM/vLLM routing, and onboard probes.
  • diagnostics-e2e (medium): Useful because debug command and diagnostics modules changed; validates real sandbox config and credential listing support flows.
  • device-auth-health-e2e (medium): Useful because dashboard health/recover and gateway recovery code changed; exercises auth health and port-forward liveness on a running sandbox.
  • onboard-resume-e2e (medium): Useful because onboard session state and custom Dockerfile/from-path conflict handling are adjacent to changed onboarding files.
  • credential-sanitization-e2e (medium): Useful extra security confidence for secret redaction and credential exposure changes beyond migration coverage.
  • gpu-double-onboard-e2e (high): Useful if GPU capacity is available because GPU selector/mode changes may affect re-onboard consistency on GPU hosts.
  • launchable-smoke-e2e (medium): Useful because package manifests and install-related files changed; validates the community launchable install path without blocking merge if required onboarding E2E passes.

New E2E recommendations

  • GPU device selector validation (medium): The PR changes semantics so GPU device selectors require explicit sandbox GPU enablement. Existing GPU E2E likely covers general GPU onboarding but may not explicitly assert rejection of device selectors without --sandbox-gpu/NEMOCLAW_SANDBOX_GPU=1 in a real OpenShell create path.
    • Suggested test: Add an E2E scenario that attempts non-interactive onboarding with NEMOCLAW_SANDBOX_GPU_DEVICE set and sandbox GPU left auto/disabled, asserts a clear rejection, then reruns with explicit sandbox GPU enablement and verifies --gpu-device reaches openshell sandbox create on a GPU runner.
  • Legacy path guard deletion (low): The legacy-path-guard workflow was removed while guard tests/scripts remain changed. This is CI/tooling coverage rather than runtime E2E, but the repository should retain a non-E2E CI assertion that migrated legacy paths cannot be edited if that policy is still required.
    • Suggested test: Add or update a CI unit/integration test for scripts/check-legacy-migrated-paths.ts and move-map.json after deleting .github/workflows/legacy-path-guard.yaml, or document that the guard is intentionally retired.

Dispatch hint

  • Workflow: nightly-e2e.yaml
  • jobs input: cloud-onboard-e2e,sandbox-operations-e2e,inference-routing-e2e,network-policy-e2e,credential-migration-e2e,gpu-e2e

@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: 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 `@src/lib/onboard.ts`:
- Around line 8301-8303: The non-TTY tier listing printed by
allTiers.forEach(...) no longer shows numeric indices even though the prompt
expects "Select tier [1-N]"; update the loop in the same block (the
allTiers.forEach callback that references defaultTier, RADIO_ON, RADIO_OFF) to
include the index (use the forEach second parameter i or map with index) and
change the console.log to print the numeric label (i+1) alongside the marker and
t.label so redirected/non-TTY runs can match numbers to tiers.
🪄 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: df7fe4e2-5f2e-4966-a38c-047270bb31d1

📥 Commits

Reviewing files that changed from the base of the PR and between fdae301 and 5d246d3.

📒 Files selected for processing (26)
  • scripts/bump-version.ts
  • scripts/find-source-shape-tests.ts
  • scripts/ts-migration-assist.ts
  • scripts/validate-configs.ts
  • src/lib/actions/sandbox/policy-channel.ts
  • src/lib/actions/sandbox/vm-dns-monkeypatch.ts
  • src/lib/agent/onboard.ts
  • src/lib/cli/command-registry.test.ts
  • src/lib/deploy/index.ts
  • src/lib/inference/local.test.ts
  • src/lib/onboard.ts
  • src/lib/onboard/usage-notice.ts
  • src/lib/registry-recovery-action.ts
  • src/lib/sandbox/create-stream.ts
  • src/lib/shields/index.ts
  • src/lib/state/sandbox-session.test.ts
  • src/lib/tunnel/services-sandbox.test.ts
  • src/nemoclaw.ts
  • test/credential-exposure.test.ts
  • test/e2e/runtime/resolver/validator.ts
  • test/install-preflight.test.ts
  • test/onboard.test.ts
  • test/policies.test.ts
  • test/rebuild-policy-presets.test.ts
  • test/secret-redaction.test.ts
  • test/wait.test.ts
💤 Files with no reviewable changes (14)
  • src/lib/deploy/index.ts
  • src/lib/registry-recovery-action.ts
  • src/lib/actions/sandbox/policy-channel.ts
  • test/credential-exposure.test.ts
  • scripts/ts-migration-assist.ts
  • test/secret-redaction.test.ts
  • test/install-preflight.test.ts
  • src/lib/tunnel/services-sandbox.test.ts
  • src/lib/onboard/usage-notice.ts
  • src/lib/cli/command-registry.test.ts
  • test/onboard.test.ts
  • src/lib/state/sandbox-session.test.ts
  • test/policies.test.ts
  • scripts/bump-version.ts

Comment thread src/lib/onboard.ts
Comment on lines +8301 to 8303
allTiers.forEach((t) => {
const marker = t.name === defaultTier.name ? RADIO_ON : RADIO_OFF;
console.log(` ${marker} ${t.label}`);

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Restore numeric labels in the non-TTY tier selector.

This fallback still asks for Select tier [1-N], but the list no longer shows which number maps to each tier. Redirected/non-TTY runs now have to guess the ordering.

Suggested fix
-    allTiers.forEach((t) => {
+    allTiers.forEach((t, index) => {
       const marker = t.name === defaultTier.name ? RADIO_ON : RADIO_OFF;
-      console.log(`    ${marker} ${t.label}`);
+      console.log(`    ${index + 1}) ${marker} ${t.label}`);
     });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
allTiers.forEach((t) => {
const marker = t.name === defaultTier.name ? RADIO_ON : RADIO_OFF;
console.log(` ${marker} ${t.label}`);
allTiers.forEach((t, index) => {
const marker = t.name === defaultTier.name ? RADIO_ON : RADIO_OFF;
console.log(` ${index + 1}) ${marker} ${t.label}`);
});
🤖 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/onboard.ts` around lines 8301 - 8303, The non-TTY tier listing
printed by allTiers.forEach(...) no longer shows numeric indices even though the
prompt expects "Select tier [1-N]"; update the loop in the same block (the
allTiers.forEach callback that references defaultTier, RADIO_ON, RADIO_OFF) to
include the index (use the forEach second parameter i or map with index) and
change the console.log to print the numeric label (i+1) alongside the marker and
t.label so redirected/non-TTY runs can match numbers to tiers.

cv added 4 commits May 15, 2026 15:47
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv added the v0.0.45 label May 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 25946296361
Target ref: d5246e368245aebf761c4d00b2c86aec8730ab7f
Workflow ref: main
Requested jobs: cloud-onboard-e2e,sandbox-operations-e2e,network-policy-e2e,inference-routing-e2e,credential-sanitization-e2e,diagnostics-e2e
Summary: 6 passed, 0 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
credential-sanitization-e2e ✅ success
diagnostics-e2e ✅ success
inference-routing-e2e ✅ success
network-policy-e2e ✅ success
sandbox-operations-e2e ✅ success

Signed-off-by: Carlos Villela <cvillela@nvidia.com>

@cjagwani cjagwani 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.

Clean refactor — subtractive only, all 25+ CI checks green, every removed export verified zero-caller. 7/7 self-declared scope clauses met. Two non-blocking nits worth flagging:

  1. scripts/bump-version.ts:548–580 — dropped updateDocsConf + updateDocsProjectJson. They're orphaned per grep, but the nemoclaw-maintainer-cut-release-tag skill calls into bump-version.ts; worth confirming with the release flow that docs version files don't expect those to fire.
  2. test/credential-exposure.test.ts:30 — the two removed SOURCE_FILES constants point to source files that vanished in a prior PR; the test now only meaningfully validates ONBOARD_JS + RUNNER_TS. Worth a follow-up to retire or refocus it.

Approving.

@cv cv mentioned this pull request May 16, 2026
12 tasks
## Summary
Reintroduces the source-shape guard as a stacked follow-up to #3632, but
fixes the detector so it catches Node `assert.*` source-text assertions
instead of reporting a false zero. It then completes the source-shape
purge by removing the detected source-text assertions from
`test/onboard.test.ts` and ratcheting the budget back to zero.

## Related Issue
<!-- Fixes #NNN or Closes #NNN. Remove this section if none. -->
Stacked on #3632.

## Changes
<!-- Bullet list of key changes. -->
- Restored `scripts/find-source-shape-tests.ts`, `source-shape:*` npm
scripts, and the prek source-shape budget hook.
- Added detection for `assert.match`, `assert.doesNotMatch`,
`assert.ok`, and related Node assert-style source-text assertions.
- Avoided counting temp Dockerfile fixture behavior tests as
source-shape offenders.
- Removed all detected source-shape tests from `test/onboard.test.ts`
where behavior is covered by existing helper/integration tests.
- Ratcheted the source-shape budget back to zero.

## Type of Change
- [x] 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)

## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [ ] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Tests**
* Enhanced test validation infrastructure to track and enforce limits on
source-shape test cases across the codebase.
* Updated test coverage with new behavioral assertions and removed
outdated static-source regression checks.

* **Chores**
* Added development tools and CI configuration to support automated
source-shape test monitoring and budgeting.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/3636?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 25949687267
Target ref: ba507543cb39a7eae193d53c07adab8d028b51d2
Workflow ref: main
Requested jobs: cloud-onboard-e2e,sandbox-operations-e2e,network-policy-e2e,credential-migration-e2e,inference-routing-e2e,diagnostics-e2e
Summary: 6 passed, 0 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
credential-migration-e2e ✅ success
diagnostics-e2e ✅ success
inference-routing-e2e ✅ success
network-policy-e2e ✅ success
sandbox-operations-e2e ✅ success

@cv cv mentioned this pull request May 16, 2026
15 tasks
## Summary
Splits helper-oriented coverage out of the oversized
`test/onboard.test.ts` file into focused unit test files. The PR keeps
source-shape coverage at zero, preserves equivalent behavior coverage,
and makes the remaining onboard orchestration tests easier to navigate.

## Related Issue
<!-- Fixes #NNN or Closes #NNN. Remove this section if none. -->
Stacked on #3632 / #3636.

## Changes
<!-- Bullet list of key changes. -->
- Moved GPU helper coverage into focused module tests:
  - `src/lib/onboard/gateway-gpu-passthrough.test.ts`
  - `src/lib/onboard/sandbox-gpu-create.test.ts`
  - `src/lib/onboard/sandbox-gpu-mode.test.ts`
  - `src/lib/onboard/initial-policy.test.ts`
- Moved policy suggestion helper coverage into
`test/onboard-policy-suggestions.test.ts`.
- Moved dashboard helper coverage into `test/onboard-dashboard.test.ts`
and dashboard port helper coverage into
`src/lib/onboard/dashboard-port.test.ts`.
- Moved sandbox naming helper coverage into
`test/onboard-sandbox-name.test.ts`.
- Moved OpenShell version/pinning helper coverage into
`test/onboard-openshell-version.test.ts`.
- Moved Dockerfile patch helper coverage into
`src/lib/onboard/dockerfile-patch.test.ts`.
- Moved gateway runtime / Docker-driver / CDI helper coverage into
`test/onboard-gateway-runtime.test.ts`.
- Moved Model Router orchestration coverage into
`test/onboard-model-router.test.ts`.
- Moved messaging setup/provider coverage into
`test/onboard-messaging.test.ts`.
- Moved custom Dockerfile orchestration coverage into
`test/onboard-custom-dockerfile.test.ts`.
- Moved provider routing/probe/provider-CRUD helper coverage into owning
module tests:
  - `src/lib/inference/config.test.ts`
  - `src/lib/inference/onboard-probes.test.ts`
  - `src/lib/onboard/providers.test.ts`
  - `src/lib/validation.test.ts`
  - `src/lib/core/url-utils.test.ts`
  - `src/lib/adapters/http/probe.test.ts`
- Moved web-search support coverage into
`src/lib/onboard/web-search-support.test.ts` /
`test/onboard-brave-validation.test.ts`.
- Moved build-context and sandbox-create recovery hint coverage into
`src/lib/build-context.test.ts`.
- Extracted focused production helpers with direct module coverage:
  - `src/lib/onboard/credential-env.ts`
  - `src/lib/onboard/summary.ts`
- additional exports in `src/lib/onboard/sandbox-gpu-mode.ts` and
`src/lib/onboard/dashboard-port.ts`
- Removed the corresponding helper-only cases from
`test/onboard.test.ts`; it is now much smaller while keeping the
remaining orchestration/integration-style coverage.

## Type of Change
- [x] 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)

## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [x] `npm run source-shape:check` passes
- [x] `npm run build:cli` passes
- [x] `npx tsc -p tsconfig.cli.json --noUnusedLocals
--noUnusedParameters --pretty false` passes
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Tests**
* Added comprehensive test coverage for GPU configuration, sandbox
naming, credential management, dashboard port handling, custom
Dockerfile support, messaging channels, Model Router setup, and
OpenShell version management.
* Added tests for probe error handling, policy validation, and sandbox
state detection.

* **Refactor**
* Reorganized onboarding helpers into dedicated modules for improved
maintainability.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/3640?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>

@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: 1

♻️ Duplicate comments (1)
src/lib/onboard.ts (1)

8108-8115: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Restore numeric labels in the non-TTY tier selector.

Line 8114 still prompts for Select tier [1-N], but the fallback list on Lines 8108-8110 no longer shows which number maps to each tier.

Suggested fix
-    allTiers.forEach((t) => {
+    allTiers.forEach((t, index) => {
       const marker = t.name === defaultTier.name ? RADIO_ON : RADIO_OFF;
-      console.log(`    ${marker} ${t.label}`);
+      console.log(`    ${index + 1}) ${marker} ${t.label}`);
     });
🤖 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/onboard.ts` around lines 8108 - 8115, The printed fallback list for
non-TTY tier selection no longer shows numeric labels, causing the prompt
`Select tier [1-${allTiers.length}]` to be misleading; update the loop that
renders tiers (where allTiers.forEach, RADIO_ON/RADIO_OFF, and defaultTier are
used) to include the index number for each tier (e.g., display `${i + 1}`
alongside `marker` and `t.label`) so users can see which number corresponds to
each tier before the prompt call to prompt(...).
🤖 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/onboard/sandbox-gpu-mode.ts`:
- Around line 72-74: The current condition lets mere device presence flip mode
to "1" (overriding the earlier Jetson default "0"); change the check so mode is
set to "1" only when a GPU is present AND the user explicitly enabled
passthrough (e.g., options.flag === "enable" or envMode === "1"). Update the if
that references device, options.flag, envMode, and mode so it requires explicit
enablement rather than just not-"disable"/not-"0".

---

Duplicate comments:
In `@src/lib/onboard.ts`:
- Around line 8108-8115: The printed fallback list for non-TTY tier selection no
longer shows numeric labels, causing the prompt `Select tier
[1-${allTiers.length}]` to be misleading; update the loop that renders tiers
(where allTiers.forEach, RADIO_ON/RADIO_OFF, and defaultTier are used) to
include the index number for each tier (e.g., display `${i + 1}` alongside
`marker` and `t.label`) so users can see which number corresponds to each tier
before the prompt call to prompt(...).
🪄 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: fe6fd633-fc51-4db4-8d87-0ecb8e23c23d

📥 Commits

Reviewing files that changed from the base of the PR and between ba50754 and f436948.

📒 Files selected for processing (33)
  • src/lib/adapters/http/probe.test.ts
  • src/lib/build-context.test.ts
  • src/lib/core/url-utils.test.ts
  • src/lib/inference/config.test.ts
  • src/lib/inference/onboard-probes.test.ts
  • src/lib/onboard.ts
  • src/lib/onboard/credential-env.test.ts
  • src/lib/onboard/credential-env.ts
  • src/lib/onboard/dashboard-port.test.ts
  • src/lib/onboard/dashboard-port.ts
  • src/lib/onboard/dockerfile-patch.test.ts
  • src/lib/onboard/gateway-gpu-passthrough.test.ts
  • src/lib/onboard/initial-policy.test.ts
  • src/lib/onboard/providers.test.ts
  • src/lib/onboard/sandbox-gpu-create.test.ts
  • src/lib/onboard/sandbox-gpu-mode.test.ts
  • src/lib/onboard/sandbox-gpu-mode.ts
  • src/lib/onboard/summary.test.ts
  • src/lib/onboard/summary.ts
  • src/lib/onboard/vm-dns-monkeypatch.test.ts
  • src/lib/onboard/web-search-support.test.ts
  • src/lib/validation.test.ts
  • test/gateway-state.test.ts
  • test/onboard-brave-validation.test.ts
  • test/onboard-custom-dockerfile.test.ts
  • test/onboard-dashboard.test.ts
  • test/onboard-gateway-runtime.test.ts
  • test/onboard-messaging.test.ts
  • test/onboard-model-router.test.ts
  • test/onboard-openshell-version.test.ts
  • test/onboard-policy-suggestions.test.ts
  • test/onboard-sandbox-name.test.ts
  • test/onboard.test.ts
✅ Files skipped from review due to trivial changes (1)
  • src/lib/onboard/gateway-gpu-passthrough.test.ts

Comment thread src/lib/onboard/sandbox-gpu-mode.ts Outdated
cv added 2 commits May 16, 2026 10:09
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

@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: 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 `@src/lib/onboard/sandbox-gpu-mode.ts`:
- Around line 72-74: The block that sets mode = "1" when device && (options.flag
=== "enable" || envMode === "1") can override an explicit disable flag; update
resolveSandboxGpuMode (or the conditional immediately around the mode
assignment) so that options.flag === "disable" always wins: either remove the
device/envMode override entirely or change the condition to check flag !==
"disable" before applying envMode/device logic (e.g., require options.flag !==
"disable" && (options.flag === "enable" || envMode === "1")), and ensure any
existing device+mode incompatibility error is only pushed when the flag does not
explicitly disable GPU.
🪄 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: 8100c697-1ed1-4964-989c-bb913f4be38f

📥 Commits

Reviewing files that changed from the base of the PR and between 04d9bf1 and 92913ba.

📒 Files selected for processing (2)
  • src/lib/onboard/sandbox-gpu-mode.test.ts
  • src/lib/onboard/sandbox-gpu-mode.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/onboard/sandbox-gpu-mode.test.ts

Comment thread src/lib/onboard/sandbox-gpu-mode.ts Outdated
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 25968322630
Target ref: 92913baa21f324e7163afc10f40a605a64f0f2b9
Workflow ref: main
Requested jobs: cloud-onboard-e2e,sandbox-operations-e2e,inference-routing-e2e,network-policy-e2e,credential-migration-e2e,diagnostics-e2e
Summary: 6 passed, 0 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
credential-migration-e2e ✅ success
diagnostics-e2e ✅ success
inference-routing-e2e ✅ success
network-policy-e2e ✅ success
sandbox-operations-e2e ✅ success

@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: 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 `@src/lib/onboard/sandbox-gpu-mode.ts`:
- Around line 69-77: The current validation skips rejecting device selectors
when options.flag === "disable"; update the check to reject any requestedDevice
unless the effective mode is "1". Replace the condition using
explicitEnable/explicitDisable with a direct check against mode (e.g. if
(requestedDevice && mode !== "1") { errors.push(...); }) so selectors are only
accepted when mode === "1"; leave the sandboxGpuDevice assignment (const
sandboxGpuDevice = mode === "1" ? requestedDevice : null) as-is.
🪄 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: 9ae4af79-1007-4dbd-9cb9-98b92349e1ca

📥 Commits

Reviewing files that changed from the base of the PR and between 644f298 and 7fba5c1.

📒 Files selected for processing (5)
  • docs/reference/commands.md
  • src/lib/commands/onboard/common.ts
  • src/lib/onboard/legacy-command.ts
  • src/lib/onboard/sandbox-gpu-mode.test.ts
  • src/lib/onboard/sandbox-gpu-mode.ts
✅ Files skipped from review due to trivial changes (2)
  • src/lib/commands/onboard/common.ts
  • src/lib/onboard/legacy-command.ts

Comment thread src/lib/onboard/sandbox-gpu-mode.ts Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 25969431429
Target ref: 56ca37c517a8eb54181b1765b57dc230edc3f445
Workflow ref: main
Requested jobs: cloud-onboard-e2e,sandbox-operations-e2e,inference-routing-e2e,network-policy-e2e,credential-migration-e2e,gpu-e2e
Summary: 5 passed, 0 failed, 1 skipped

Job Result
cloud-onboard-e2e ✅ success
credential-migration-e2e ✅ success
gpu-e2e ⏭️ skipped
inference-routing-e2e ✅ success
network-policy-e2e ✅ success
sandbox-operations-e2e ✅ success

@cv cv changed the title refactor(cli): delete unused code refactor(cli): prune dead code and harden onboarding May 16, 2026
@cv cv merged commit 241402d into main May 16, 2026
30 checks passed
@cv cv deleted the refactor/delete-unused-code branch May 27, 2026 21:17
@wscurran wscurran added the refactor PR restructures code without intended behavior change label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants