Skip to content

refactor(cli): delete setup.sh, route all setup through nemoclaw onboard#1230

Closed
cv wants to merge 9 commits into
mainfrom
cv/delete-setup-sh
Closed

refactor(cli): delete setup.sh, route all setup through nemoclaw onboard#1230
cv wants to merge 9 commits into
mainfrom
cv/delete-setup-sh

Conversation

@cv

@cv cv commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Delete scripts/setup.sh (324 lines) — every step it performed is already handled by nemoclaw onboard with better error recovery (exponential backoff via pRetry), interactive prompts, registry management, and WSL2-aware Ollama binding
  • nemoclaw setup now delegates to onboard instead of shelling out to the deleted script
  • brev-setup.sh installs the nemoclaw CLI and runs nemoclaw onboard --non-interactive instead of calling setup.sh
  • Remove setup.sh-specific tests and assertions (3 test removals across 3 files); all equivalent assertions against onboard.js already exist

Test plan

  • 541 CLI tests pass (vitest run --project cli)
  • Verify nemoclaw setup prints deprecation notice and runs onboard
  • Verify brev-setup.sh bootstraps correctly on a fresh Brev VM (E2E)

Relates to #924 (shell consolidation).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • nemoclaw onboard replaces legacy setup workflow
    • Automatic SSH known hosts cleanup before gateway startup
  • Improvements

    • Enhanced SSH host key verification for better security
  • Deprecated

    • Removed legacy scripts/setup.sh setup process

miyoungc and others added 9 commits March 30, 2026 02:31
After a Docker container restart, the gateway regenerates its mTLS
certificates but stale host key entries in ~/.ssh/known_hosts cause
SSH handshake verification failures. This fix:

- Purges old openshell host key entries from known_hosts when the
  gateway is destroyed during onboard
- Uses ephemeral known_hosts files for sandbox SSH connections in
  debug.sh to avoid accumulating stale entries

Fixes #768

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…filter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…atching

- Move SANDBOX_SSH_KNOWN cleanup into cleanup() instead of a standalone
  trap that overwrites the existing EXIT handler (scripts/debug.sh)
- Narrow known_hosts pruning to only match hostnames that startsWith
  "openshell-" in the host field, split by comma, skipping comments
  and empty lines (bin/lib/onboard.js)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add comments inside empty catch blocks to satisfy no-empty rule
- Apply Prettier formatting to chained filter/join calls

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Extract pruneKnownHostsEntries() as a testable helper and add 10 tests
covering: openshell- removal, comma-separated hosts, comment/blank
preservation, no-match passthrough, key-data false positives, hashed
entries, and bracketed port entries.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
scripts/setup.sh (324 lines) duplicated every step that
`nemoclaw onboard` already handles with better error recovery,
exponential backoff, interactive prompts, and registry management.

- Delete scripts/setup.sh and its dedicated test file
- `nemoclaw setup` now delegates to onboard instead of shelling out to
  the deleted script
- brev-setup.sh installs the CLI and runs `nemoclaw onboard
  --non-interactive` instead of calling setup.sh
- Remove setup.sh assertions from gateway-cleanup and runner tests
- Update comments in walkthrough.sh and brev-e2e.test.js

Relates to #924 (shell consolidation).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This pull request refactors the NemoClaw setup flow by removing the monolithic scripts/setup.sh and delegating its responsibilities to a modular nemoclaw onboard command. The bootstrap process now installs the nemoclaw CLI and delegates setup through the onboarding flow, while adding SSH host key cleanup logic to prevent stale known_hosts entries.

Changes

