Skip to content

fix(install): manage openshell gateway user as service daemon - #6905

Closed
sandl99 wants to merge 25 commits into
mainfrom
fix/install-openshell-gateway-service
Closed

sandl99 wants to merge 25 commits into
mainfrom
fix/install-openshell-gateway-service

Conversation

@sandl99

@sandl99 sandl99 commented Jul 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

NemoClaw now uses OpenShell's openshell-gateway.service daemon model for Linux tarball installs so the Docker-driver gateway can restart after reboot or at the next user session. Package-managed OpenShell services remain authoritative, macOS Homebrew service ownership remains upstream-owned, and --keep-openshell preserves OpenShell service daemons.

Related Issue

Fixes #6903

Changes

  • Stage a marked Linux openshell-gateway.service user unit from the NemoClaw installer/onboard path for tarball OpenShell installs.
  • Start trusted OpenShell gateway user services through systemctl --user enable and restart, with identity checks for unit path and the actual ExecStart.
  • Prefer package-managed OpenShell service units; if an upstream unit exists, remove only NemoClaw's marked user-level override so it cannot shadow the package unit.
  • Harden Linux user-unit ownership checks by requiring the exact NemoClaw marker line and trusted absolute gateway ExecStart paths before writing, replacing, or removing a unit.
  • Preserve OpenShell binaries, gateway service daemons, gateway service configuration, and the host openshell-gateway process under --keep-openshell; full uninstall removes only NemoClaw-marked Linux user units and never removes upstream Linux package units or the macOS Homebrew service.
  • Update architecture, command, and uninstall docs for the Linux/macOS gateway service lifecycle.

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:
  • 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: scoped installer/onboard/uninstall ownership change requested in Install and uninstall a managed OpenShell gateway service for reboot persistence #6903; tests cover package-unit preference, marked user-unit install/start, absolute ExecStart validation, trusted ExecStart allowlisting, exact marker ownership, foreign-unit preservation, --keep-openshell service/config preservation, macOS no-op behavior, and uninstall failure reporting.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

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
    • Commit hooks passed with source-shape-test-budget skipped because this local checkout has ignored worktrees/* directories that the scanner traverses.
    • git push origin HEAD — pre-push hook passed.
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification:
    • npx vitest run src/lib/actions/uninstall/run-plan-gateway-service.test.ts src/lib/onboard/docker-driver-gateway-service.test.ts src/lib/onboard/docker-driver-gateway-env-service.test.ts src/lib/onboard/docker-driver-gateway-env.test.ts --project cli — passed after trust follow-up.
    • npx vitest run test/install-openshell-gateway-service.test.ts --project integration — passed after trust follow-up.
    • npx vitest run src/lib/actions/uninstall/run-plan-gateway-service.test.ts --project cli — passed after --keep-openshell config preservation fix.
    • bash -n scripts/install.sh — passed
    • npm run check:installer-hash — passed
    • npm run typecheck:cli — passed
    • npm run test-size:check — passed
    • git diff --check — 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)
    • npm run docs passed with 0 errors and 2 existing Fern warnings.
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: San Dang [email protected]

Summary by CodeRabbit

  • New Features

    • Linux installations now support a managed OpenShell gateway service that can restart automatically after reboot or a new session.
    • Gateway setup safely distinguishes supported package services from managed or standalone fallback processes.
    • Uninstall now removes NemoClaw-managed gateway services when requested while preserving OpenShell services with --keep-openshell.
    • macOS continues using the existing Homebrew or standalone gateway behavior.
  • Documentation

    • Clarified gateway ownership, service retention, fallback behavior, and configuration overrides.

@coderabbitai

coderabbitai Bot commented Jul 15, 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
📝 Walkthrough

Walkthrough

NemoClaw now manages a marked Linux OpenShell gateway user service, selects trusted upstream or NemoClaw-owned units, wires installation into onboarding, removes owned units during uninstall, preserves services with --keep-openshell, and documents the lifecycle across supported platforms.

Changes

OpenShell gateway service lifecycle

Layer / File(s) Summary
Trusted service resolution and lifecycle implementation
src/lib/onboard/docker-driver-gateway-service.ts, src/lib/onboard/docker-driver-gateway-service.test.ts
Adds marked unit creation, trusted target resolution, identity validation, service installation, restart handling, and fallback coverage.
Installer and onboarding integration
scripts/install.sh, src/lib/onboard.ts, src/lib/onboard/docker-driver-gateway-env.ts, test/install-openshell-gateway-service.test.ts
Stages or reports the managed user service during OpenShell installation and Docker-driver startup, with binary-path validation and integration tests.
Owned service uninstall cleanup
src/lib/actions/uninstall/run-plan.ts, src/lib/actions/uninstall/run-plan.test.ts, src/lib/actions/uninstall/run-plan-gateway-service.test.ts
Adds platform-aware removal of marked units during full uninstall while preserving them for --keep-openshell and skipping cleanup on macOS.
Lifecycle behavior documentation
docs/reference/architecture.mdx, docs/manage-sandboxes/uninstall-nemoclaw.mdx, docs/reference/commands.mdx
Documents trusted service ownership, platform-specific behavior, fallback selection, retention semantics, and gateway binary overrides.

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

Possibly related PRs

  • NVIDIA/NemoClaw#6711 — Overlaps the uninstall execution-plan changes for OpenShell gateway cleanup.
  • NVIDIA/NemoClaw#6907 — Directly related to NemoClaw-managed OpenShell systemd user-service staging and uninstall handling.

Suggested labels: area: install, bug-fix

Suggested reviewers: ericksoa, cv, apurvvkumaria

🚥 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
Linked Issues check ✅ Passed The changes align with #6903 by adding a managed gateway user service, preferring trusted upstream units, restricting uninstall cleanup, and adding docs/tests.
Out of Scope Changes check ✅ Passed The diff stays focused on gateway service ownership, uninstall behavior, docs, and tests; no unrelated feature area changes are evident.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: managing the OpenShell gateway as a user service daemon during install.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/install-openshell-gateway-service

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

@github-code-quality

github-code-quality Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

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

TypeScript / code-coverage/cli

The overall coverage in the fix/install-openshel... branch remains at 80%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 6a813d4 fix/install-openshel... dc2b685 +/-
src/lib/adapter...ocker/volume.ts 85% 70% -15%
src/lib/messagi...onfig-parser.ts 92% 77% -15%
src/lib/actions...all/run-plan.ts 81% 82% +1%
src/lib/adapter.../docker/pull.ts 83% 86% +3%
src/lib/onboard...tp-readiness.ts 94% 98% +4%
src/lib/onboard...eway-service.ts 85% 90% +5%
src/lib/messagi...onfig-parser.ts 93% 100% +7%
src/lib/messagi...ate-resolver.ts 82% 94% +12%
src/lib/messagi...ate-resolver.ts 67% 89% +22%
src/lib/core/pr...mpt-activity.ts 67% 92% +25%

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

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 15, 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 · 7 warnings · 0 suggestions
  • Model comparison: normalized findings differ; normalized E2E selections differ; Nemotron reported the same number of blockers, 7 more warnings, the same number of suggestions.

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, onboard-repair, onboard-resume, ubuntu-repo-docker-post-reboot-recovery

2 optional E2E recommendations
  • openshell-version-pin
  • 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.

@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: 5

🧹 Nitpick comments (1)
src/lib/onboard/docker-driver-gateway-service.test.ts (1)

194-220: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Assert the installed directory and unit permissions.

The test supplies mkdirSync and chmodSync mocks but never verifies 0700 for the directory or 0600 for the unit. Assert those observable filesystem calls so the restrictive-permission contract cannot regress silently.

As per path instructions, tests should prove observable behavior through the public boundary.

🤖 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/docker-driver-gateway-service.test.ts` around lines 194 -
220, Extend the test for installNemoclawOpenShellGatewayUserService to assert
that mkdirSync creates the service directory with mode 0700 and chmodSync
applies mode 0600 to the installed unit file. Verify these calls through the
existing mocks and public installation flow, preserving the current assertions.

Source: Path instructions

🤖 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/actions/uninstall/run-plan.ts`:
- Around line 629-644: Update the uninstall logic around the systemctl disable
call and executePlan so a nonzero disable.status is propagated as an
unsuccessful/incomplete uninstall instead of continuing to report success after
removing the service file. Preserve the existing warning and cleanup behavior,
and add a test covering a nonzero systemctl result and the resulting failed
uninstall status.

In `@src/lib/onboard.ts`:
- Around line 1999-2000: Update the gateway service installation result handling
around gatewayService.reason so every non-benign failure reason is reported, not
only reasons starting with “refusing”. Preserve silence only for explicitly
benign outcomes, and ensure failures such as invalid whitespace-containing
gatewayBin values emit an actionable warning or are returned through a typed
outcome.

In `@src/lib/onboard/docker-driver-gateway-service.ts`:
- Around line 378-379: Wrap the filesystem operations in the onboarding
flow—rmSync, mkdirSync, chmodSync, and writeFileSync—in error handling so thrown
failures do not abort execution. On any filesystem error, return the declared
failure result with an actionable reason, preserving the standalone fallback
behavior and existing success path.
- Around line 120-122: Update getNemoclawOpenShellGatewayUserServicePath to use
XDG_CONFIG_HOME when it is set, falling back to the provided home directory’s
.config path otherwise. Preserve the existing
systemd/user/openshell-gateway.service suffix so installation and lookup remain
aligned.
- Around line 345-358: Remove the "After=default.target" directive from both
unit templates in src/lib/onboard/docker-driver-gateway-service.ts (lines
345-358) and scripts/install-openshell.sh (lines 64-77). Keep
"WantedBy=default.target" unchanged so the services remain enabled by the
default target without introducing an ordering cycle.

---

Nitpick comments:
In `@src/lib/onboard/docker-driver-gateway-service.test.ts`:
- Around line 194-220: Extend the test for
installNemoclawOpenShellGatewayUserService to assert that mkdirSync creates the
service directory with mode 0700 and chmodSync applies mode 0600 to the
installed unit file. Verify these calls through the existing mocks and public
installation flow, preserving the current assertions.
🪄 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: d429fae5-4a99-4c03-a82d-09b4f89a005a

📥 Commits

Reviewing files that changed from the base of the PR and between 5b67372 and 5b2f046.

📒 Files selected for processing (9)
  • docs/manage-sandboxes/uninstall-nemoclaw.mdx
  • docs/reference/architecture.mdx
  • docs/reference/commands.mdx
  • scripts/install-openshell.sh
  • src/lib/actions/uninstall/run-plan-gateway-service.test.ts
  • src/lib/actions/uninstall/run-plan.ts
  • src/lib/onboard.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts

Comment thread src/lib/actions/uninstall/run-plan.ts Resolved
Comment thread src/lib/onboard.ts Resolved
@sandl99 sandl99 self-assigned this Jul 15, 2026
@sandl99 sandl99 added enhancement New capability or improvement request VDR Linked to VDR finding area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery labels Jul 15, 2026

@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: 4

Caution

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

⚠️ Outside diff range comments (4)
src/lib/onboard/docker-driver-gateway-service.ts (1)

480-499: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Report a missing gateway binary instead of silently skipping it.

On Linux without an upstream unit, this leaves no reboot-persistent gateway service but emits no warning. Remove "OpenShell gateway binary not found" from the benign skip list and cover the warning behavior.

Proposed fix
 function isBenignGatewayUserServiceInstallSkip(reason: string | undefined): boolean {
   return (
     reason === "not a Linux host" ||
-    reason === "upstream OpenShell gateway service is installed" ||
-    reason === "OpenShell gateway binary not found"
+    reason === "upstream OpenShell gateway service is installed"
   );
 }
🤖 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/docker-driver-gateway-service.ts` around lines 480 - 499,
Update isBenignGatewayUserServiceInstallSkip so "OpenShell gateway binary not
found" is no longer treated as benign, allowing
installAndReportNemoclawOpenShellGatewayUserService to emit its warning for that
reason. Add or update coverage for the warning behavior when no gateway binary
is available.
scripts/install.sh (1)

1218-1223: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Configure the gateway service even when OpenShell is already installed.

The if-missing return bypasses Line 1223, so existing standalone tarball installations never receive the reboot-persistent service introduced by this PR. Separate installation from service reconciliation so the latter always runs.

🤖 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 1218 - 1223, Update the OpenShell setup flow
around the if-missing check so detecting an existing openshell skips only
installation, not service reconciliation. Ensure prefer_user_local_openshell and
install_nemoclaw_openshell_gateway_user_service always run, while the
install-openshell.sh command runs only when OpenShell is missing.
src/lib/actions/uninstall/run-plan.ts (2)

620-658: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Report every managed-unit cleanup failure as an incomplete uninstall.

Read failures currently return success, rmSync can throw, and daemon-reload failures still return true. Handle these filesystem/process boundary failures and return false, preserving the current warning messages.

Based on learnings, explicit error handling is appropriate at filesystem and process boundaries.

🤖 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/actions/uninstall/run-plan.ts` around lines 620 - 658, The managed
gateway service cleanup flow should return false for every cleanup failure.
Update the read failure path and daemon-reload failure handling around the
visible service cleanup logic, and catch failures from runtime.rmSync so they
emit the existing warning style and mark disabled false; preserve successful
cleanup behavior and current warning messages.

Source: Learnings


953-980: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Honor --keep-openshell for all OpenShell processes.

Only stopHostGatewayProcesses is guarded. Lines 954-967 still stop OpenShell forwards, dashboard listeners, and orphaned OpenShell processes when retention was requested. Move all OpenShell-specific cleanup into the same guard and test those observable calls.

As per path instructions, migrated lifecycle tests must prove public entrypoints cannot execute the superseded or excluded path.

🤖 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/actions/uninstall/run-plan.ts` around lines 953 - 980, The uninstall
flow currently stops OpenShell forward processes, dashboard listeners, and
orphaned processes even when --keep-openshell is set. In the relevant uninstall
action, move stopMatchingPids, stopStaleDashboardListeners, and
stopOrphanedOpenShell inside the existing !options.keepOpenShell guard alongside
stopHostGatewayProcesses, and update lifecycle tests to verify the public
entrypoint makes none of these cleanup calls when retention is requested.

Source: Path instructions

🤖 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 1152-1169: Use one exact ownership predicate for managed gateway
units: in scripts/install.sh lines 1152-1169, replace substring marker checks in
the removal and overwrite paths with a check matching the complete generated “#
NEMOCLAW_MANAGED_OPENSHELL_GATEWAY=1” line; apply the identical exact-line check
in src/lib/actions/uninstall/run-plan.ts lines 619-629 before disabling or
deleting the unit, leaving foreign units untouched.
- Around line 1143-1158: In install_nemoclaw_openshell_gateway_user_service,
check upstream_openshell_gateway_user_service_installed and remove any marked
NemoClaw override before resolving the gateway binary. Move the gateway_bin
resolution below that ownership check, preserving the existing early return
after upstream cleanup and only requiring the binary for package-managed service
installation.

In `@src/lib/onboard/docker-driver-gateway-service.test.ts`:
- Around line 332-344: Update the “warns for actionable service install
failures” test to isolate filesystem-dependent service-unit detection, such as
mocking existsSync or the helper’s unit-path check, so host-installed OpenShell
systemd units cannot alter control flow. Preserve the existing gatewayBin
whitespace input and expected warn call while ensuring installation reaches the
actionable failure path deterministically.

In `@src/lib/onboard/docker-driver-gateway-service.ts`:
- Around line 230-236: The managed-service allowlist must not include the parsed
ExecStart value. Update the return object in the service configuration flow
around readNemoclawManagedOpenShellGatewayUserServiceExecStart to use only
getNemoclawOpenShellGatewayUserServiceBinaryPaths(home), and ensure installation
validation uses this same fixed trusted-path set rather than the unit’s declared
executable path.

---

Outside diff comments:
In `@scripts/install.sh`:
- Around line 1218-1223: Update the OpenShell setup flow around the if-missing
check so detecting an existing openshell skips only installation, not service
reconciliation. Ensure prefer_user_local_openshell and
install_nemoclaw_openshell_gateway_user_service always run, while the
install-openshell.sh command runs only when OpenShell is missing.

In `@src/lib/actions/uninstall/run-plan.ts`:
- Around line 620-658: The managed gateway service cleanup flow should return
false for every cleanup failure. Update the read failure path and daemon-reload
failure handling around the visible service cleanup logic, and catch failures
from runtime.rmSync so they emit the existing warning style and mark disabled
false; preserve successful cleanup behavior and current warning messages.
- Around line 953-980: The uninstall flow currently stops OpenShell forward
processes, dashboard listeners, and orphaned processes even when
--keep-openshell is set. In the relevant uninstall action, move
stopMatchingPids, stopStaleDashboardListeners, and stopOrphanedOpenShell inside
the existing !options.keepOpenShell guard alongside stopHostGatewayProcesses,
and update lifecycle tests to verify the public entrypoint makes none of these
cleanup calls when retention is requested.

In `@src/lib/onboard/docker-driver-gateway-service.ts`:
- Around line 480-499: Update isBenignGatewayUserServiceInstallSkip so
"OpenShell gateway binary not found" is no longer treated as benign, allowing
installAndReportNemoclawOpenShellGatewayUserService to emit its warning for that
reason. Add or update coverage for the warning behavior when no gateway binary
is available.
🪄 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: 0c5d04f3-040f-40b2-8381-6acfbf286982

📥 Commits

Reviewing files that changed from the base of the PR and between 38e2505 and 2015c82.

📒 Files selected for processing (9)
  • docs/manage-sandboxes/uninstall-nemoclaw.mdx
  • docs/reference/architecture.mdx
  • docs/reference/commands.mdx
  • scripts/install.sh
  • src/lib/actions/uninstall/run-plan-gateway-service.test.ts
  • src/lib/actions/uninstall/run-plan.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts
  • test/install-openshell-gateway-service.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/manage-sandboxes/uninstall-nemoclaw.mdx
  • docs/reference/architecture.mdx

Comment thread scripts/install.sh Resolved
Comment thread scripts/install.sh Resolved

@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: 3

🤖 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/docker-driver-gateway-env.ts`:
- Around line 308-312: Move assertDockerDriverGatewayAuthConfigSafe(gatewayEnv)
before installAndReportNemoclawOpenShellGatewayUserService in the onboarding
flow, so invalid authentication configuration is rejected before any
managed-unit or filesystem state is created. Preserve the existing gatewayBin
guard and installation behavior for valid configurations.
- Around line 263-266: Update getUserConfigHome to derive its fallback base
directory from env.HOME when provided, otherwise os.homedir(), while preserving
the absolute XDG_CONFIG_HOME behavior. Add a regression test covering an
overridden HOME with no XDG_CONFIG_HOME and verify the resulting config path
uses that HOME.

In `@test/install-openshell-gateway-service.test.ts`:
- Around line 52-87: Update the test case around the temporary directory created
by mkdtempSync to wrap the subprocess execution and assertions in a try/finally
block, and call fs.rmSync(tmp, { recursive: true, force: true }) in the finally
block so the fake installation is always removed.
🪄 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: bec1e9e6-8084-4d28-b6ee-47cd0e76d9b3

📥 Commits

Reviewing files that changed from the base of the PR and between 2015c82 and 81df387.

📒 Files selected for processing (10)
  • docs/manage-sandboxes/uninstall-nemoclaw.mdx
  • docs/reference/commands.mdx
  • scripts/install.sh
  • src/lib/actions/uninstall/run-plan-gateway-service.test.ts
  • src/lib/actions/uninstall/run-plan.ts
  • src/lib/onboard/docker-driver-gateway-env-service.test.ts
  • src/lib/onboard/docker-driver-gateway-env.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts
  • test/install-openshell-gateway-service.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • scripts/install.sh
  • docs/reference/commands.mdx
  • src/lib/actions/uninstall/run-plan.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts

@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

🤖 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 `@test/install-openshell-gateway-service.test.ts`:
- Around line 90-120: Update each temporary-directory test setup using tmp in
the affected ranges, including the shown case and the sections at 124-161 and
165-205, to wrap the subprocess and assertions in try/finally. In every finally
block, remove tmp with recursive, forced cleanup via fs.rmSync, ensuring cleanup
runs on both passing and failing assertions.
🪄 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: 08750619-98a3-4235-a1da-045a7db9aee6

📥 Commits

Reviewing files that changed from the base of the PR and between 81df387 and a826519.

📒 Files selected for processing (6)
  • scripts/install.sh
  • src/lib/actions/uninstall/run-plan-gateway-service.test.ts
  • src/lib/actions/uninstall/run-plan.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts
  • test/install-openshell-gateway-service.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • scripts/install.sh
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/actions/uninstall/run-plan.ts
  • src/lib/actions/uninstall/run-plan-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts

@sandl99

sandl99 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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.

♻️ Duplicate comments (1)
src/lib/onboard/docker-driver-gateway-service.ts (1)

126-127: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use one effective XDG configuration root for the unit and its environment file.

The service path, installation call, and %E environment file can resolve to different user configuration trees.

  • src/lib/onboard/docker-driver-gateway-service.ts#L126-L127: Resolve the unit under XDG_CONFIG_HOME/systemd/user, falling back to the effective HOME/.config.
  • src/lib/onboard/docker-driver-gateway-env.ts#L263-L307: Pass the effective environment/home into installation and write gateway.env beneath the same XDG configuration root.
🤖 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/docker-driver-gateway-service.ts` around lines 126 - 127, Use
one effective XDG configuration root for the gateway unit and environment file:
update getNemoclawOpenShellGatewayUserServicePath to resolve
XDG_CONFIG_HOME/systemd/user, falling back to the effective HOME/.config; in
src/lib/onboard/docker-driver-gateway-env.ts lines 263-307, pass the effective
environment/home into installation and write gateway.env beneath that same root.
🤖 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.

Duplicate comments:
In `@src/lib/onboard/docker-driver-gateway-service.ts`:
- Around line 126-127: Use one effective XDG configuration root for the gateway
unit and environment file: update getNemoclawOpenShellGatewayUserServicePath to
resolve XDG_CONFIG_HOME/systemd/user, falling back to the effective
HOME/.config; in src/lib/onboard/docker-driver-gateway-env.ts lines 263-307,
pass the effective environment/home into installation and write gateway.env
beneath that same root.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c49bd4c3-fe43-4196-8d17-9fc2e7b0bcd5

📥 Commits

Reviewing files that changed from the base of the PR and between 81df387 and 08bd056.

📒 Files selected for processing (9)
  • docs/manage-sandboxes/uninstall-nemoclaw.mdx
  • docs/reference/commands.mdx
  • scripts/install.sh
  • src/lib/actions/uninstall/run-plan-gateway-service.test.ts
  • src/lib/actions/uninstall/run-plan.ts
  • src/lib/onboard/docker-driver-gateway-env.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts
  • test/install-openshell-gateway-service.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/manage-sandboxes/uninstall-nemoclaw.mdx
  • src/lib/actions/uninstall/run-plan.ts
  • scripts/install.sh
  • src/lib/onboard/docker-driver-gateway-service.test.ts

@sandl99

sandl99 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sandl99 sandl99 changed the title fix(install): manage openshell gateway user service fix(install): manage openshell gateway user as service daemon Jul 15, 2026
openshell_bin="${brew_prefix}/bin/openshell"
[ -n "$brew_prefix" ] && [ -x "$openshell_bin" ] \
|| openshell_bin="$(command -v openshell 2>/dev/null || true)"
[ -n "$openshell_bin" ] && [ -x "$openshell_bin" ] \
@sandl99 sandl99 removed the VDR Linked to VDR finding label Jul 15, 2026
@sandl99
sandl99 marked this pull request as draft July 15, 2026 18:12
@copy-pr-bot

copy-pr-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@sandl99

sandl99 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Closing this PR so implementation can restart from origin/main against the lifecycle design in #6903 (comment). The replacement will preserve this PR as prior evidence and will use a fresh branch and review history.

@sandl99 sandl99 closed this Jul 21, 2026
@cv
cv deleted the fix/install-openshell-gateway-service branch November 21, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery enhancement New capability or improvement request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install and uninstall a managed OpenShell gateway service for reboot persistence

2 participants