Repository navigation
Conversation
Signed-off-by: San Dang <[email protected]>
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughNemoClaw 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 ChangesOpenShell gateway service lifecycle
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage remains at 96%, unchanged from the TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most impacted files.
Updated |
PR Review Advisor — InformationalAdvisor assessment: Informational / high confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: 2 optional E2E recommendations
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
src/lib/onboard/docker-driver-gateway-service.test.ts (1)
194-220: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winAssert the installed directory and unit permissions.
The test supplies
mkdirSyncandchmodSyncmocks but never verifies0700for the directory or0600for 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
📒 Files selected for processing (9)
docs/manage-sandboxes/uninstall-nemoclaw.mdxdocs/reference/architecture.mdxdocs/reference/commands.mdxscripts/install-openshell.shsrc/lib/actions/uninstall/run-plan-gateway-service.test.tssrc/lib/actions/uninstall/run-plan.tssrc/lib/onboard.tssrc/lib/onboard/docker-driver-gateway-service.test.tssrc/lib/onboard/docker-driver-gateway-service.ts
Signed-off-by: San Dang <[email protected]>
There was a problem hiding this comment.
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 winReport 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 winConfigure the gateway service even when OpenShell is already installed.
The
if-missingreturn 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 winReport every managed-unit cleanup failure as an incomplete uninstall.
Read failures currently return success,
rmSynccan throw, and daemon-reload failures still returntrue. Handle these filesystem/process boundary failures and returnfalse, 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 winHonor
--keep-openshellfor all OpenShell processes.Only
stopHostGatewayProcessesis 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
📒 Files selected for processing (9)
docs/manage-sandboxes/uninstall-nemoclaw.mdxdocs/reference/architecture.mdxdocs/reference/commands.mdxscripts/install.shsrc/lib/actions/uninstall/run-plan-gateway-service.test.tssrc/lib/actions/uninstall/run-plan.tssrc/lib/onboard/docker-driver-gateway-service.test.tssrc/lib/onboard/docker-driver-gateway-service.tstest/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
Signed-off-by: San Dang <[email protected]>
There was a problem hiding this comment.
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
📒 Files selected for processing (10)
docs/manage-sandboxes/uninstall-nemoclaw.mdxdocs/reference/commands.mdxscripts/install.shsrc/lib/actions/uninstall/run-plan-gateway-service.test.tssrc/lib/actions/uninstall/run-plan.tssrc/lib/onboard/docker-driver-gateway-env-service.test.tssrc/lib/onboard/docker-driver-gateway-env.tssrc/lib/onboard/docker-driver-gateway-service.test.tssrc/lib/onboard/docker-driver-gateway-service.tstest/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
Signed-off-by: San Dang <[email protected]>
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
scripts/install.shsrc/lib/actions/uninstall/run-plan-gateway-service.test.tssrc/lib/actions/uninstall/run-plan.tssrc/lib/onboard/docker-driver-gateway-service.test.tssrc/lib/onboard/docker-driver-gateway-service.tstest/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
This reverts commit a826519.
This reverts commit 81df387.
Signed-off-by: San Dang <[email protected]>
Signed-off-by: San Dang <[email protected]>
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/lib/onboard/docker-driver-gateway-service.ts (1)
126-127: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winUse one effective XDG configuration root for the unit and its environment file.
The service path, installation call, and
%Eenvironment file can resolve to different user configuration trees.
src/lib/onboard/docker-driver-gateway-service.ts#L126-L127: Resolve the unit underXDG_CONFIG_HOME/systemd/user, falling back to the effectiveHOME/.config.src/lib/onboard/docker-driver-gateway-env.ts#L263-L307: Pass the effective environment/home into installation and writegateway.envbeneath 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
📒 Files selected for processing (9)
docs/manage-sandboxes/uninstall-nemoclaw.mdxdocs/reference/commands.mdxscripts/install.shsrc/lib/actions/uninstall/run-plan-gateway-service.test.tssrc/lib/actions/uninstall/run-plan.tssrc/lib/onboard/docker-driver-gateway-env.tssrc/lib/onboard/docker-driver-gateway-service.test.tssrc/lib/onboard/docker-driver-gateway-service.tstest/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
|
@coderabbitai review |
✅ Action performedReview finished.
|
| 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" ] \ |
Signed-off-by: San Dang <[email protected]>
Signed-off-by: San Dang <[email protected]>
Signed-off-by: San Dang <[email protected]>
|
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. |
|
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. |
Summary
NemoClaw now uses OpenShell's
openshell-gateway.servicedaemon 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-openshellpreserves OpenShell service daemons.Related Issue
Fixes #6903
Changes
openshell-gateway.serviceuser unit from the NemoClaw installer/onboard path for tarball OpenShell installs.systemctl --user enableandrestart, with identity checks for unit path and the actualExecStart.ExecStartpaths before writing, replacing, or removing a unit.openshell-gatewayprocess under--keep-openshell; full uninstall removes only NemoClaw-marked Linux user units and never removes upstream Linux package units or the macOS Homebrew service.Type of Change
Quality Gates
--keep-openshellservice/config preservation, macOS no-op behavior, and uninstall failure reporting.Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablesource-shape-test-budgetskipped because this local checkout has ignoredworktrees/*directories that the scanner traverses.git push origin HEAD— pre-push hook passed.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-openshellconfig preservation fix.bash -n scripts/install.sh— passednpm run check:installer-hash— passednpm run typecheck:cli— passednpm run test-size:check— passedgit diff --check— passednpm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:npm run docsbuilds without warnings (doc changes only)npm run docspassed with 0 errors and 2 existing Fern warnings.Signed-off-by: San Dang [email protected]
Summary by CodeRabbit
New Features
--keep-openshell.Documentation