Cohort / File(s) Summary
Onboarding & SSH Cleanup
bin/lib/onboard.js, bin/nemoclaw.js
Added pruneKnownHostsEntries() helper function and integrated SSH host key cleanup (via ssh-keygen -R and known_hosts file rewriting) into startGatewayWithOptions. Updated nemoclaw setup to delegate to runOnboard() instead of executing legacy bootstrap steps.
Bootstrap & Installation
scripts/brev-setup.sh, scripts/debug.sh
Updated brev bootstrap to install nemoclaw CLI and run nemoclaw onboard --non-interactive. Modified debug.sh to use separate temporary known_hosts file and changed SSH from StrictHostKeyChecking=no to StrictHostKeyChecking=accept-new.
Setup Migration
scripts/setup.sh, test/setup-sandbox-name.test.js, test/gateway-cleanup.test.js, test/runner.test.js
Removed scripts/setup.sh (324 lines) which performed host-side bootstrap. Deleted test/setup-sandbox-name.test.js (78 lines) that validated setup.sh sandbox naming. Removed setup.sh-specific assertions from cleanup and credential exposure tests.
Documentation & Test Updates
scripts/walkthrough.sh, test/e2e/brev-e2e.test.js, test/ssh-known-hosts.test.js
Updated walkthrough to reference nemoclaw onboard instead of setup.sh. Modified E2E bootstrap to reflect new CLI installation flow. Added comprehensive test suite (100 lines) for pruneKnownHostsEntries() covering edge cases and host entry format variations.

Sequence Diagram(s)

sequenceDiagram
    participant NodeProcess as Node Process<br/>(onboard.js)
    participant SSHKeygen as SSH Keygen<br/>(external)
    participant FileSystem as File System<br/>(~/.ssh/known_hosts)
    
    NodeProcess->>SSHKeygen: ssh-keygen -R openshell-${GATEWAY_NAME}<br/>(best-effort, ignore failures)
    SSHKeygen-->>NodeProcess: complete (may fail)
    
    NodeProcess->>FileSystem: read ~/.ssh/known_hosts
    FileSystem-->>NodeProcess: file contents
    
    NodeProcess->>NodeProcess: pruneKnownHostsEntries(contents)<br/>filter out openshell-* entries
    
    alt Changes detected
        NodeProcess->>FileSystem: write filtered contents back
        FileSystem-->>NodeProcess: write complete
    else No changes
        NodeProcess->>NodeProcess: skip write
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 bounces excitedly
The setup once vast now broken in parts,
SSH keys pruned with algorithmic hearts,
From monolithic scripts to onboard's clean flow,
Where nemoclaw delegates what it should know,
Bootstrap and hosts now dance in accord!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing scripts/setup.sh and consolidating all setup logic through nemoclaw onboard command.

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

✨ 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 cv/delete-setup-sh

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

@cv

cv commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator Author

Reopening from a clean branch based on main (the original had stale commits from another branch).

