fix(cli): dispatch sandbox agent to terminal runtimes - #5815
Conversation
|
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:
📝 WalkthroughWalkthroughThe agent wrapper docs and CLI behavior now dispatch ChangesSandbox agent command flow
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
|
🌿 Preview your docs: https://nvidia-preview-pr-5815.docs.buildwithfern.com/nemoclaw |
PR Review Advisor — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
Review findings by urgency: 0 required fixes, 1 item to resolve/justify, 0 in-scope improvements
|
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: None Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
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 `@docs/reference/commands.mdx`:
- Line 565: Split the combined documentation line into separate source lines so
each sentence appears on its own line; update the relevant prose in commands.mdx
around the remote command exit code and stdout streaming text so the wrapper
exit-code sentence and the streaming-buffering sentence are each standalone,
preserving the existing meaning while matching the one-sentence-per-line style
guide.
🪄 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: 9b9987af-4668-48e0-81a3-3fd04397c554
📒 Files selected for processing (6)
docs/reference/commands-nemohermes.mdxdocs/reference/commands.mdxsrc/commands/sandbox/agent.test.tssrc/commands/sandbox/agent.tssrc/lib/actions/sandbox/agent/passthrough.test.tssrc/lib/actions/sandbox/agent/passthrough.ts
…-passthrough # Conflicts: # docs/reference/commands.mdx # src/lib/actions/sandbox/agent/passthrough-help.ts # src/lib/actions/sandbox/agent/passthrough.test.ts # src/lib/actions/sandbox/agent/passthrough.ts
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 `@src/lib/actions/sandbox/agent/passthrough.ts`:
- Around line 332-345: The passthrough flow in
getPassthroughCommand/ensureLiveSandboxOrExit currently lets OpenClaw help
tokens fall through to rejectNoTargetSelector, breaking local wrapper help
behavior. Update the logic in passthrough.ts so
isOpenClawPassthroughCommand(command) with extraArgs like --help or -h
short-circuits before phase/selector validation, while still leaving
terminal-runtime commands free to handle their own help path.
🪄 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: 681a3e10-3170-4cb7-be53-2facd755cb99
📒 Files selected for processing (5)
docs/reference/commands.mdxsrc/commands/sandbox/agent.tssrc/lib/actions/sandbox/agent/passthrough-help.tssrc/lib/actions/sandbox/agent/passthrough.test.tssrc/lib/actions/sandbox/agent/passthrough.ts
✅ Files skipped from review due to trivial changes (1)
- src/lib/actions/sandbox/agent/passthrough-help.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/commands/sandbox/agent.ts
- docs/reference/commands.mdx
<!-- markdownlint-disable MD041 --> ## Summary Fixes the `nemoclaw <name> agent` host wrapper so registered terminal-runtime sandboxes dispatch through their manifest command instead of being short-circuited by OpenClaw-only help handling. This lets LangChain Deep Agents Code sandboxes receive bare `dcode` and `dcode --help` invocations while preserving local wrapper help for OpenClaw fallback cases. ## Related Issue Fixes NVIDIA#5790 ## Changes - Route terminal-runtime sandboxes through their manifest `interactive_command`/`headless_command` in `runAgentPassthrough`. - Keep bare and help invocations local only for OpenClaw sandboxes or registry fallbacks. - Update command parsing tests and passthrough tests for Deep Agents Code bare/help dispatch. - Update the command reference and generated Hermes command reference wording for the broader agent wrapper behavior. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [x] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates <!-- Check all that apply. For any "covered by existing tests", "not applicable", or waiver entry, add a brief justification on the same line or in the Changes section. --> - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: self-review completed; the change remains registry-gated, keeps registry read errors fail-closed, preserves OpenClaw fallback behavior, and keeps Hermes rejected with API guidance. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification <!-- Check each item you ran and confirmed. Leave unchecked items you skipped. Doc-only changes do not require npm test unless you ran it. --> - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [ ] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [x] Targeted tests pass for changed behavior - [ ] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [x] 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) Verification notes: - `npx vitest run src/commands/sandbox/agent.test.ts src/lib/actions/sandbox/agent/passthrough.test.ts src/lib/actions/sandbox/agent/passthrough-help.test.ts --project cli` passed. - `npm run typecheck:cli` passed. - `npm run docs` completed with 0 errors and 2 pre-existing Fern warnings about an available Fern upgrade. - Local `test-cli` hook failed in unrelated rlimit tests with `fork: Resource temporarily unavailable`; reproduced with `npx vitest run test/sandbox-init.test.ts test/sandbox-rlimit-hooks.test.ts --project cli`. --- <!-- DCO sign-off is required in this PR description, and every commit must appear as Verified in GitHub. Run: git config user.name && git config user.email --> Signed-off-by: Carlos Villela <cvillela@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * The sandbox agent command runs a single non-interactive “agent turn” and forwards agent flags to the in-sandbox target; Deep Agents Code sandboxes route to the configured terminal-runtime command, including `--help` forwarding. * **Bug Fixes** * Corrected `--help` and bare invocation dispatch behavior. * Improved fail-closed validation and safer manifest command parsing; invalid quoted/escaped commands are refused with clearer Hermes HTTP API guidance. * **Documentation** * Updated sandbox-agent reference and passthrough help wording and examples (including Hermes HTTP API notes). * **Tests** * Expanded coverage for routing, guard semantics, exit codes, and help/forwarding parity. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Fixes the
nemoclaw <name> agenthost wrapper so registered terminal-runtime sandboxes dispatch through their manifest command instead of being short-circuited by OpenClaw-only help handling. This lets LangChain Deep Agents Code sandboxes receive baredcodeanddcode --helpinvocations while preserving local wrapper help for OpenClaw fallback cases.Related Issue
Fixes #5790
Changes
interactive_command/headless_commandinrunAgentPassthrough.Type of Change
Quality Gates
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Verification notes:
npx vitest run src/commands/sandbox/agent.test.ts src/lib/actions/sandbox/agent/passthrough.test.ts src/lib/actions/sandbox/agent/passthrough-help.test.ts --project clipassed.npm run typecheck:clipassed.npm run docscompleted with 0 errors and 2 pre-existing Fern warnings about an available Fern upgrade.test-clihook failed in unrelated rlimit tests withfork: Resource temporarily unavailable; reproduced withnpx vitest run test/sandbox-init.test.ts test/sandbox-rlimit-hooks.test.ts --project cli.Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
--helpforwarding.--helpand bare invocation dispatch behavior.