Repository navigation
fix(sandbox): observe host gateway on probe-only and wait for readiness before probing - #7192
Conversation
…ss before probing Sandbox-scoped commands (`recover`, `start`, `connect --probe-only`) now run reconciliation in `observe` mode, so a transient host gateway RPC error surfaces with explicit guidance instead of implicitly reaping and replacing the shared host OpenShell gateway. Probe-only also waits for the target sandbox to reach `Ready`/`Running` (default 300s, still honouring `NEMOCLAW_CONNECT_TIMEOUT`) before inspecting in-sandbox processes or host forwards, so a cold ~two-minute Hermes boot succeeds on the first invocation. Fixes #7173 Signed-off-by: Tinson Lai <[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:
📝 WalkthroughWalkthroughThe changes add observe-only gateway reconciliation, centralize sandbox readiness polling, delay probe operations until readiness, expand readiness-focused tests and mocks, and document host gateway versus sandbox-scoped recovery behavior. ChangesSandbox recovery flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant connectSandbox
participant ensureLiveSandboxOrExit
participant OpenShell
participant InSandboxProbe
connectSandbox->>ensureLiveSandboxOrExit: choose observe or recover mode
connectSandbox->>OpenShell: poll sandbox list
OpenShell-->>connectSandbox: report readiness
connectSandbox->>ensureLiveSandboxOrExit: recheck recorded gateway
connectSandbox->>InSandboxProbe: probe after Ready or Running
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 / medium 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: 2
🤖 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/manage-sandboxes/recover-rebuild-sandboxes.mdx`:
- Line 89: Update the host gateway repair command in the shared documentation to
use the variant-aware `$$nemoclaw onboard` placeholder instead of bare `nemoclaw
onboard`, while leaving the other commands unchanged.
- Around line 83-87: Scope the “Host OpenShell Gateway Versus In-Sandbox Agent
Recovery” guidance to gateway-capable sandboxes by wrapping the gateway-specific
claims in an AgentOnly block for the openclaw and hermes variants. Ensure Deep
Agents instead see guidance to use rebuild, consistent with the existing
instructions.
🪄 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: cd8eeeb8-e8cf-4ad5-83cd-42079af49022
📒 Files selected for processing (6)
docs/manage-sandboxes/recover-rebuild-sandboxes.mdxsrc/lib/actions/sandbox/connect-probe-observe.test.tssrc/lib/actions/sandbox/connect-route-containment.test.tssrc/lib/actions/sandbox/connect.tssrc/lib/actions/sandbox/gateway-state-observe-mode.test.tssrc/lib/actions/sandbox/gateway-state.ts
Probe-only connect now waits for sandbox readiness via `openshell sandbox list` before probing. Several pre-existing fake openshell scripts and the shared connect-flow harness only stubbed `sandbox get`, so the new wait hung until timeout. Add matching `sandbox list` stubs, and derive the harness's default list output from the registry entry name instead of hardcoding 'alpha'. The drift-recovery quoting test used a sandbox name containing a literal space, which the whitespace-column `sandbox list` parser can never match; swap it for a hyphen while keeping the apostrophe that the test actually exercises. Signed-off-by: Tinson Lai <[email protected]>
The host-vs-in-sandbox gateway recovery section referenced an in-sandbox agent gateway unconditionally, but Deep Agents sandboxes have no such gateway. Wrap it in an AgentOnly block and use the variant-aware $$nemoclaw placeholder for the onboarding command. Signed-off-by: Tinson Lai <[email protected]>
Co-authored-by: Tinson Lai <[email protected]> Signed-off-by: Apurv Kumaria <[email protected]>
Co-authored-by: Tinson Lai <[email protected]> Signed-off-by: Apurv Kumaria <[email protected]>
apurvvkumaria
left a comment
There was a problem hiding this comment.
Two exact-head readiness issues need correction before merge:
-
waitForSandboxReadyOrExit()still runs an unscopedopenshell sandbox list. OpenShell gateway selection is process-global and can change while the 300-second loop runs. A concurrent CLI can therefore make a same-named sandbox on a sibling gateway appear Ready; the later recorded-owner recheck then exits instead of continuing to wait for the intended sandbox. Pin every readiness poll to the sandbox registry’s recorded gateway (sandbox list -g <gateway>) and add a regression assertion that all polls carry that exact gateway. -
On the new probe-only 300-second timeout path, the printed override is also 300 seconds and the suggested command omits
--probe-only. The retry is therefore neither longer nor behaviorally equivalent. Print an actually larger budget and preserve the probe-only command form.
Please keep the post-wait owner recheck as defense in depth and retain the no-process/no-forward-mutation-before-readiness tests.
Co-authored-by: Tinson Lai <[email protected]> Signed-off-by: Apurv Kumaria <[email protected]>
|
Final docs audit found one additional boundary mismatch: the new sentence says |
Co-authored-by: Tinson Lai <[email protected]> Signed-off-by: Apurv Kumaria <[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 `@src/lib/actions/sandbox/connect-probe-observe.test.ts`:
- Around line 110-120: Extend the timeout test for connectSandbox in
createConnectHarness to assert that harness.checkAndRecoverSpy has not been
called after the rejection. Preserve the existing exit and guidance 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: 09cf2b31-8e08-4e90-b273-e0c60bc29dc7
📒 Files selected for processing (6)
docs/manage-sandboxes/recover-rebuild-sandboxes.mdxdocs/reference/commands.mdxsrc/lib/actions/sandbox/connect-probe-observe.test.tssrc/lib/actions/sandbox/connect-route-containment.test.tssrc/lib/actions/sandbox/connect.tstest/support/connect-flow-test-harness.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- test/support/connect-flow-test-harness.ts
- src/lib/actions/sandbox/connect-route-containment.test.ts
- docs/manage-sandboxes/recover-rebuild-sandboxes.mdx
- src/lib/actions/sandbox/connect.ts
Co-authored-by: Tinson Lai <[email protected]> Signed-off-by: Apurv Kumaria <[email protected]>
Co-authored-by: Tinson Lai <[email protected]> Signed-off-by: Apurv Kumaria <[email protected]>
apurvvkumaria
left a comment
There was a problem hiding this comment.
Exact-head re-review complete at 74700b2. The gateway-scoped readiness polling, probe-only timeout guidance, failure-semantics coverage, and documentation corrections address the requested changes. All review threads are resolved; focused validation, platform smoke lanes, security scans, automated advisors, and ordinary CI are clean. Approving for protected E2E coordination; this is not a merge action.
<!-- markdownlint-disable MD041 --> ## Summary Add the canonical dated changelog entry for NemoClaw `v0.0.89` before the release plan captures the tag commit. The entry summarizes the user-visible Station preparation, inference, recovery, policy-disclosure, and CLI-containment changes merged since `v0.0.88`. ## Changes - Add `docs/changelog/2026-07-20.mdx` with the exact `## v0.0.89` release heading, parser-safe SPDX comment, summary, and detailed bullets. - Link each shipped theme to the most specific published OpenClaw documentation routes. - Keep internal E2E, advisory-registry, and review-workflow refactors out of the user-facing release summary. Source summary: - #7214, #7241, #7237, #7223, #7204, #7202, #7183, and #7090 -> `docs/changelog/2026-07-20.mdx`: Summarize qualified DGX Station identity, package-state, PackageKit, DKMS, and reboot-handoff fixes. - #7242, #7221, #7186, #7164, and #6874 -> `docs/changelog/2026-07-20.mdx`: Summarize inference endpoint provenance, provider attachment, managed vLLM cleanup and progress, and Ollama selection guidance. - #7225, #7216, #7192, #7136, #7096, and #6910 -> `docs/changelog/2026-07-20.mdx`: Summarize sandbox readiness, recovery guidance, rebuilt model routing, durable Hermes state, and gateway restart behavior. - #7187 -> `docs/changelog/2026-07-20.mdx`: Summarize complete effective messaging-preset egress disclosure before policy mutation. - #7218, #7165, and #7184 -> `docs/changelog/2026-07-20.mdx`: Summarize structured output containment, terminal-safe route display, and Hermes forward cleanup. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [x] 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: - [x] Tests not applicable — justification: This PR adds release-history prose only; the focused changelog contract test validates its required structure and routes. - [x] 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: - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — `mise exec [email protected] -- npx vitest run test/changelog-docs.test.ts` (6 passed). - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — not applicable to this doc-only release entry. - [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) — `mise exec [email protected] -- npm run docs` completed with 0 errors and 2 existing site-wide warnings. - [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) — the native changelog entry uses the required parser-safe MDX SPDX comment and does not use frontmatter. --- Signed-off-by: Aaron Erickson <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Expanded DGX Station installation support for qualified GB300 and OTA-upgraded environments. * Preserved selected inference providers, endpoints, model pins, and tuning settings during sandbox creation and rebuilds. * Improved sandbox recovery by validating availability and stability before restarting services. * Added clearer policy output showing the complete effective messaging egress configuration. * **Bug Fixes** * Hardened status and inference route displays by sanitizing terminal control characters. * Improved Hermes uninstall behavior by stopping detached dashboard forwarding. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Aaron Erickson <[email protected]>
<!-- markdownlint-disable MD041 --> ## Summary Starting a stopped sandbox recovered in-sandbox processes and host forwards before OpenShell had re-registered the sandbox, so recovery raced cold registration. `start` reported a recovery failure and left the primary dashboard and API host forward unstarted, while the `recover` the operator then ran succeeded because it waits for readiness first. `start` now waits for the sandbox to reach the `Ready` or `Running` state before it recovers, using the same budget and `NEMOCLAW_CONNECT_TIMEOUT` override as `connect --probe-only`. ## Related Issue Fixes #8978 ## Changes - `src/lib/actions/sandbox/start.ts`: `restoreStoppedSandboxStartupState` waits for the `Ready` or `Running` state between the locked-access restore and process recovery. The locked-access restore stays ahead of the wait because sealed state blocks the container's own startup; it runs over the direct container, so it does not depend on OpenShell re-registration. The new step is injectable through the existing `SandboxStartupStateDeps` seam, which the three added tests use. - `src/lib/actions/sandbox/connect.ts`: export `waitForSandboxReadyOrExit` and add `SANDBOX_REPAIR_READY_TIMEOUT_SEC`, replacing the literal `300` that `connect --probe-only` already used. This is a shared constant rather than a second literal so the two paths that prove the same readiness for the same sandbox cannot drift again; the added `start` ordering test protects the contract. - `src/lib/actions/sandbox/start.test.ts`: three tests covering the readiness position for OpenClaw, for a sandbox with no sealed state, and across the whole `start` sequence. Each was confirmed to fail without the fix. One existing test is retitled because its old title described the ordering this change corrects. - `docs/manage-sandboxes/run-sandboxes.mdx` and `docs/reference/commands.mdx`: document the corrected sequence, the readiness budget, its override, and the timeout result. This restores the ordering established for #7173 by #7192. #8146 introduced process recovery ahead of the readiness wait on the `start` path only, so `connect --probe-only` kept the ordering and `start` lost it. The recovery-owned budget in `process-recovery.ts` is deliberately untouched: it also backs the `gateway restart` health wait and the onboarding control-plane wait, and with the ordering corrected the reported failure no longer depends on it. ## 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 one tests line and one docs line. Check other lines when applicable. Add every requested justification or approval reference. --> - [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: Maintainer security and cross-issue review passed for commit `51b25f270`; no findings: #8990 (comment) - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review <!-- Required for code and documentation changes after the changes and applicable validation are complete. Keep one review checkbox and one instance of each visible or hidden field. For Evidence, list changed documentation paths. For documentation-only changes, also state that the writing rules and documentation style were reviewed. For other results, explain why no documentation change is needed or why the review is blocked. For Agent, use a consistent product and surface name, such as Codex Desktop, Codex CLI, Claude Code, or Cursor. After committing all review changes, put `git rev-parse --short HEAD` and `git rev-parse --short HEAD:AGENTS.md` in the hidden metadata below. Rerun the review and refresh that metadata after any new commit. This receipt is advisory during the data-collection pilot. --> - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: `docs/manage-sandboxes/run-sandboxes.mdx` and `docs/reference/commands.mdx`. The `start` command waits for the OpenShell `Ready` or `Running` state before agent-specific recovery. Documentation distinguishes gateway-runtime recovery for OpenClaw and Hermes from terminal-runtime verification for Deep Agents Code. - Agent: Codex Desktop <!-- docs-review-head-sha: df90422 --> <!-- docs-review-agents-blob-sha: e30afb2 --> ## DGX Station Hardware Evidence <!-- Required only when scripts/prepare-dgx-station-host.sh changes. Maintainers must review the linked evidence before approving or merging. This is human-reviewed evidence, not authenticated hardware provenance. Exceptional bypasses use existing repository governance and must be documented on the PR. --> - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification <!-- Check each applicable item only when supported by the requested evidence. Run targeted tests once per relevant change set and rerun after later edits or hook autofixes that can affect the tested behavior. Do not rerun hook-covered checks. --> - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run validate:pr` passed after refreshing `origin/main` when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: `npx vitest run --project cli src/lib/actions/sandbox/start.test.ts src/lib/actions/sandbox/process-recovery.test.ts src/lib/actions/sandbox/connect-probe-observe.test.ts` — 97 passed. `npx vitest run --project integration test/process-recovery.test.ts test/process-recovery-supervisor-relaunch.test.ts test/process-recovery-managed-controller.test.ts test/process-recovery-custom-agent.test.ts test/cli/connect-readiness.test.ts test/cli/connect-recovery-settle.test.ts test/sandbox-stuck-recovery.test.ts test/cli/dispatch-basics.test.ts test/cli/docker-outage.test.ts` — 141 passed. `npm run typecheck:cli` and `npm --prefix nemoclaw run typecheck` — 0 errors. The three added tests were each confirmed to fail with the fix reverted. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: - [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) — builds with 0 errors and the 2 warnings already present on `main`. - [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) --- Signed-off-by: Tinson Lai <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Sandbox startup now waits for readiness before recovering agent processes and host forwards. - Startup and connection commands use a 300-second readiness timeout, preserve existing containers if readiness times out, and report configured retry settings. - OpenClaw restores locked startup access before readiness checks when Shields are enabled. - Deep Agents verifies the managed terminal runtime before confirming startup success. - **Documentation** - Updated sandbox startup and command references to describe readiness checks, timeout behavior, and recovery ordering. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Tinson Lai <[email protected]> Signed-off-by: Carlos Villela <[email protected]> Co-authored-by: Carlos Villela <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
Sandbox-scoped commands (
recover,start,connect --probe-only) now run gateway reconciliation inobservemode, so a transient host gateway RPC error surfaces with explicit next-step guidance instead of implicitly reaping and replacing the shared host OpenShell gateway process. Probe-only additionally waits for the target sandbox to reachReadyorRunning(default 300 s, still honouringNEMOCLAW_CONNECT_TIMEOUT) before inspecting in-sandbox processes or host forwards, so a cold ~two-minute Hermes boot succeeds on the first invocation.Related Issue
Fixes #7173
Changes
GatewayRecoveryMode = "observe" | "recover"togetReconciledSandboxGatewayState()andensureLiveSandboxOrExit()(defaultrecoverpreserves the existing contract for every other caller). Observe mode returnsgateway_errorverbatim; the outer helper prints host-gateway guidance and exits without invokingrecoverNamedGatewayRuntime().connect.tsinto a reusablewaitForSandboxReadyOrExit(sandboxName, { defaultTimeoutSec, successLogs })helper; probe-only now calls it with a 300 s default budget before delegating torunSandboxConnectProbe, and the full-connect path calls it with the existing 120 s default. Both paths still honourNEMOCLAW_CONNECT_TIMEOUT.gatewayRecovery: "observe"from the probe-only branch ofconnectSandboxthroughensureLiveSandboxOrExit.connect --probe-only, indocs/manage-sandboxes/recover-rebuild-sandboxes.mdx.docs/reference/commands.mdxwith the exact 120 s interactive and 300 s probe-only readiness budgets, the post-wait recorded-gateway recheck, sandbox-scoped process/forward repair, and the no-host-gateway-restart boundary.gateway-state-observe-mode.test.tscovering the observe-vs-recover contract and default-recover regression.connect-probe-observe.test.tscovering probe-only observe-mode propagation, readiness-before-recovery ordering, and the 300 s probe-only timeout budget.connect-route-containment.test.tsto allow the pre-probesandbox listreadiness call while still forbiddingsandbox get/execroute reads and every route-repair spy.Type of Change
Quality Gates
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 unavailablenpm run test:changed— 33 files, 346 tests passed;npx vitest runon the two new files andconnect-route-containment.test.ts— 19 tests passed.npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:npm run docscompleted successfully (doc changes only) — 0 errors; 2 existing Fern warningsSigned-off-by: Tinson Lai [email protected]
Summary by CodeRabbit
connect --probe-onlynow waits for readiness, verifies/repairs sandbox-scoped gateway/forwarding, then rechecks before proceeding—without restarting the shared host gateway.