Skip to content

refactor(cli): delete unused code#3632

Open
cv wants to merge 10 commits into
mainfrom
refactor/delete-unused-code
Open

refactor(cli): delete unused code#3632
cv wants to merge 10 commits into
mainfrom
refactor/delete-unused-code

Conversation

@cv
Copy link
Copy Markdown
Collaborator

@cv cv commented May 15, 2026

Summary

Deletes unused legacy helpers, imports, exports, package dependencies, migration scaffolding, and stale compatibility leftovers across the CLI, onboarding flow, scripts, and tests. This reduces dead code and trims dependency metadata while preserving current behavior.

Changes

  • Removed unused compatibility imports/types and dead helper functions from src/nemoclaw.ts and src/lib/onboard.ts.
  • Deleted stale unused exports from runtime recovery, Docker adapters, onboarding helpers, NIM/vLLM helpers, state/session helpers, and command modules.
  • Pruned dead graph nodes found via ts-prune/madge, including unused dashboard health/recovery modules and the old debug-argument parser path.
  • Removed the test-only dead chat-filter module and duplicate tests.
  • Removed obsolete post-migration rescue tooling: the legacy-path CI workflow, TS migration guard, assist/bulk-fix scripts, move map, and guard tests.
  • Removed the broken source-shape gate, which reported zero cases while missing existing assert.* source-text tests.
  • Removed unused package dependencies: root execa devDependency and plugin commander dependency.
  • Cleaned unused imports, variables, and test-only scaffolding across affected test files.
  • Verified the cleanup with full hooks and the complete test suite.

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

Summary by CodeRabbit

  • New Features

    • Enhanced onboarding: policy tier selection, richer GPU sandbox configuration, credential env hydration, human-readable onboarding summaries, dashboard port detection, and improved model-router/onboard messaging flows.
  • Bug Fixes

    • Clarified dashboard readiness semantics and improved HTTP probe failure summarization.
  • Removals

    • Chat-filtering module removed; dashboard health-check & recovery tooling removed; TypeScript migration tooling and legacy-path guard removed.
  • Chores

    • Cleaned imports, removed unused dependencies, and streamlined CLI entrypoint.

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

coderabbitai Bot commented May 15, 2026

📝 Walkthrough

Walkthrough

Refactors onboarding/policy/dashboard/recovery, relocates GPU/credential helpers, slims CLI/debug contracts, removes ts-migration guard/tooling and related CI workflow, updates exports, and adds extensive onboarding/unit tests plus small import/test tidy-ups.

Changes

Onboarding, CLI, and Repository Cleanup

