Skip to content

fix(installer): reuse current CLI during reinstall - #8195

Merged
senthilr-nv merged 1 commit into
mainfrom
codex/fix-express-same-version-install
Aug 4, 2026
Merged

fix(installer): reuse current CLI during reinstall#8195
senthilr-nv merged 1 commit into
mainfrom
codex/fix-express-same-version-install

Conversation

@senthilr-nv

@senthilr-nv senthilr-nv commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Re-running the maintained installer at the already installed revision rebuilt the NemoClaw CLI twice when sandboxes required a pre-upgrade backup. The installer now reuses a healthy installer-managed CLI at the selected revision and prepares any changed or explicitly repaired CLI only once per installer run.

Related Issue

Fixes #7898

Changes

  • Reuse ~/.nemoclaw/source only when its commit matches the selected installer payload, its tracked state is clean, required dependency and build outputs exist, build identity matches, and the active CLI resolves inside that managed source with the expected version.
  • Record CLI preparation within one installer process so the pre-upgrade backup phase and the normal install phase do not clone, build, or link the same selected source twice. Any failed reuse check retains the existing reinstall path.
  • Preserve nemoclaw update --fresh as an explicit clean re-clone by passing an installer-internal repair request and consuming it before onboarding.
  • Add external-command-stubbed installer orchestration tests for same-revision reuse, changed-revision installation, and explicit repair, plus the required installer-test project registrations.

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)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: The change only avoids redundant installer clone/build/link work. Existing commands and documented update --fresh repair behavior are unchanged.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: Nine-category review passed at a824390d5 with no findings. Reuse remains bound to the selected payload commit, a user-owned clean managed checkout, required build and dependency markers, matching build identity, and a CLI path contained by that checkout; any failed check retains the existing reinstall path. No credential, authorization, dependency, cryptography, network, or privilege contract changed.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: Reviewed the completed installer change, explanatory text, and all test titles at a824390d5. No findings remain. The delta from the previous review only corrects the CLI lifecycle term from rebuilds to reinstalls. Focused validation passed 44/44 tests, Vitest project membership was exact across 2,058 candidates, and the final diff passes git diff --check.
  • Agent: Codex Desktop

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit: Not applicable; scripts/prepare-dgx-station-host.sh is unchanged.
  • Station profile/scenario: Not applicable.
  • Result: Not applicable.
  • Supporting evidence: Not applicable.

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — test/install-managed-cli-reuse.test.ts passed 3/3; src/lib/actions/update.test.ts passed 18/18; test/test-boundary-guards.test.ts passed 41/41. CLI and plugin typechecks, repository checks, ShellCheck, test-size, source-shape, and Vitest project-membership checks passed.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run 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: Senthil Ravichandran senthilr@nvidia.com

Summary by CodeRabbit

  • New Features

    • Repeated managed CLI installations now reuse an existing healthy checkout when the revision matches, avoiding unnecessary rebuilds.
    • Installations automatically rebuild when the source revision changes.
    • Fresh reinstalls now reliably force CLI reinstallation while preserving existing setup options.
  • Bug Fixes

    • Improved validation prevents reuse of incomplete, modified, or incompatible managed installations.

Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
@senthilr-nv senthilr-nv self-assigned this Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9a033905-84ba-48c1-b62b-89e7cd2d5c49

📥 Commits

Reviewing files that changed from the base of the PR and between 453b5df and a824390.

📒 Files selected for processing (8)
  • scripts/checks/no-test-dist-imports.mts
  • scripts/checks/vitest-project-overlap.mts
  • scripts/install.sh
  • src/lib/actions/update.test.ts
  • src/lib/actions/update.ts
  • test/install-managed-cli-reuse.test.ts
  • test/test-boundary-guards.test.ts
  • vitest.config.ts

📝 Walkthrough

Walkthrough

The installer now validates and reuses matching managed CLI checkouts. It rebuilds invalid or changed checkouts, supports forced reinstall through NEMOCLAW_REINSTALL_CLI, and adds integration coverage for reuse and reinstall behavior.

Changes

Managed CLI reuse

Layer / File(s) Summary
Installer reuse and finalization
scripts/install.sh
The installer tracks preparation state and installation mode. It validates revisions, repository cleanliness, artifacts, CLI identity, and versions before reusing managed installations.
Forced reinstall environment
src/lib/actions/update.ts, src/lib/actions/update.test.ts
Fresh updates clear inherited reinstall state and set NEMOCLAW_REINSTALL_CLI=1. Tests verify the environment and inherited standard I/O.
Installer integration coverage and project wiring
test/install-managed-cli-reuse.test.ts, test/test-boundary-guards.test.ts, vitest.config.ts, scripts/checks/no-test-dist-imports.mts, scripts/checks/vitest-project-overlap.mts
Integration tests cover exact reuse, changed revisions, and forced reinstall. Test boundary and Vitest configuration classify the new test correctly.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant UpdateAction
  participant Installer
  participant ManagedCheckout
  participant GitNpm
  UpdateAction->>Installer: set NEMOCLAW_REINSTALL_CLI for fresh update
  Installer->>ManagedCheckout: validate revision and installation state
  ManagedCheckout->>GitNpm: inspect checkout and build artifacts
  alt matching healthy checkout without force flag
    Installer->>ManagedCheckout: reuse CLI
  else changed or forced installation
    Installer->>GitNpm: clone, install dependencies, build, and link
  end
  Installer-->>UpdateAction: complete installation finalization
Loading

Suggested labels: area: cli, bug-fix

Suggested reviewers: apurvvkumaria, cv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main installer change: reusing the existing CLI during reinstall.
Linked Issues check ✅ Passed The changes address issue #7898 by reusing healthy managed CLI installations and testing same-revision reuse, changed revisions, and forced reinstall.
Out of Scope Changes check ✅ Passed All changes support installer reuse, forced reinstall behavior, or related test configuration and coverage.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-express-same-version-install

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

@github-code-quality

github-code-quality Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit a824390 in the codex/fix-express-sa... branch remains at 96%, unchanged from commit 643a4ab in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit a824390 in the codex/fix-express-sa... branch remains at 81%, unchanged from commit a556201 in the main branch.

Show a code coverage summary of the most impacted files.
File main a556201 codex/fix-express-sa... a824390 +/-
src/lib/platform.ts 89% 84% -5%
src/lib/policy/...ne-exclusion.ts 96% 92% -4%
src/lib/private-networks.ts 93% 90% -3%
src/lib/shields/index.ts 70% 70% 0%
src/lib/actions...all/run-plan.ts 83% 84% +1%
src/lib/inferen...ving/catalog.ts 91% 93% +2%
src/lib/onboard...eway-process.ts 95% 97% +2%
src/lib/state/g...way-registry.ts 94% 97% +3%
src/lib/onboard...eway-cleanup.ts 59% 66% +7%
src/lib/actions...ateway-ports.ts 0% 93% +93%

Updated August 04, 2026 06:15 UTC

@senthilr-nv senthilr-nv added bug-fix PR fixes a bug or regression area: install Install, setup, prerequisites, or uninstall flow area: performance Latency, throughput, resource use, benchmarks, or scaling v0.0.102 labels Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: Review the warnings below.
Findings: 0 blockers · 1 warning · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 1 warning · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Failed after a partial review · low confidence · 0 blockers · 3 warnings · 0 suggestions

Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate.

1 semantic terminology decision

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • define — managed source at test/install-managed-cli-reuse.test.ts:172: Define this term if it is used outside test-local context; the test title is unambiguous.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-inference, cloud-onboard, security-posture

1 optional E2E recommendation
  • bootstrap-install-smoke
1 warning · 0 suggestions

Warnings

Warnings do not block.

PRA-1 Warning — Test rejection of an external CLI during managed-source reuse

  • Location: test/install-managed-cli-reuse.test.ts:172
  • Category: tests
  • Problem: The reuse tests cover a CLI symlink that resolves inside the managed source, but do not cover an expected-version CLI outside that source. The new containment check could be removed or inverted without these cases detecting the trust-boundary regression.
  • Impact: A future change that weakens canonical CLI containment can reuse a managed installation while executing a CLI outside the validated source tree.
  • Recommendation: Add an installer-integration case that places a version-valid CLI outside the managed source on PATH or in npm's bin directory, then assert the installer performs one clone, dependency install, build, and link sequence.
  • Verification: Inspect the new fixture's CLI path and assert its canonical path is outside sourceRoot while the npm and git logs show one rebuild sequence.
  • Test coverage: An installer integration test with an external expected-version CLI must assert that managed-source reuse is rejected and exactly one rebuild sequence occurs.
  • Evidence: test/install-managed-cli-reuse.test.ts:81 creates fakeBin/nemoclaw as a symlink to sourceRoot/bin/nemoclaw.js. scripts/install.sh:1964-1983 permits reuse only when the resolved CLI path canonicalizes within source_root. test/install-managed-cli-reuse.test.ts:172-214 has no fixture case with a version-valid external CLI path.

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@senthilr-nv
senthilr-nv requested review from apurvvkumaria, cv and prekshivyas and removed request for prekshivyas August 4, 2026 06:30
@senthilr-nv
senthilr-nv merged commit 6ea0019 into main Aug 4, 2026
77 of 79 checks passed
@senthilr-nv
senthilr-nv deleted the codex/fix-express-same-version-install branch August 4, 2026 07:26
apurvvkumaria added a commit that referenced this pull request Aug 4, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Prepares the canonical v0.0.102 release documentation from the current
release-labeled scope.
The change adds a dated changelog for all 38 user-facing shipping PRs
and corrects the OpenClaw agent command reference for the behavior
delivered by #8191.

## Changes

- Add `docs/changelog/2026-08-04.mdx` with the v0.0.102 release summary,
detailed behavior changes, support boundaries, security evidence links,
and links to durable documentation.
- Update `docs/reference/commands.mdx` to describe non-JSON OpenClaw
output capture, its combined limit, marker handling, stream suppression,
recovery guidance, and exit behavior.
- [#8167](#8167) ->
`docs/changelog/2026-08-04.mdx`: Records authenticated attachment of
operator-managed llama.cpp servers.
- [#8129](#8129) ->
`docs/changelog/2026-08-04.mdx`: Records the Experimental managed vLLM
profile for two DGX Spark systems.
- [#7983](#7983) ->
`docs/changelog/2026-08-04.mdx`: Records qualification of the May 2026
GB300WS factory image.
- [#8207](#8207) ->
`docs/changelog/2026-08-04.mdx`: Records the qualified DGX Station
driver transaction.
- [#8208](#8208) ->
`docs/changelog/2026-08-04.mdx`: Records mode-bound Express resume
state.
- [#8158](#8158) ->
`docs/changelog/2026-08-04.mdx`: Records recovery of host-global
dual-Station runtime ownership.
- [#8145](#8145) ->
`docs/changelog/2026-08-04.mdx`: Records Windows-host Ollama validation
from Docker Desktop's network context.
- [#8190](#8190) ->
`docs/changelog/2026-08-04.mdx`: Records HTTP model pulls when WSL has
no local Ollama executable.
- [#8195](#8195) ->
`docs/changelog/2026-08-04.mdx`: Records reuse of a healthy
installer-managed CLI.
- [#8053](#8053) ->
`docs/changelog/2026-08-04.mdx`: Records early rejection of incompatible
OpenShell gateway versions.
- [#8098](#8098) ->
`docs/changelog/2026-08-04.mdx`: Records the bounded
package-service-to-standalone gateway recovery transition.
- [#8216](#8216) ->
`docs/changelog/2026-08-04.mdx`: Records the final dashboard port
selected during multi-sandbox onboarding.
- [#8146](#8146) ->
`docs/changelog/2026-08-04.mdx`: Records managed startup-state
restoration for stopped sandboxes.
- [#8092](#8092) ->
`docs/changelog/2026-08-04.mdx`: Records gateway watchdog recovery for
classified not-serving states.
- [#8182](#8182) ->
`docs/changelog/2026-08-04.mdx`: Records consistent managed-recovery
wait configuration.
- [#8040](#8040) ->
`docs/changelog/2026-08-04.mdx`: Records Docker sandbox rollback
authority through late validation.
- [#8130](#8130) ->
`docs/changelog/2026-08-04.mdx`: Records bounded Shields deadline
recovery and durable containment.
- [#8086](#8086) ->
`docs/changelog/2026-08-04.mdx`: Records repair of narrowly validated
permission-only configuration drift.
- [#8122](#8122) ->
`docs/changelog/2026-08-04.mdx`: Records prompt failure and guidance for
corrupt transition locks.
- [#8124](#8124) ->
`docs/changelog/2026-08-04.mdx`: Records policy restoration flags,
previews, and target revalidation.
- [#7886](#7886) ->
`docs/changelog/2026-08-04.mdx`: Records explicit destruction after
pre-delete Shields hardening failures while preserving recovery
authority.
- [#7901](#7901) ->
`docs/changelog/2026-08-04.mdx`: Records multi-port uninstall behavior
and shared-resource preservation.
- [#7984](#7984) ->
`docs/changelog/2026-08-04.mdx`: Records one classified transient remote
MCP startup retry.
- [#7954](#7954) ->
`docs/changelog/2026-08-04.mdx`: Records bounded hosted-inference probe
replies.
- [#7574](#7574) ->
`docs/changelog/2026-08-04.mdx`: Records preservation of validated
reasoning capabilities through onboarding.
- [#8089](#8089) ->
`docs/changelog/2026-08-04.mdx`: Records proxy routing for Hermes
WhatsApp pairing and media traffic.
- [#7682](#7682) ->
`docs/changelog/2026-08-04.mdx`: Records native Hermes session deletion
and identifier validation.
- [#8150](#8150) ->
`docs/changelog/2026-08-04.mdx`: Records corporate CA trust for
LangChain Deep Agents Code image builds.
- [#8156](#8156) ->
`docs/changelog/2026-08-04.mdx`: Records reviewed managed runtime
dependency remediation.
- [#8180](#8180) ->
`docs/changelog/2026-08-04.mdx`: Records reviewed MCP discovery runtime
dependency updates.
- [#8196](#8196) ->
`docs/changelog/2026-08-04.mdx`: Records private npm dependency
remediation across managed images.
- [#8203](#8203) ->
`docs/changelog/2026-08-04.mdx`: Records reviewed Hermes and LangChain
Deep Agents Code Python dependency updates.
- [#8125](#8125) ->
`docs/changelog/2026-08-04.mdx`: Records bounded diagnostics for invalid
enumerated CLI values.
- [#8193](#8193) ->
`docs/changelog/2026-08-04.mdx`: Records bounded diagnostics for
unresolved sandbox base images.
- [#8118](#8118) ->
`docs/changelog/2026-08-04.mdx`: Records bounded diagnostics for changed
gateway authority.
- [#8191](#8191) ->
`docs/changelog/2026-08-04.mdx`, `docs/reference/commands.mdx`: Records
output capture, marker handling, recovery guidance, and exit behavior
for non-JSON OpenClaw agent commands.
- [#8187](#8187) ->
`docs/changelog/2026-08-04.mdx`: Records the aligned
interactive-installation start across supported agents.
- [#8153](#8153) ->
`docs/changelog/2026-08-04.mdx`: Records current product capabilities
and support boundaries.

## Type of Change

- [ ] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [x] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Quality Gates

- [ ] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [x] Tests not applicable — justification: This documentation-only
release preparation does not change executable behavior. Existing
changelog and published-route tests pass.
- [x] Docs updated for user-facing behavior changes
- [ ] Docs not applicable — justification:
- [ ] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [ ] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification:
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Documentation Writer Review

- [x] Documentation writer subagent reviewed the completed changes
- Result: `docs-updated`
- Evidence: Independently reviewed `docs/changelog/2026-08-04.mdx` and
`docs/reference/commands.mdx` at commit `b89913780`. All 38 user-facing
v0.0.102 PRs are represented, #8191 behavior matches the implementation,
and the writing rules, documentation style, controlled terminology,
route structure, and skip policy pass review. Targeted tests pass 36/36
and the documentation build completes with 0 errors.
- Agent: Codex Desktop independent documentation writer
<!-- docs-review-head-sha: b899137 -->
<!-- docs-review-agents-blob-sha: 3dd7c24 -->

## DGX Station Hardware Evidence

- [ ] Tested on DGX Station
- Tested commit: Not applicable
- Station profile/scenario: Not applicable
- Result: Not applicable
- Supporting evidence: Not applicable

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — `npx vitest run --project integration
test/changelog-docs.test.ts test/check-docs-published-routes.test.ts`
passed 36/36.
- [x] Applicable broad gate passed — not applicable to
documentation-only changes; `npm run docs` completed successfully with 0
errors.
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only) —
completed with 0 errors and 2 existing Fern warnings.
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [x] New doc pages include SPDX header and frontmatter (new pages only)
— the native dated changelog uses the required parser-safe MDX SPDX
comment and intentionally has no frontmatter.

---
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>


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

## Summary by CodeRabbit

- **Documentation**
- Added release notes for v0.0.102, covering authentication, hardware
setup, WSL, installer recovery, sandbox resilience, policy management,
inference reliability, CLI improvements, and unified quickstarts.
- Updated command documentation to explain how non-JSON agent output is
collected, replayed, and reported.

- **Bug Fixes**
- Improved command-output recovery guidance when output exceeds limits
or contains unsupported fallback markers.
- Preserved accurate command exit-status reporting after output
processing.

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

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: install Install, setup, prerequisites, or uninstall flow area: performance Latency, throughput, resource use, benchmarks, or scaling bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DGX Station][Install] Re-running v0.0.97 Express install rebuilds the CLI twice and takes 154 seconds

2 participants