@cv cv closed this Apr 1, 2026
cv added a commit that referenced this pull request Apr 1, 2026
…ard (#1235)

## Summary

- Delete `scripts/setup.sh` (324 lines) — every step it performed is
already handled by `nemoclaw onboard` with better error recovery
(exponential backoff via pRetry), interactive prompts, registry
management, and WSL2-aware Ollama binding
- `nemoclaw setup` now delegates to `onboard` instead of shelling out to
the deleted script
- `brev-setup.sh` installs the nemoclaw CLI and runs `nemoclaw onboard
--non-interactive` instead of calling setup.sh
- Remove setup.sh-specific tests and assertions (3 test removals across
3 files); all equivalent assertions against `onboard.js` already exist

## Test plan

- [x] 541 CLI tests pass (`vitest run --project cli`)
- [ ] Verify `nemoclaw setup` prints deprecation notice and runs onboard
- [ ] Verify `brev-setup.sh` bootstraps correctly on a fresh Brev VM
(E2E)

Relates to #924 (shell consolidation). Supersedes #1230.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* **Refactor**
* Migrated legacy setup to a unified onboarding flow and removed the old
top-level setup orchestration.

* **Chores**
* Updated bootstrap to build/install the CLI locally and run onboarding
non-interactively.
  * Adjusted setup walkthrough instructions to reference onboarding.

* **Tests**
* Removed tests tied to the removed setup script and sandbox-name
behavior.
* Added CLI dispatch tests verifying setup argument forwarding into
onboarding.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
laitingsheng pushed a commit that referenced this pull request Apr 2, 2026
…ard (#1235)

## Summary

- Delete `scripts/setup.sh` (324 lines) — every step it performed is
already handled by `nemoclaw onboard` with better error recovery
(exponential backoff via pRetry), interactive prompts, registry
management, and WSL2-aware Ollama binding
- `nemoclaw setup` now delegates to `onboard` instead of shelling out to
the deleted script
- `brev-setup.sh` installs the nemoclaw CLI and runs `nemoclaw onboard
--non-interactive` instead of calling setup.sh
- Remove setup.sh-specific tests and assertions (3 test removals across
3 files); all equivalent assertions against `onboard.js` already exist

## Test plan

- [x] 541 CLI tests pass (`vitest run --project cli`)
- [ ] Verify `nemoclaw setup` prints deprecation notice and runs onboard
- [ ] Verify `brev-setup.sh` bootstraps correctly on a fresh Brev VM
(E2E)

Relates to #924 (shell consolidation). Supersedes #1230.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* **Refactor**
* Migrated legacy setup to a unified onboarding flow and removed the old
top-level setup orchestration.

* **Chores**
* Updated bootstrap to build/install the CLI locally and run onboarding
non-interactively.
  * Adjusted setup walkthrough instructions to reference onboarding.

* **Tests**
* Removed tests tied to the removed setup script and sandbox-name
behavior.
* Added CLI dispatch tests verifying setup argument forwarding into
onboarding.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lakamsani pushed a commit to lakamsani/NemoClaw that referenced this pull request Apr 4, 2026
…ard (NVIDIA#1235)

## Summary

- Delete `scripts/setup.sh` (324 lines) — every step it performed is
already handled by `nemoclaw onboard` with better error recovery
(exponential backoff via pRetry), interactive prompts, registry
management, and WSL2-aware Ollama binding
- `nemoclaw setup` now delegates to `onboard` instead of shelling out to
the deleted script
- `brev-setup.sh` installs the nemoclaw CLI and runs `nemoclaw onboard
--non-interactive` instead of calling setup.sh
- Remove setup.sh-specific tests and assertions (3 test removals across
3 files); all equivalent assertions against `onboard.js` already exist

## Test plan

- [x] 541 CLI tests pass (`vitest run --project cli`)
- [ ] Verify `nemoclaw setup` prints deprecation notice and runs onboard
- [ ] Verify `brev-setup.sh` bootstraps correctly on a fresh Brev VM
(E2E)

Relates to NVIDIA#924 (shell consolidation). Supersedes NVIDIA#1230.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* **Refactor**
* Migrated legacy setup to a unified onboarding flow and removed the old
top-level setup orchestration.

* **Chores**
* Updated bootstrap to build/install the CLI locally and run onboarding
non-interactively.
  * Adjusted setup walkthrough instructions to reference onboarding.

* **Tests**
* Removed tests tied to the removed setup script and sandbox-name
behavior.
* Added CLI dispatch tests verifying setup argument forwarding into
onboarding.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gemini2026 pushed a commit to gemini2026/NemoClaw that referenced this pull request Apr 14, 2026
…ard (NVIDIA#1235)

## Summary

- Delete `scripts/setup.sh` (324 lines) — every step it performed is
already handled by `nemoclaw onboard` with better error recovery
(exponential backoff via pRetry), interactive prompts, registry
management, and WSL2-aware Ollama binding
- `nemoclaw setup` now delegates to `onboard` instead of shelling out to
the deleted script
- `brev-setup.sh` installs the nemoclaw CLI and runs `nemoclaw onboard
--non-interactive` instead of calling setup.sh
- Remove setup.sh-specific tests and assertions (3 test removals across
3 files); all equivalent assertions against `onboard.js` already exist

## Test plan

- [x] 541 CLI tests pass (`vitest run --project cli`)
- [ ] Verify `nemoclaw setup` prints deprecation notice and runs onboard
- [ ] Verify `brev-setup.sh` bootstraps correctly on a fresh Brev VM
(E2E)

Relates to NVIDIA#924 (shell consolidation). Supersedes NVIDIA#1230.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* **Refactor**
* Migrated legacy setup to a unified onboarding flow and removed the old
top-level setup orchestration.

* **Chores**
* Updated bootstrap to build/install the CLI locally and run onboarding
non-interactively.
  * Adjusted setup walkthrough instructions to reference onboarding.

* **Tests**
* Removed tests tied to the removed setup script and sandbox-name
behavior.
* Added CLI dispatch tests verifying setup argument forwarding into
onboarding.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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.

4 participants