Layer / File(s) Summary
Onboarding 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, richer Sandbox GPU config, onboarding summary formatting, dashboard-port utilities, and extensive onboarding/unit tests (dockerfile patching, messaging, model-router, gateway runtime, policy suggestions, etc.).
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 & GitHub helpers removed
src/lib/credentials/store.ts
Removes gh/execFileSync-based isRepoPrivate and ensureGithubToken, keeping in-process credential staging and prompts.
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.
Inference & base-image API changes
src/lib/inference/*, src/lib/sandbox-base-image.ts
Removes convenience wrappers/exports (vLLM PROFILES, nim wrapper), replaces hermes base-image helper with openclaw base Dockerfile helper.
Scripts, migration tooling, package.json edits
scripts/*, .github/workflows/*, package.json, nemoclaw/package.json
Removes ts-migration assist/bulk/guard scripts, the legacy-path guard workflow, move-map, and trims dev/runtime deps (execa, commander).
Small test/import tidy-ups
test/*, small src/* files
Multiple small edits: remove unused imports/params, rename unused params to _, remove chat-filter module and its tests, and adjust various test imports.
Misc small tweaks
assorted scripts/*, src/lib/*
Minor changes: narrow node:path imports, remove unused color constant, rename unused replace callback param to _match, 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
  • cjagwani
  • ericksoa

"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
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

E2E Advisor Recommendation

Required E2E: cloud-onboard-e2e, sandbox-operations-e2e, inference-routing-e2e, network-policy-e2e, credential-migration-e2e, diagnostics-e2e
Optional E2E: openclaw-inference-switch-e2e, double-onboard-e2e, credential-sanitization-e2e, cloud-inference-e2e, gpu-e2e

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

Auto-dispatched E2E: cloud-onboard-e2e, sandbox-operations-e2e, inference-routing-e2e, network-policy-e2e, credential-migration-e2e, diagnostics-e2e via nightly-e2e.yaml at 92913baa21f324e7163afc10f40a605a64f0f2b9nightly run

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • cloud-onboard-e2e (high): Required because the PR touches core onboarding, package/install metadata, credential-env handling, initial policy, Docker/platform setup, dashboard port, gateway cleanup, DNS monkeypatching, and install preflight coverage. This job validates public install/onboard, policy preset application, read-only enforcement, leak checks, and inference.local probe in a real sandbox.
  • sandbox-operations-e2e (high): Required because sandbox lifecycle code changed across Docker inspect, sandbox create stream, base image selection, host/config commands, runtime recovery, registry recovery, and tunnel/service helpers. This is the broadest existing real-sandbox lifecycle regression suite.
  • inference-routing-e2e (medium): Required because inference config, local routing, NIM, vLLM, onboard probes, model-router tests, and chat filtering changed; this job validates real inference route/error classification behavior rather than only unit-level config parsing.
  • network-policy-e2e (high): Required because policy-channel, initial policy behavior, shields, and policy-related tests changed. The job covers deny-by-default, whitelist/live policy updates, hot reload, inference exemptions, permissive mode, and SSRF validation.
  • credential-migration-e2e (medium): Required because the credential store and credential environment plumbing changed. This job validates migration from legacy host credentials into OpenShell, secure deletion/zero-fill behavior, allowlist filtering, and symlink-safe handling.
  • diagnostics-e2e (medium): Required because debug command implementation, diagnostics logic, dashboard health/recover, and runtime recovery code changed. This validates the user-facing troubleshooting flow against a real onboarded sandbox.

Optional E2E

  • openclaw-inference-switch-e2e (high): Useful adjacent confidence for changed inference config/NIM/vLLM/local routing and CLI dispatch paths; validates changing a running OpenClaw sandbox route plus persisted config and live requests.
  • double-onboard-e2e (high): Useful because many onboard/session/gateway cleanup paths changed; catches re-onboard idempotency issues not covered by a single onboard run.
  • credential-sanitization-e2e (high): Useful adjacent security coverage because credential exposure, secret redaction, and credential-env code changed; complements credential-migration by validating runtime sanitization and leak boundaries in a running sandbox.
  • cloud-inference-e2e (medium): Useful for live assistant confidence because inference routing and chat-filter code changed; validates inference.local and assistant-facing live chat behavior with NVIDIA endpoints.
  • gpu-e2e (very high): Optional due to GPU onboard mode/create and Docker driver platform changes; run if GPU scheduling/cost is acceptable to validate local Ollama/GPU sandbox behavior.

New E2E recommendations

  • None.

Dispatch hint

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 Release target 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>
Copy link
Copy Markdown
Contributor

@cjagwani cjagwani left a comment

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>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 on lines +72 to +74
if (device && (options.flag === "enable" || envMode === "1")) {
mode = "1";
}
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 | 🟠 Major | ⚡ Quick win

Explicit flag="disable" can be overridden by envMode="1" + device presence.

When flag="disable" and envMode="1" with a device set:

  1. resolveSandboxGpuMode correctly returns mode "0" (flag wins)
  2. Line 69-71 pushes an error about device+mode incompatibility
  3. Line 72 condition device && (false || true) is true, so mode becomes "1"

This overrides the explicit disable flag and leaves an inconsistent error message. The explicit flag should take precedence over environment configuration.

Suggested fix
-  if (device && (options.flag === "enable" || envMode === "1")) {
+  if (device && options.flag !== "disable" && (options.flag === "enable" || envMode === "1")) {
     mode = "1";
   }

Alternatively, this block may be entirely redundant since resolveSandboxGpuMode already handles flag="enable" → mode "1" and envMode="1" → mode "1" (unless overridden by flag). Consider whether lines 72-74 add any value.

📝 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
if (device && (options.flag === "enable" || envMode === "1")) {
mode = "1";
}
if (device && options.flag !== "disable" && (options.flag === "enable" || envMode === "1")) {
mode = "1";
}
🤖 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/sandbox-gpu-mode.ts` around lines 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.

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

Labels

v0.0.45 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants