Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThe PR adds ambient environment isolation for sandbox recreate, pins rebuild-time session values from registry data, fails closed when a recreate endpoint cannot be derived, and changes installer completion output when post-onboard sandbox upgrades fail. ChangesSandbox rebuild and installer reporting
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 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 |
c1a080f to
75af68e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/actions/sandbox/rebuild-flow.test.ts (1)
576-602: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the known-remote branch actually repins
session.endpointUrl.This test only proves the rebuild does not abort. If
updateSession()stops clearing/replacing a stale endpoint from another sandbox, this case would still pass while recreating against the wrong URL.Suggested assertion
try { const harness = createRebuildFlowHarness({ applyPreset: () => true, sandboxEntry: { provider: "nvidia-prod", model: "nvidia/nemotron" }, sessionSandboxName: "some-other-sandbox", }); + harness.session.endpointUrl = "https://stale.example.test/v1"; await expect( harness.rebuildSandbox("alpha", ["--yes"], { throwOnError: true }), ).resolves.toBeUndefined(); expect(harness.onboardSpy).toHaveBeenCalled(); + expect(harness.session.endpointUrl).not.toBe("https://stale.example.test/v1"); expect(harness.runOpenshellSpy).toHaveBeenCalledWith( ["sandbox", "delete", "alpha"], expect.objectContaining({ ignoreError: true }), );Based on learnings from the PR objective, this branch is meant to repin endpoint values from authoritative registry/provider config rather than reuse unrelated session state.
🤖 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/sandbox/rebuild-flow.test.ts` around lines 576 - 602, The known-remote rebuild test only checks that the flow completes, but it should also verify that the stale session endpoint gets repinned from the authoritative provider/registry data. Update the rebuild flow test around createRebuildFlowHarness and rebuildSandbox to assert the resulting session.endpointUrl is replaced with the canonical endpoint for the nvidia-prod target, so a stale URL from another sandbox cannot slip through while the test still passes.
🤖 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-upgrade-sandboxes-severity.test.ts`:
- Around line 35-38: The spawned shell in this test is inheriting ambient
environment state through spawnSync, which can allow external Bash hooks like
BASH_ENV to run before the snippet. Update the spawnSync call in
install-upgrade-sandboxes-severity.test.ts to use a hermetic environment for the
bash invocation by explicitly controlling the env passed to the snippet, while
preserving only the minimal required variables for the test. Keep the fix
localized to the spawnSync setup around print_done() so the test behavior stays
deterministic.
---
Nitpick comments:
In `@src/lib/actions/sandbox/rebuild-flow.test.ts`:
- Around line 576-602: The known-remote rebuild test only checks that the flow
completes, but it should also verify that the stale session endpoint gets
repinned from the authoritative provider/registry data. Update the rebuild flow
test around createRebuildFlowHarness and rebuildSandbox to assert the resulting
session.endpointUrl is replaced with the canonical endpoint for the nvidia-prod
target, so a stale URL from another sandbox cannot slip through while the test
still passes.
🪄 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: a38f871b-6be9-4902-9d05-07f1000a03a9
📒 Files selected for processing (6)
scripts/install.shsrc/lib/actions/sandbox/rebuild-env-isolation.test.tssrc/lib/actions/sandbox/rebuild-env-isolation.tssrc/lib/actions/sandbox/rebuild-flow.test.tssrc/lib/actions/sandbox/rebuild.tstest/install-upgrade-sandboxes-severity.test.ts
…IA#5735) The installer runs `upgrade-sandboxes --auto` right after onboarding. When the operator exported a different agent/provider for that onboard (e.g. NEMOCLAW_AGENT=langchain-deepagents-code, NEMOCLAW_PROVIDER_KEY=sk-...), those ambient values leaked into each existing sandbox's rebuild: the old OpenClaw sandbox was backed up, deleted, then recreated as the wrong agent (Deep Agents) with an invalid key — destroying the sandbox before a failed/mismatched recreate, while the installer still printed a clean completion banner. A rebuild must recreate a sandbox from its own recorded registry/session config, never from an unrelated onboard's ambient env. - Isolate NEMOCLAW_AGENT/PROVIDER/PROVIDER_KEY/ENDPOINT_URL/MODEL for the duration of the `onboard --resume` recreate so the registry-pinned session (and the already-registered gateway provider) wins. Restored in `finally`. - Surface the agent mismatch before any destructive backup/delete. - Pin credentialEnv from the target registry provider, and repin the endpoint from the provider's canonical config when the loaded session belongs to a different sandbox. - Fail closed *before* delete when a non-matching session targets a custom/OpenAI-compatible provider whose base URL is only in its own session (nvidia-router and known remotes remain registry/blueprint-derivable, so they are not aborted). - Installer: a failed `upgrade-sandboxes --auto` no longer prints a clean "Installation complete" banner; it reports completion with warnings and recovery guidance. Proven end-to-end through the real worktree CLI against a live gateway: with the contaminating Deep Agents env set, pre-fix `upgrade-sandboxes --auto` deleted an OpenClaw sandbox and recreated it as Deep Agents (incomplete state restore); post-fix the same command rebuilt it as OpenClaw and it stayed Ready. Signed-off-by: Yimo Jiang <[email protected]>
75af68e to
b0079da
Compare
|
Superseded by #5787, opened from NVIDIA/NemoClaw branch so trusted PR advisor workflows can run. |
|
Closing in favor of #5787. |
… (#5787) ## Summary The installer runs `upgrade-sandboxes --auto` immediately after onboarding. When the operator had exported a different agent/provider for that onboard (e.g. `NEMOCLAW_AGENT=langchain-deepagents-code` + `NEMOCLAW_PROVIDER_KEY=sk-...`), those ambient values leaked into every existing sandbox's rebuild: the old OpenClaw sandbox was backed up, **deleted, then recreated as the wrong agent (Deep Agents) with an invalid key** — destroying the sandbox before a failed/mismatched recreate, while the installer still printed a clean "Installation complete" banner. A rebuild must recreate a sandbox from its own recorded registry/session config, never from an unrelated onboard's ambient env. ## Related Issue Fixes #5735 ## Changes - **Isolate ambient onboard-selection env during recreate** — `NEMOCLAW_AGENT`, `NEMOCLAW_PROVIDER`, `NEMOCLAW_PROVIDER_KEY`, `NEMOCLAW_ENDPOINT_URL`, `NEMOCLAW_MODEL` are removed for the duration of the `onboard --resume` recreate (restored in `finally`), so the registry-pinned session and the already-registered gateway provider win. New `rebuild-env-isolation.ts` helper. - **Surface the agent mismatch before any destructive backup/delete.** - **Pin authoritative resume fields** — `credentialEnv` from the target registry provider; repin the endpoint from the provider's canonical config when the loaded session belongs to a different sandbox. - **Fail closed before delete** when a non-matching session targets a custom OpenAI/Anthropic-compatible provider whose base URL exists only in its own session (`nvidia-router` and known remotes stay registry/blueprint-derivable and are not aborted). - **Installer severity** — a failed `upgrade-sandboxes --auto` no longer prints a clean completion banner; it reports "completed with warnings" plus the affected sandbox / backup path / recovery commands. ## Type of Change - [x] Code change (feature, bug fix, or refactor) ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] 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 - [x] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed **Real-CLI E2E (live gateway, isolated dedicated-port gateway + temp registry):** created a real OpenClaw `nvidia-prod` sandbox, marked it stale, exported the reporter's `NEMOCLAW_AGENT=langchain-deepagents-code` + `NEMOCLAW_PROVIDER_KEY=sk-...`, and ran `./bin/nemoclaw.js upgrade-sandboxes --auto`. - **Pre-fix:** the OpenClaw sandbox was deleted and recreated as **Deep Agents** (registry `agent=langchain-deepagents-code`) with incomplete state restore — data loss. - **Post-fix:** the same command logged *"Ignoring ambient NEMOCLAW_AGENT=… — rebuilding as its recorded agent 'openclaw'"* and rebuilt it as **OpenClaw**, staying `Ready`. Targeted unit tests: `rebuild-env-isolation.test.ts`, `rebuild-flow.test.ts` (env isolation + custom-endpoint pre-delete abort + nvidia-router/known-remote proceed), `install-upgrade-sandboxes-severity.test.ts`, plus `repro-2201.test.ts` and the sandbox/onboard suites. `tsc -p tsconfig.cli.json` clean; reviewed with `codex review --uncommitted` (findings addressed). --- Signed-off-by: Yimo Jiang <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added helpers to sanitize and isolate ambient recreate-selection environment values during sandbox rebuild/resume. * Rebuild now derives a consistent `onboard --resume` configuration, with conditional endpoint pinning and safer resume/session updates. * Installer now reports “completed with warnings” when automatic sandbox upgrades fail. * **Bug Fixes** * Prevented ambient onboarding variables from steering recreate/resume behavior. * Installer now returns a non-zero status when the auto-upgrade did not finish. * **Tests** * Added/extended Vitest coverage for env isolation, rebuild edge cases, and installer banner/exit-code severity. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- Supersedes #5770 (reopened from NVIDIA/NemoClaw branch so trusted advisor workflows can run). --------- Signed-off-by: Yimo Jiang <[email protected]>
…IA#5735) (NVIDIA#5787) ## Summary The installer runs `upgrade-sandboxes --auto` immediately after onboarding. When the operator had exported a different agent/provider for that onboard (e.g. `NEMOCLAW_AGENT=langchain-deepagents-code` + `NEMOCLAW_PROVIDER_KEY=sk-...`), those ambient values leaked into every existing sandbox's rebuild: the old OpenClaw sandbox was backed up, **deleted, then recreated as the wrong agent (Deep Agents) with an invalid key** — destroying the sandbox before a failed/mismatched recreate, while the installer still printed a clean "Installation complete" banner. A rebuild must recreate a sandbox from its own recorded registry/session config, never from an unrelated onboard's ambient env. ## Related Issue Fixes NVIDIA#5735 ## Changes - **Isolate ambient onboard-selection env during recreate** — `NEMOCLAW_AGENT`, `NEMOCLAW_PROVIDER`, `NEMOCLAW_PROVIDER_KEY`, `NEMOCLAW_ENDPOINT_URL`, `NEMOCLAW_MODEL` are removed for the duration of the `onboard --resume` recreate (restored in `finally`), so the registry-pinned session and the already-registered gateway provider win. New `rebuild-env-isolation.ts` helper. - **Surface the agent mismatch before any destructive backup/delete.** - **Pin authoritative resume fields** — `credentialEnv` from the target registry provider; repin the endpoint from the provider's canonical config when the loaded session belongs to a different sandbox. - **Fail closed before delete** when a non-matching session targets a custom OpenAI/Anthropic-compatible provider whose base URL exists only in its own session (`nvidia-router` and known remotes stay registry/blueprint-derivable and are not aborted). - **Installer severity** — a failed `upgrade-sandboxes --auto` no longer prints a clean completion banner; it reports "completed with warnings" plus the affected sandbox / backup path / recovery commands. ## Type of Change - [x] Code change (feature, bug fix, or refactor) ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] 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 - [x] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed **Real-CLI E2E (live gateway, isolated dedicated-port gateway + temp registry):** created a real OpenClaw `nvidia-prod` sandbox, marked it stale, exported the reporter's `NEMOCLAW_AGENT=langchain-deepagents-code` + `NEMOCLAW_PROVIDER_KEY=sk-...`, and ran `./bin/nemoclaw.js upgrade-sandboxes --auto`. - **Pre-fix:** the OpenClaw sandbox was deleted and recreated as **Deep Agents** (registry `agent=langchain-deepagents-code`) with incomplete state restore — data loss. - **Post-fix:** the same command logged *"Ignoring ambient NEMOCLAW_AGENT=… — rebuilding as its recorded agent 'openclaw'"* and rebuilt it as **OpenClaw**, staying `Ready`. Targeted unit tests: `rebuild-env-isolation.test.ts`, `rebuild-flow.test.ts` (env isolation + custom-endpoint pre-delete abort + nvidia-router/known-remote proceed), `install-upgrade-sandboxes-severity.test.ts`, plus `repro-2201.test.ts` and the sandbox/onboard suites. `tsc -p tsconfig.cli.json` clean; reviewed with `codex review --uncommitted` (findings addressed). --- Signed-off-by: Yimo Jiang <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added helpers to sanitize and isolate ambient recreate-selection environment values during sandbox rebuild/resume. * Rebuild now derives a consistent `onboard --resume` configuration, with conditional endpoint pinning and safer resume/session updates. * Installer now reports “completed with warnings” when automatic sandbox upgrades fail. * **Bug Fixes** * Prevented ambient onboarding variables from steering recreate/resume behavior. * Installer now returns a non-zero status when the auto-upgrade did not finish. * **Tests** * Added/extended Vitest coverage for env isolation, rebuild edge cases, and installer banner/exit-code severity. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- Supersedes NVIDIA#5770 (reopened from NVIDIA/NemoClaw branch so trusted advisor workflows can run). --------- Signed-off-by: Yimo Jiang <[email protected]>
Summary
The installer runs
upgrade-sandboxes --autoimmediately after onboarding. When the operator had exported a different agent/provider for that onboard (e.g.NEMOCLAW_AGENT=langchain-deepagents-code+NEMOCLAW_PROVIDER_KEY=sk-...), those ambient values leaked into every existing sandbox's rebuild: the old OpenClaw sandbox was backed up, deleted, then recreated as the wrong agent (Deep Agents) with an invalid key — destroying the sandbox before a failed/mismatched recreate, while the installer still printed a clean "Installation complete" banner. A rebuild must recreate a sandbox from its own recorded registry/session config, never from an unrelated onboard's ambient env.Related Issue
Fixes #5735
Changes
NEMOCLAW_AGENT,NEMOCLAW_PROVIDER,NEMOCLAW_PROVIDER_KEY,NEMOCLAW_ENDPOINT_URL,NEMOCLAW_MODELare removed for the duration of theonboard --resumerecreate (restored infinally), so the registry-pinned session and the already-registered gateway provider win. Newrebuild-env-isolation.tshelper.credentialEnvfrom the target registry provider; repin the endpoint from the provider's canonical config when the loaded session belongs to a different sandbox.nvidia-routerand known remotes stay registry/blueprint-derivable and are not aborted).upgrade-sandboxes --autono longer prints a clean completion banner; it reports "completed with warnings" plus the affected sandbox / backup path / recovery commands.Type of Change
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesReal-CLI E2E (live gateway, isolated dedicated-port gateway + temp registry): created a real OpenClaw
nvidia-prodsandbox, marked it stale, exported the reporter'sNEMOCLAW_AGENT=langchain-deepagents-code+NEMOCLAW_PROVIDER_KEY=sk-..., and ran./bin/nemoclaw.js upgrade-sandboxes --auto.agent=langchain-deepagents-code) with incomplete state restore — data loss.Ready.Targeted unit tests:
rebuild-env-isolation.test.ts,rebuild-flow.test.ts(env isolation + custom-endpoint pre-delete abort + nvidia-router/known-remote proceed),install-upgrade-sandboxes-severity.test.ts, plusrepro-2201.test.tsand the sandbox/onboard suites.tsc -p tsconfig.cli.jsonclean; reviewed withcodex review --uncommitted(findings addressed).Signed-off-by: Yimo Jiang [email protected]
Summary by CodeRabbit
New Features
Bug Fixes
Tests