Skip to content

refactor(cli): extract sandbox skill install action - #2887

Merged
cv merged 8 commits into
mainfrom
refactor/oclif-extract-skill-install-action
May 4, 2026
Merged

refactor(cli): extract sandbox skill install action#2887
cv merged 8 commits into
mainfrom
refactor/oclif-extract-skill-install-action

Conversation

@cv

@cv cv commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Extract the sandbox skill install command implementation from src/nemoclaw.ts into a dedicated action module. This removes sandboxSkillInstall from the transitional runtime bridge while preserving the existing oclif wrapper and legacy fallback behavior.

Stack Navigation

Changes

  • Added src/lib/sandbox-skill-install-action.ts for skill install usage, plugin-shape detection, validation, upload, post-install, and verification flow.
  • Updated src/lib/sandbox-runtime-actions.ts and the legacy skill fallback to call the extracted action.
  • Removed sandboxSkillInstall from src/nemoclaw.ts and NemoClawRuntimeBridge.

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)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make 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: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Refactor
    • Reorganized internal skill installation implementation for improved code structure and maintainability. The skill installation feature continues to work as before with no changes to user-facing functionality or command-line interface.

@cv cv self-assigned this May 2, 2026
@copy-pr-bot

copy-pr-bot Bot commented May 2, 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.

@coderabbitai

coderabbitai Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Skill installation functionality is refactored from the NemoClawRuntimeBridge interface to a standalone CLI action module. The sandboxSkillInstall bridge method is removed, and a new sandbox-skill-install-action.ts module implements the full installation flow with SKILL.md parsing, file validation, and SSH-based uploads.

Changes

Skill Installation Refactoring

Layer / File(s) Summary
Interface Update
src/lib/nemoclaw-runtime-bridge.ts
NemoClawRuntimeBridge interface no longer exports sandboxSkillInstall method.
New CLI Action Implementation
src/lib/sandbox-skill-install-action.ts
New module adds installSandboxSkill, printSkillInstallUsage, looksLikeOpenClawPlugin, and printPluginInstallHint. Implements full skill install flow: parses/validates SKILL.md, checks for unsafe files, verifies sandbox is live, uploads via SSH, runs post-install hooks, verifies success, and cleans up temp SSH config.
Integration Updates
src/lib/sandbox-runtime-actions.ts, src/nemoclaw.ts
installSandboxSkill in sandbox-runtime-actions.ts now dynamically requires and calls the new action module. nemoclaw.ts removes old skill-install import, removes sandboxSkillInstall from exported bridge, and updates legacy skill subcommand dispatch to invoke the new action implementation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Skill install takes flight,
From bridge to action pure and right,
With SSH and frontmatter's glow,
New paths for sandboxes to grow!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% 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 pull request title accurately describes the main change: extracting the sandbox skill install action from the runtime bridge into a dedicated module.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 refactor/oclif-extract-skill-install-action

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

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

@cv cv added the v0.0.34 label May 4, 2026
cv added a commit that referenced this pull request May 4, 2026
## Summary
Extract shared sandbox gateway-state and liveness helpers from
`src/nemoclaw.ts` into reusable CLI library modules. This reduces the
legacy entrypoint surface before moving connect, status, skill install,
and lifecycle actions out of the runtime bridge.

## Stack Navigation
- Position: 1 of 60
- Previous PR: base branch `main`
- Next PR: [#2887 — refactor(cli): extract sandbox skill install
action](#2887)

## Changes
- Added `src/lib/sandbox-gateway-state-action.ts` for sandbox liveness,
gateway reconciliation, live-policy merging, and lifecycle guidance
helpers.
- Added `src/lib/terminal-style.ts` for shared CLI color constants.
- Updated `src/nemoclaw.ts` to import the extracted sandbox
gateway-state helpers instead of defining them inline.
- Updated `src/lib/share-command-deps.ts` to depend on extracted helpers
instead of requiring `../nemoclaw`.
- Removed stale `sandboxLogs` from `NemoClawRuntimeBridge`.

## Type of Change
- [x] 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)

## Verification
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [ ] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

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

* **New Features**
* Enhanced sandbox diagnostics with live-policy display and guided
recovery steps.

* **Bug Fixes**
* More accurate sandbox presence/status detection, identity-drift
handling, and gateway reconnection.

* **Chores**
* Refactored sandbox/gateway wiring and share-command startup for
reliability.
  * Unified terminal color handling.
* Removed sandbox log streaming (log-following is no longer available).
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
@cv
cv changed the base branch from refactor/oclif-extract-sandbox-live-state to main May 4, 2026 17:34
@cv
cv marked this pull request as ready for review May 4, 2026 17:34
@cv
cv enabled auto-merge (squash) May 4, 2026 17:35

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

🧹 Nitpick comments (1)
src/nemoclaw.ts (1)

2534-2540: Run the recommended sandbox recovery E2Es before merge.

Since this touches src/nemoclaw.ts dispatch, run the two selective nightly jobs to guard against unintended regressions in sandbox recovery flows.

As per coding guidelines, "E2E test recommendation: sandbox-survival-e2e — gateway restart recovery; sandbox-operations-e2e — process recovery after gateway kill."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/nemoclaw.ts` around lines 2534 - 2540, This touches the sandbox dispatch
branch in src/nemoclaw.ts (case "skill" calling installSandboxSkill(sandboxName,
actionArgs)), so before merging run the two recommended sandbox recovery E2E
jobs: execute the nightly "sandbox-survival-e2e" (gateway restart recovery) and
"sandbox-operations-e2e" (process recovery after gateway kill) against the
current branch to verify no regressions in sandbox recovery flows; if either
test fails, capture failures, fix the dispatch/installation flow around
installSandboxSkill and re-run until both pass.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/nemoclaw.ts`:
- Around line 2534-2540: This touches the sandbox dispatch branch in
src/nemoclaw.ts (case "skill" calling installSandboxSkill(sandboxName,
actionArgs)), so before merging run the two recommended sandbox recovery E2E
jobs: execute the nightly "sandbox-survival-e2e" (gateway restart recovery) and
"sandbox-operations-e2e" (process recovery after gateway kill) against the
current branch to verify no regressions in sandbox recovery flows; if either
test fails, capture failures, fix the dispatch/installation flow around
installSandboxSkill and re-run until both pass.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 286b7e2a-2be7-4762-a46f-19ec2f4efc71

📥 Commits

Reviewing files that changed from the base of the PR and between 73c6a91 and ac56565.

📒 Files selected for processing (4)
  • src/lib/nemoclaw-runtime-bridge.ts
  • src/lib/sandbox-runtime-actions.ts
  • src/lib/sandbox-skill-install-action.ts
  • src/nemoclaw.ts
💤 Files with no reviewable changes (1)
  • src/lib/nemoclaw-runtime-bridge.ts

@prekshivyas prekshivyas 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. Clean lift-and-shift — verified the four extracted symbols are byte-identical to the on-main originals (only export keywords, the sandboxSkillInstallinstallSandboxSkill rename, and an inconsequential template-literal-to-string tweak). Argument shape preserved end-to-end through both the oclif wrapper and the legacy case "skill" dispatch. No zombies — block edits to migrated legacy paths check confirms.

Scope is tight: the work commit touches exactly the 4 expected files, no test churn, no Dockerfile drift. Notably cleaner than #2886.

One non-blocking note: the new action consumes D, G, R, YW from terminal-style.ts, making it the second module to depend on the extracted color constants. That's the start of the migration #2886 deferred — worth mentioning in the description, but not blocking.

Auto-merge will land this once build-sandbox-images (x86) finishes — arm64 and everything else are already green.

@cv
cv merged commit 6cb3b88 into main May 4, 2026
17 of 18 checks passed
@prekshivyas
prekshivyas deleted the refactor/oclif-extract-skill-install-action branch May 4, 2026 17:42
cv added a commit that referenced this pull request May 4, 2026
## Summary
Extract sandbox connect and sandbox process recovery logic from
`src/nemoclaw.ts` into dedicated CLI action modules. This removes
`sandboxConnect` from the transitional runtime bridge while keeping
existing connect, probe, status health, and rebuild post-upgrade
behavior intact.

## Stack Navigation
- Position: 3 of 60
- Previous PR: [#2887 — refactor(cli): extract sandbox skill install
action](#2887)
- Next PR: [#2892 — refactor(cli): extract sandbox status
action](#2892)

## Changes
- Added `src/lib/sandbox-connect-action.ts` for connect help/argument
parsing, probe-only checks, inference route swapping, readiness polling,
and OpenShell connection handoff.
- Added `src/lib/sandbox-process-recovery-action.ts` for sandbox
SSH/exec helpers, gateway process probes, and automatic gateway process
recovery.
- Updated `src/lib/sandbox-runtime-actions.ts` to call the extracted
connect action instead of `NemoClawRuntimeBridge`.
- Updated `src/nemoclaw.ts` status/rebuild paths to import the extracted
process helpers.
- Removed `sandboxConnect` from `src/nemoclaw.ts` and
`NemoClawRuntimeBridge`.

## Type of Change
- [x] 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)

## Verification
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [ ] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


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

* **New Features**
* Added `--probe-only` flag for sandbox connection to check gateway
health without full connection.
* Enhanced sandbox connection with automatic gateway recovery and
configurable timeout via `NEMOCLAW_CONNECT_TIMEOUT`.
* Automatic dashboard port forwarding verification during sandbox
connection.

* **Improvements**
* Better error detection and recovery for failed sandboxes during
connection.
  * Clearer status feedback when sandbox connection is ready.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
@wscurran wscurran added the refactor PR restructures code without intended behavior change label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants