fix(onboard): upgrade stale openshell during preflight (Fixes #1404)#1435
fix(onboard): upgrade stale openshell during preflight (Fixes #1404)#1435deepujain wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Fixes NVIDIA#1404 Signed-off-by: Deepak Jain <deepujain@gmail.com>
📝 WalkthroughWalkthroughThe changes implement semantic version checking and automatic upgrade logic for OpenShell CLI during NemoClaw onboarding. The system now extracts minimum required versions from blueprint configuration, compares with installed versions, and performs upgrades when necessary across both Node.js and shell script layers. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Onboard as bin/lib/onboard.js
participant Blueprint as blueprint.yaml
participant Version as Version Logic
participant Installer as install-openshell.sh
participant Shell as OpenShell CLI
User->>Onboard: Run NemoClaw onboarding
Onboard->>Blueprint: Read blueprint config
Blueprint-->>Onboard: Return blueprint text
Onboard->>Version: getMinimumOpenshellVersion(blueprintText)
Version->>Version: Parse min_openshell_version from YAML
Version-->>Onboard: Return minimum version (e.g., "0.1.0")
Onboard->>Shell: Check installed version
Shell-->>Onboard: Return installed version (e.g., "0.0.21")
Onboard->>Version: shouldUpgradeOpenshell(installed, minimum)
Version->>Version: compareVersions(installed, minimum)
alt Upgrade Needed
Version-->>Onboard: Return true
Onboard->>Installer: Spawn with NEMOCLAW_MIN_OPENSHELL_VERSION
Installer->>Blueprint: resolve_min_version()
Installer->>Installer: Version comparison & upgrade
Installer-->>Shell: Install/upgrade OpenShell
else No Upgrade Needed
Version-->>Onboard: Return false
Onboard->>Onboard: Continue with existing version
end
Onboard-->>User: Onboarding complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~23 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
bin/lib/onboard.js (1)
454-460: Keep the blueprint minimum-version parser shared with the installer.This helper duplicates
scripts/install-openshell.sh's parsing/fallback logic, and the two implementations already accept different inputs. Sharing one parser, or at least mirroring the shell rules here, would make it much harder for preflight and the installer to disagree on whether an upgrade is required.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bin/lib/onboard.js` around lines 454 - 460, getMinimumOpenshellVersion duplicates parsing/fallback logic from scripts/install-openshell.sh which can cause preflight/installer mismatch; extract and centralize the parsing logic (or import a shared parser) so both the installer script and this function use the same implementation, and update getMinimumOpenshellVersion to delegate to that shared parser while preserving its existing input options (accepting blueprintText or reading the default blueprint file). Ensure the shared parser reproduces the shell rules (same regex, quoting, and fallback behavior) and reference the function name getMinimumOpenshellVersion and the installer script scripts/install-openshell.sh when locating where to replace logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@bin/lib/onboard.js`:
- Around line 454-460: getMinimumOpenshellVersion duplicates parsing/fallback
logic from scripts/install-openshell.sh which can cause preflight/installer
mismatch; extract and centralize the parsing logic (or import a shared parser)
so both the installer script and this function use the same implementation, and
update getMinimumOpenshellVersion to delegate to that shared parser while
preserving its existing input options (accepting blueprintText or reading the
default blueprint file). Ensure the shared parser reproduces the shell rules
(same regex, quoting, and fallback behavior) and reference the function name
getMinimumOpenshellVersion and the installer script scripts/install-openshell.sh
when locating where to replace logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4942884e-5c56-43a0-a110-5dc9cbe76a41
📒 Files selected for processing (4)
bin/lib/onboard.jsscripts/install-openshell.shtest/install-openshell.test.jstest/onboard.test.js
Summary
Fixes #1404.
NemoClaw already declares a minimum supported OpenShell version in the blueprint, but onboarding only installed OpenShell when the CLI was missing. If an older CLI was already present, upgrading NemoClaw could leave that stale OpenShell binary in place and keep using it.
Changes
bin/lib/onboard.jsto:min_openshell_versionfrom the blueprintscripts/install-openshell.shto resolve its minimum version from the blueprint by default, with an env override for callers that want to pin a specific minimum.test/onboard.test.jsfor the new minimum-version helpers.test/install-openshell.test.jsto verify the shell installer honors the blueprint minimum and explicit override path without attempting a network download.Testing
npm run build:clinpm test -- test/onboard.test.js test/install-openshell.test.jsEvidence it works
test/onboard.test.jsnow covers the version comparison path that decides whether OpenShell needs an upgrade.test/install-openshell.test.jsverifies that the shell installer reads the blueprint minimum version and respects an explicit minimum-version override.npm testsuite in this worktree. The branch-specific tests are green, but the broader suite still hit unrelated existing failures in:src/lib/preflight.test.tstest/install-preflight.test.jsSummary by CodeRabbit
New Features
Tests