Skip to content

fix(installer): retire out-of-range gateway after backup#7078

Merged
cv merged 5 commits into
mainfrom
codex/fix-gateway-fixture-guardrail
Jul 17, 2026
Merged

fix(installer): retire out-of-range gateway after backup#7078
cv merged 5 commits into
mainfrom
codex/fix-gateway-fixture-guardrail

Conversation

@cjagwani

@cjagwani cjagwani commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow up #7077 and #7028 by completing direct historical gateway upgrades. After a strict backup, the installer now retires a running gateway whenever its installed OpenShell is outside the prepared current release's supported range, preventing the new CLI from encountering the old gateway schema during recovery.

Changes

  • Replace the setup-only conditional with an equivalent boolean invariant assertion.
  • Preserve the requirement that the v0.0.55 fixture records the original OpenShell directory before hiding it from PATH.
  • Pin the v0.0.74 registry contract to both nemoclawVersion: "0.0.74" and fromDockerfile: null, as proven by selective live E2E artifacts.
  • Keep earlier historical fixtures pinned to absent registry metadata.
  • Resolve the current OpenShell min/max range from the prepared current source after backup.
  • Retire the selected gateway only when the installed OpenShell falls below or above that range; keep a supported gateway running.
  • Fail closed after backup and before gateway retirement when the supported range is missing, malformed, or inverted.
  • Document the expanded gateway-retirement boundary in the quickstart, command reference, and sandbox-update guide.

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

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 check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — installer recovery integration tests (38 passed), gateway support tests (5 passed), and final focused installer test after hook formatting (26 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) — passed with 0 errors; Fern reported the existing unauthenticated-redirect and accent-contrast warnings
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Charan Jagwani cjagwani@nvidia.com

Summary by CodeRabbit

  • Tests
    • Improved end-to-end coverage for OpenShell gateway upgrades by verifying structured legacy registry metadata (instead of only version values).
    • Expanded upgrade prompt/preinstall guard scenarios to confirm “keep vs retire” based on the blueprint-supported OpenShell version window, including invalid/unknown ranges and safer legacy gateway stop behavior.
  • Documentation
    • Updated the quickstart, sandbox update guide, and command reference to reflect conditional gateway retirement/retention and fail-closed behavior.
  • Chores
    • Refined the installer’s gateway retirement logic to rely on the blueprint-defined compatibility range, with a Linux-only PID-validated fallback to stop the legacy gateway process.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cjagwani cjagwani self-assigned this Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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

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: a5759a54-d0a1-4040-ad0c-522949d8fe5d

📥 Commits

Reviewing files that changed from the base of the PR and between 3f154ab and 56984fc.

📒 Files selected for processing (5)
  • docs/get-started/quickstart.mdx
  • docs/manage-sandboxes/update-sandboxes.mdx
  • docs/reference/commands.mdx
  • scripts/install.sh
  • test/install-openshell-upgrade-prompt.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/manage-sandboxes/update-sandboxes.mdx
  • docs/reference/commands.mdx
  • docs/get-started/quickstart.mdx
  • scripts/install.sh

📝 Walkthrough

Walkthrough

The installer now validates the current blueprint’s OpenShell version range before retiring legacy gateways, with process-stop fallback handling. Tests cover supported, out-of-range, invalid, and failed-retirement scenarios; upgrade fixtures use structured registry metadata, and documentation reflects the updated workflow.

Changes

OpenShell upgrade compatibility

Layer / File(s) Summary
Compatibility range resolution and gateway retirement
scripts/install.sh
The installer validates blueprint minimum and maximum versions, retains supported gateways, retires out-of-range gateways, and verifies a PID-based fallback before removing legacy registrations.
Upgrade guard coverage
test/install-openshell-upgrade-prompt.test.ts
The test harness supplies current blueprint ranges and gateway outcomes, covering retention, retirement, process cleanup, and fail-closed behavior.
Historical registry metadata assertions
test/e2e/live/openshell-gateway-upgrade-helpers.ts, test/e2e/live/openshell-gateway-upgrade.test.ts, test/e2e/support/openshell-gateway-upgrade-workflow-boundary.test.ts
Historical fixtures now return and validate both nemoclawVersion and fromDockerfile, with conditional upgrade log assertions.
Upgrade behavior documentation
docs/get-started/quickstart.mdx, docs/manage-sandboxes/update-sandboxes.mdx, docs/reference/commands.mdx
Documentation describes compatibility-range validation, gateway retention, retirement, and failure handling.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant Blueprint
  participant Gateway
  Installer->>Blueprint: Read supported OpenShell range
  Blueprint-->>Installer: Return validated min/max versions
  Installer->>Installer: Compare installed version with range
  Installer->>Gateway: Retire out-of-range gateway
  Gateway-->>Installer: Confirm lifecycle removal or process stop
Loading

Possibly related PRs

  • NVIDIA/NemoClaw#7028: Modifies the same legacy gateway retirement flow and related upgrade behavior.

Suggested labels: bug-fix

🚥 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 summarizes the main installer change: retiring the gateway after backup only when OpenShell is out of range.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 codex/fix-gateway-fixture-guardrail

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

@github-code-quality

github-code-quality Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the branch.

TypeScript / code-coverage/cli

The overall coverage in the branch remains at 80%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File 0393691 56984fc +/-
src/lib/onboard...carryforward.ts 92% 96% +4%
src/lib/inferen...er-lifecycle.ts 65% 71% +6%
src/lib/inferen...lama/process.ts 50% 100% +50%

Updated July 17, 2026 06:55 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cjagwani cjagwani changed the title test(e2e): keep gateway fixture setup linear test(e2e): finish gateway upgrade fixture repair Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions
Status: No actionable findings remain in the canonical review ledger.

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized E2E selections differ; severity counts match.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

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

Recommended E2E: cloud-onboard, credential-sanitization, security-posture, openshell-gateway-upgrade

Workflow run details

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

@github-actions

Copy link
Copy Markdown
Contributor

E2E Target Results — ⚠️ Run cancelled — no signal

Run: 29559129596
Workflow ref: codex/fix-gateway-fixture-guardrail
Requested targets: (default — all supported)
Requested test IDs: openshell-gateway-upgrade
Summary: 0 passed, 0 failed, 1 cancelled, 0 skipped, 0 unknown

Test Result Total wall clock time
openshell-gateway-upgrade ⚠️ cancelled 6m 56s

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cjagwani cjagwani changed the title test(e2e): finish gateway upgrade fixture repair fix(installer): retire out-of-range gateway after backup Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

E2E Target Results — ❌ Some tests failed

Run: 29559652425
Workflow ref: codex/fix-gateway-fixture-guardrail
Requested targets: (default — all supported)
Requested test IDs: openshell-gateway-upgrade
Summary: 0 passed, 1 failed, 0 cancelled, 0 skipped, 0 unknown

Test Result Total wall clock time
openshell-gateway-upgrade ❌ failure 18m 51s

Failed tests: openshell-gateway-upgrade. Check the workflow run for all logs and artifacts.

Comment thread scripts/install.sh Fixed

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/install.sh (1)

2311-2313: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Empty old_openshell_version triggers retirement with a blank version in the info message.

If installed_openshell_version (line 2279) fails to extract a version, old_openshell_version is empty. The version_gte "" "$min_openshell_version" regex check fails, so ! version_gte is true and the retirement block is entered. The info message on line 2313 then prints "Retiring OpenShell gateway" with a blank version. While this is fail-safe behavior, the message is misleading and retirement may be unnecessary when the installed version is simply undetectable rather than out-of-range.

Consider guarding against the empty case before the range comparison.

🛡️ Proposed fix: skip retirement when installed version is unknown
   read -r min_openshell_version max_openshell_version <<<"$supported_range"
-  if ! version_gte "$old_openshell_version" "$min_openshell_version" \
+  if [ -z "$old_openshell_version" ]; then
+    warn "Could not determine the installed OpenShell version; skipping gateway retirement. Existing gateway and sandbox state were left unchanged after backup."
+  elif ! version_gte "$old_openshell_version" "$min_openshell_version" \
     || ! version_gte "$max_openshell_version" "$old_openshell_version"; then
🤖 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 `@scripts/install.sh` around lines 2311 - 2313, Guard the retirement condition
around the version comparison so it runs only when old_openshell_version is
non-empty. Preserve the existing out-of-range checks and retirement behavior for
detected versions, while skipping the block when installed_openshell_version
yields an unknown version.
🧹 Nitpick comments (1)
scripts/install.sh (1)

2216-2217: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

ShellCheck flags A && B || C pattern — prefer an explicit if for the PID-file trust check.

The logic is correct here (both operands are pure test commands with no side-effect return codes), but ShellCheck emits an info-level warning because C can run when A is true. Since the coding guidelines require shell scripts to pass ShellCheck, consider rewriting as an explicit conditional for clarity and to silence the warning.

♻️ Optional refactor to explicit if-statement
-  [ ! -L "$pid_file" ] && [ -O "$pid_file" ] \
-    || error "Refusing to retire the legacy OpenShell gateway from an untrusted PID file: ${pid_file}"
+  if [ -L "$pid_file" ] || ! [ -O "$pid_file" ]; then
+    error "Refusing to retire the legacy OpenShell gateway from an untrusted PID file: ${pid_file}"
+  fi
🤖 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 `@scripts/install.sh` around lines 2216 - 2217, Replace the `[ ! -L "$pid_file"
] && [ -O "$pid_file" ] || error ...` expression with an explicit conditional
around the PID-file trust check. Preserve the existing behavior: only continue
when the file is not a symlink and is owned by the current user; otherwise
invoke error with the same message.

Sources: Coding guidelines, Linters/SAST tools

🤖 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 `@scripts/install.sh`:
- Around line 2222-2225: Update stop_legacy_openshell_gateway_process so the
stale-PID-file branch removes the file and returns 0 when kill -0 confirms the
process is already stopped. Preserve the existing failure return for other stop
failures, allowing the retirement cleanup chain to continue to openshell gateway
remove.

---

Outside diff comments:
In `@scripts/install.sh`:
- Around line 2311-2313: Guard the retirement condition around the version
comparison so it runs only when old_openshell_version is non-empty. Preserve the
existing out-of-range checks and retirement behavior for detected versions,
while skipping the block when installed_openshell_version yields an unknown
version.

---

Nitpick comments:
In `@scripts/install.sh`:
- Around line 2216-2217: Replace the `[ ! -L "$pid_file" ] && [ -O "$pid_file" ]
|| error ...` expression with an explicit conditional around the PID-file trust
check. Preserve the existing behavior: only continue when the file is not a
symlink and is owned by the current user; otherwise invoke error with the same
message.
🪄 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: 1d3c006f-56e6-45a0-b440-347df0fc64d7

📥 Commits

Reviewing files that changed from the base of the PR and between 5222c6e and 3f154ab.

📒 Files selected for processing (6)
  • docs/get-started/quickstart.mdx
  • docs/manage-sandboxes/update-sandboxes.mdx
  • docs/reference/commands.mdx
  • scripts/install.sh
  • test/e2e/live/openshell-gateway-upgrade.test.ts
  • test/install-openshell-upgrade-prompt.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • docs/get-started/quickstart.mdx
  • test/e2e/live/openshell-gateway-upgrade.test.ts
  • docs/manage-sandboxes/update-sandboxes.mdx
  • docs/reference/commands.mdx
  • test/install-openshell-upgrade-prompt.test.ts

Comment thread scripts/install.sh
@github-actions

Copy link
Copy Markdown
Contributor

E2E Target Results — ⚠️ Run cancelled — no signal

Run: 29560619436
Workflow ref: codex/fix-gateway-fixture-guardrail
Requested targets: (default — all supported)
Requested test IDs: openshell-gateway-upgrade
Summary: 0 passed, 0 failed, 1 cancelled, 0 skipped, 0 unknown

Test Result Total wall clock time
openshell-gateway-upgrade ⚠️ cancelled 3m 29s

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm after advisor fixes

@github-actions

Copy link
Copy Markdown
Contributor

E2E Target Results — ✅ All requested tests passed

Run: 29561006926
Workflow ref: codex/fix-gateway-fixture-guardrail
Requested targets: (default — all supported)
Requested test IDs: openshell-gateway-upgrade
Summary: 1 passed, 0 failed, 0 cancelled, 0 skipped, 0 unknown

Test Result Total wall clock time
openshell-gateway-upgrade ✅ success 19m 52s

@cv
cv merged commit 027632a into main Jul 17, 2026
154 of 156 checks passed
@cv
cv deleted the codex/fix-gateway-fixture-guardrail branch July 17, 2026 07:20
@github-actions github-actions Bot added the v0.0.85 Release target label Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.0.85 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants