Skip to content

fix(rebuild): preserve legacy OpenClaw restores - #6534

Merged
cv merged 3 commits into
mainfrom
codex/fix-release-e2e-regressions
Jul 9, 2026
Merged

cv merged 3 commits into
mainfrom
codex/fix-release-e2e-regressions

Conversation

@cjagwani

@cjagwani cjagwani commented Jul 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes the two deterministic failure families that blocked the v0.0.78 release candidate. It restores legacy and stock OpenClaw backups without weakening authoritative custom-image provenance checks, makes the device-auth fixture reachable from inside OpenShell sandboxes, and prevents incomplete rebuilds from appearing green in E2E.

Changes

  • Preserve fresh image-managed extension directories while passing plugin provenance to the openclaw.json merge only when the backup contains the corresponding previous baseline.
  • Cover missing, known-empty, and populated previous-provenance restore paths, including stale image-owned configuration removal and fresh/user-owned state preservation.
  • Bind the device-auth fake inference service to the runner host bridge and advertise host.openshell.internal to the sandbox.
  • Require the rebuild E2E to observe the explicit success message and reject incomplete post-restore completion.

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)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: the runtime fix restores the documented backup/restore contract without changing commands, configuration, defaults, migrations, or operator actions; the remaining changes are test-only.
  • 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: focused correctness review confirmed that missing legacy provenance takes the compatibility path, authoritative empty and populated provenance still reconcile, marked custom-image manifests remain fail-closed, and the random-port fake server follows the existing OpenShell host-bridge test pattern.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • 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/state/sandbox-recreated-openclaw-restore.test.ts src/lib/state/openclaw-config-restore-input.test.ts src/lib/state/openclaw-config-merge.test.ts src/lib/state/openclaw-plugin-restore.test.ts (68 passed)
    • npx vitest run --project integration test/snapshot-openclaw-managed-extensions.test.ts --reporter=verbose (6 passed)
    • npx vitest run --project e2e-support test/e2e/support/device-auth-health-helpers.test.ts test/e2e/support/rebuild-openclaw-old-base-context.test.ts (7 passed)
    • npm run typecheck:cli and npm run test:projects:check passed
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run 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: Charan Jagwani cjagwani@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Improved sandbox restore so recreated OpenClaw environments reliably restore openclaw.json configuration and extension/plugin state from rebuild artifacts.
    • Prevent restore from attempting configuration reconciliation when prior plugin-install provenance is incomplete, and correctly reconciles differing provenance when present.
    • Ensured stale user extensions are cleaned up during restore and extension markers are restored as expected.
    • Improved live health-check connectivity by adjusting sandbox network/bridge host settings.
    • Rebuild now produces clearer success output and avoids “post-restore steps were incomplete” messaging.
  • Tests

    • Added coverage for restore reconciliation and strengthened e2e rebuild output assertions.

@cjagwani cjagwani self-assigned this Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4a36b887-7402-4d17-bb74-04f8380c4e5e

📥 Commits

Reviewing files that changed from the base of the PR and between b8b84fc and c2fbd61.

📒 Files selected for processing (1)
  • src/lib/state/sandbox-recreated-openclaw-restore.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/state/sandbox-recreated-openclaw-restore.test.ts

📝 Walkthrough

Walkthrough

This PR updates OpenClaw restore reconciliation inputs, adds recreated sandbox restore coverage, and tightens two live e2e assertions for host reachability and rebuild output.

Changes

Recreated sandbox restore and e2e validation

Layer / File(s) Summary
Config reconciliation baseline fix
src/lib/state/sandbox.ts
Introduces configFreshOpenClawImagePluginInstalls and passes it into restoreStateFile so openclaw.json reconciliation only uses a fresh plugin-install baseline when previous provenance exists.
Restore scenario harness
src/lib/state/sandbox-recreated-openclaw-restore.test.ts
Adds fixture helpers for sandbox/backup layout creation, manifest writing, executable stubs, and restore execution capture.
Restore assertions and cases
src/lib/state/sandbox-recreated-openclaw-restore.test.ts
Asserts successful restore outcomes, stale-extension cleanup, restored markers/config, and provenance reconciliation across the new restore scenarios.
Live e2e assertion updates
test/e2e/live/device-auth-health.test.ts, test/e2e/live/rebuild-openclaw.test.ts
Adds bridge host settings for the fake inference server and checks rebuild output for the success message without the incomplete-restore warning.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#5177: Both touch the OpenClaw openclaw.json restore/merge path and selective reconciliation inputs.

Suggested labels: integration: openclaw, area: sandbox, bug-fix

Suggested reviewers: cv, jyaunches

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing rebuild restore behavior to preserve legacy OpenClaw restores.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 codex/fix-release-e2e-regressions

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

@github-code-quality

github-code-quality Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the main branch.

TypeScript / code-coverage/cli

The overall coverage in the codex/fix-release-e2... branch remains at 76%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main f684ce8 codex/fix-release-e2... c2fbd61 +/-
src/lib/state/config-io.ts 96% 95% -1%
src/lib/inferen...ollama/proxy.ts 26% 25% -1%
src/lib/state/sandbox.ts 76% 77% +1%
src/lib/credentials/store.ts 59% 61% +2%
src/lib/inferen...time-context.ts 94% 96% +2%
src/lib/messagi.../persistence.ts 92% 95% +3%
src/lib/inference/config.ts 96% 100% +4%
src/lib/sandbox...vileged-exec.ts 82% 89% +7%
src/lib/state/o...estore-input.ts 86% 93% +7%

Updated July 09, 2026 03:04 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@cjagwani
cjagwani requested a review from cv July 9, 2026 02:53
@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: rebuild-openclaw, device-auth-health
Optional E2E: state-backup-restore, sandbox-rebuild

Dispatch hint: rebuild-openclaw,device-auth-health

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • rebuild-openclaw (high; timeout 130 minutes): Required because the product change affects recreated OpenClaw sandbox restore during rebuild, including plugin provenance/config reconciliation and state preservation. The existing rebuild-openclaw live job exercises the real rebuild CLI and validates the exact user-facing lifecycle most likely to regress.
  • device-auth-health (medium; timeout 40 minutes): Required to validate the modified live E2E fixture still works in CI and still covers the real device-auth health/status contract after changing how the fake inference endpoint is exposed to the sandbox.

Optional E2E

  • state-backup-restore (medium; timeout 60 minutes): Useful adjacent confidence because restoreSandboxStateInternal is shared with backup/restore behavior, but the code path changed here is primarily recreated OpenClaw restore with fresh image-plugin provenance rather than the normal workspace backup/restore flow.
  • sandbox-rebuild (high; timeout 90 minutes): Optional broader rebuild lifecycle check for state preservation and registry refresh. It is less targeted than rebuild-openclaw for OpenClaw image-plugin/config reconciliation but can catch generic rebuild regressions from the shared restore implementation.

New E2E recommendations

  • legacy/stock OpenClaw recreate config reconciliation (medium): The unit test now covers missing or empty previous image-plugin provenance during recreated restore, but there is no narrower live E2E that creates a stock-image or legacy OpenClaw backup without previous plugin provenance and verifies user plugins plus fresh image-managed plugins survive a recreate.
    • Suggested test: Add a targeted live recreate/rebuild regression that seeds an OpenClaw backup manifest with missing/empty previous image-plugin provenance, recreates from the current image, and verifies openclaw.json preserves fresh managed plugin config while restoring user plugin/channel state.

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: rebuild-openclaw,device-auth-health

@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

E2E Target Recommendation

Required E2E targets: device-auth-health, rebuild-openclaw
Optional E2E targets: None

Dispatch required E2E targets:

  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=device-auth-health
  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=rebuild-openclaw

Workflow run

Full E2E target advisor summary

E2E Target Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E targets

  • device-auth-health: Focused free-standing E2E job wired for changed live test test/e2e/live/device-auth-health.test.ts.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=device-auth-health
  • rebuild-openclaw: Focused free-standing E2E job wired for changed live test test/e2e/live/rebuild-openclaw.test.ts.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=rebuild-openclaw

Optional E2E targets

  • None.

Relevant changed files

  • src/lib/state/sandbox.ts
  • test/e2e/live/device-auth-health.test.ts
  • test/e2e/live/rebuild-openclaw.test.ts

@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — Changes requested

Merge posture: Do not merge yet
Primary next action: Resolve or justify PRA-1: Missing test for fail-closed custom-image provenance path (PRA-1).
Open items: 0 required · 3 warnings · 0 suggestions · 6 test follow-ups
Since last review: 0 prior items resolved · 2 still apply · 0 new items found

Action checklist

  • PRA-1 Resolve or justify: Missing test for fail-closed custom-image provenance path (PRA-1) in src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • PRA-2 Resolve or justify: Missing test for fresh plugin discovery failure propagation (PRA-2) in src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • PRA-3 Resolve or justify: Security Category 8 (Security Testing) - test coverage gaps for critical provenance paths in src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Runtime validation
  • PRA-T4 Add or justify test follow-up: Runtime validation
  • PRA-T5 Add or justify test follow-up: Missing test for fail-closed custom-image provenance path (PRA-1)
  • PRA-T6 Add or justify test follow-up: Missing test for fresh plugin discovery failure propagation (PRA-2)

Findings index

ID Severity Category Location Required action
PRA-1 Resolve/justify tests src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306 Add a test case in `sandbox-recreated-openclaw-restore.test.ts` that creates a manifest with `reconcileOpenClawImagePluginProvenance: true` but no `openclawImagePluginInstalls`, and asserts the restore fails with the expected error.
PRA-2 Resolve/justify tests src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306 Add a test case mocking a failed fresh discovery (e.g., SSH returns non-zero) and assert the restore returns the discovery error.
PRA-3 Resolve/justify security src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306 Add the two missing test cases (PRA-1, PRA-2) in this PR since they are local to the new test file.
Review findings by urgency: 0 required fixes, 3 items to resolve/justify, 0 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

PRA-1 Resolve/justify — Missing test for fail-closed custom-image provenance path (PRA-1)

  • Location: src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • Category: tests
  • Problem: The new test file covers missing/empty/populated provenance scenarios but does not test the `reconcileOpenClawImagePluginProvenance=true` manifest with missing/invalid `openclawImagePluginInstalls`, which should fail with `OPENCLAW_IMAGE_PLUGIN_PROVENANCE_RESTORE_ERROR`. This path is covered in `openclaw-plugin-restore.test.ts` but not through `restoreRecreatedSandboxState`.
  • Impact: Regression detection for custom-image provenance validation would only be caught by broader test suite, not by the focused recreation tests.
  • Recommended action: Add a test case in `sandbox-recreated-openclaw-restore.test.ts` that creates a manifest with `reconcileOpenClawImagePluginProvenance: true` but no `openclawImagePluginInstalls`, and asserts the restore fails with the expected error.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run `npx vitest run src/lib/state/sandbox-recreated-openclaw-restore.test.ts` after adding test; verify it exercises the error path at sandbox.ts:1577-1578.
  • Missing regression test: Test case: manifest with reconcileOpenClawImagePluginProvenance=true and missing openclawImagePluginInstalls → restore fails with OPENCLAW_IMAGE_PLUGIN_PROVENANCE_RESTORE_ERROR.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run `npx vitest run src/lib/state/sandbox-recreated-openclaw-restore.test.ts` after adding test; verify it exercises the error path at sandbox.ts:1577-1578.
  • Evidence: sandbox.ts:1577-1578 hasInvalidMarkedOpenClawPluginProvenance check; existing openclaw-plugin-restore.test.ts covers similar validation but not through restoreRecreatedSandboxState.

PRA-2 Resolve/justify — Missing test for fresh plugin discovery failure propagation (PRA-2)

  • Location: src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • Category: tests
  • Problem: When `discoverFreshOpenClawImagePluginInstalls` fails (e.g., sandbox unreachable, registry corrupt), the error should propagate through `restoreRecreatedSandboxState`. This path is not explicitly tested in the new file.
  • Impact: Discovery failures could surface as generic restore failures without clear error attribution.
  • Recommended action: Add a test case mocking a failed fresh discovery (e.g., SSH returns non-zero) and assert the restore returns the discovery error.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run `npx vitest run src/lib/state/sandbox-recreated-openclaw-restore.test.ts` after adding test; verify error matches discovery error format at sandbox.ts:1460-1470.
  • Missing regression test: Test case: freshOpenClawImagePluginInstalls discovery fails → restore returns discovery error with success:false.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run `npx vitest run src/lib/state/sandbox-recreated-openclaw-restore.test.ts` after adding test; verify error matches discovery error format at sandbox.ts:1460-1470.
  • Evidence: sandbox.ts:1460-1470 restoreRecreatedSandboxState calls discoverFreshOpenClawImagePluginInstalls and returns error on failure.

PRA-3 Resolve/justify — Security Category 8 (Security Testing) - test coverage gaps for critical provenance paths

  • Location: src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • Category: security
  • Problem: Two provenance validation paths lack unit test coverage in the new recreation-specific test file: (1) fail-closed for custom-image builds with marked provenance but missing installs, (2) fresh discovery error propagation. Both are security-relevant trust boundary checks.
  • Impact: Security regressions in provenance validation would not be caught by the focused test suite.
  • Recommended action: Add the two missing test cases (PRA-1, PRA-2) in this PR since they are local to the new test file.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run the new test file and verify both new tests exercise the error paths in sandbox.ts.
  • Missing regression test: Two test cases as described in PRA-1 and PRA-2 findings.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run the new test file and verify both new tests exercise the error paths in sandbox.ts.
  • Evidence: Security review Category 8 verdict WARNING; validation context testDepth verdict runtime_validation_recommended with gaps.

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

  • None.
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — Add unit test for reconcileOpenClawImagePluginProvenance=true with missing provenance (PRA-1). Sandbox restore is infrastructure-dependent (SSH, tar, OpenShell). Unit tests mock SSH layer effectively but runtime validation against real sandbox is needed for full confidence. Existing E2E rebuild-openclaw.test.ts provides runtime validation for happy path and legacy/stock-image rebuilds. Custom-image provenance fail-closed and discovery failure paths lack runtime validation.
  • PRA-T2 Runtime validation — Add unit test for discoverFreshOpenClawImagePluginInstalls failure propagation (PRA-2). Sandbox restore is infrastructure-dependent (SSH, tar, OpenShell). Unit tests mock SSH layer effectively but runtime validation against real sandbox is needed for full confidence. Existing E2E rebuild-openclaw.test.ts provides runtime validation for happy path and legacy/stock-image rebuilds. Custom-image provenance fail-closed and discovery failure paths lack runtime validation.
  • PRA-T3 Runtime validation — Runtime validation: E2E rebuild with custom-image backup where fresh discovery fails. Sandbox restore is infrastructure-dependent (SSH, tar, OpenShell). Unit tests mock SSH layer effectively but runtime validation against real sandbox is needed for full confidence. Existing E2E rebuild-openclaw.test.ts provides runtime validation for happy path and legacy/stock-image rebuilds. Custom-image provenance fail-closed and discovery failure paths lack runtime validation.
  • PRA-T4 Runtime validation — Runtime validation: E2E rebuild with custom-image backup where manifest has reconcileOpenClawImagePluginProvenance=true but missing openclawImagePluginInstalls. Sandbox restore is infrastructure-dependent (SSH, tar, OpenShell). Unit tests mock SSH layer effectively but runtime validation against real sandbox is needed for full confidence. Existing E2E rebuild-openclaw.test.ts provides runtime validation for happy path and legacy/stock-image rebuilds. Custom-image provenance fail-closed and discovery failure paths lack runtime validation.
  • PRA-T5 Missing test for fail-closed custom-image provenance path (PRA-1) — Add a test case in `sandbox-recreated-openclaw-restore.test.ts` that creates a manifest with `reconcileOpenClawImagePluginProvenance: true` but no `openclawImagePluginInstalls`, and asserts the restore fails with the expected error.
  • PRA-T6 Missing test for fresh plugin discovery failure propagation (PRA-2) — Add a test case mocking a failed fresh discovery (e.g., SSH returns non-zero) and assert the restore returns the discovery error.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Resolve/justify — Missing test for fail-closed custom-image provenance path (PRA-1)

  • Location: src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • Category: tests
  • Problem: The new test file covers missing/empty/populated provenance scenarios but does not test the `reconcileOpenClawImagePluginProvenance=true` manifest with missing/invalid `openclawImagePluginInstalls`, which should fail with `OPENCLAW_IMAGE_PLUGIN_PROVENANCE_RESTORE_ERROR`. This path is covered in `openclaw-plugin-restore.test.ts` but not through `restoreRecreatedSandboxState`.
  • Impact: Regression detection for custom-image provenance validation would only be caught by broader test suite, not by the focused recreation tests.
  • Recommended action: Add a test case in `sandbox-recreated-openclaw-restore.test.ts` that creates a manifest with `reconcileOpenClawImagePluginProvenance: true` but no `openclawImagePluginInstalls`, and asserts the restore fails with the expected error.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run `npx vitest run src/lib/state/sandbox-recreated-openclaw-restore.test.ts` after adding test; verify it exercises the error path at sandbox.ts:1577-1578.
  • Missing regression test: Test case: manifest with reconcileOpenClawImagePluginProvenance=true and missing openclawImagePluginInstalls → restore fails with OPENCLAW_IMAGE_PLUGIN_PROVENANCE_RESTORE_ERROR.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run `npx vitest run src/lib/state/sandbox-recreated-openclaw-restore.test.ts` after adding test; verify it exercises the error path at sandbox.ts:1577-1578.
  • Evidence: sandbox.ts:1577-1578 hasInvalidMarkedOpenClawPluginProvenance check; existing openclaw-plugin-restore.test.ts covers similar validation but not through restoreRecreatedSandboxState.

PRA-2 Resolve/justify — Missing test for fresh plugin discovery failure propagation (PRA-2)

  • Location: src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • Category: tests
  • Problem: When `discoverFreshOpenClawImagePluginInstalls` fails (e.g., sandbox unreachable, registry corrupt), the error should propagate through `restoreRecreatedSandboxState`. This path is not explicitly tested in the new file.
  • Impact: Discovery failures could surface as generic restore failures without clear error attribution.
  • Recommended action: Add a test case mocking a failed fresh discovery (e.g., SSH returns non-zero) and assert the restore returns the discovery error.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run `npx vitest run src/lib/state/sandbox-recreated-openclaw-restore.test.ts` after adding test; verify error matches discovery error format at sandbox.ts:1460-1470.
  • Missing regression test: Test case: freshOpenClawImagePluginInstalls discovery fails → restore returns discovery error with success:false.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run `npx vitest run src/lib/state/sandbox-recreated-openclaw-restore.test.ts` after adding test; verify error matches discovery error format at sandbox.ts:1460-1470.
  • Evidence: sandbox.ts:1460-1470 restoreRecreatedSandboxState calls discoverFreshOpenClawImagePluginInstalls and returns error on failure.

PRA-3 Resolve/justify — Security Category 8 (Security Testing) - test coverage gaps for critical provenance paths

  • Location: src/lib/state/sandbox-recreated-openclaw-restore.test.ts:306
  • Category: security
  • Problem: Two provenance validation paths lack unit test coverage in the new recreation-specific test file: (1) fail-closed for custom-image builds with marked provenance but missing installs, (2) fresh discovery error propagation. Both are security-relevant trust boundary checks.
  • Impact: Security regressions in provenance validation would not be caught by the focused test suite.
  • Recommended action: Add the two missing test cases (PRA-1, PRA-2) in this PR since they are local to the new test file.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run the new test file and verify both new tests exercise the error paths in sandbox.ts.
  • Missing regression test: Two test cases as described in PRA-1 and PRA-2 findings.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run the new test file and verify both new tests exercise the error paths in sandbox.ts.
  • Evidence: Security review Category 8 verdict WARNING; validation context testDepth verdict runtime_validation_recommended with gaps.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@cjagwani

cjagwani commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Advisor follow-up for PRA-1 / PRA-2: both fail-closed boundaries already have wiring-level integration coverage, so I have not duplicated them in the new compatibility-focused test file.

  • test/snapshot-recovery-validation.test.ts:114-128 calls restoreRecreatedSandboxState with reconcileOpenClawImagePluginProvenance: true and missing prior provenance, then asserts OPENCLAW_IMAGE_PLUGIN_PROVENANCE_RESTORE_ERROR.
  • test/snapshot-openclaw-managed-extensions.test.ts:281-317 feeds invalid fresh discovered provenance through restoreRecreatedSandboxState, asserts the discovery validation error is propagated, and verifies no second cleanup mutation occurs.

The new tests therefore stay scoped to the changed selection behavior: missing legacy provenance, authoritative known-empty provenance, and populated previous-to-fresh reconciliation. The existing managed-extension integration file passed locally (6/6), and the targeted live rebuild/upgrade jobs are running in E2E run 28990651976.

@cv
cv enabled auto-merge (squash) July 9, 2026 02:58
@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 0 suggestions · 2 test follow-ups

Action checklist

  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — restoreRecreatedSandboxState rejects a `reconcileOpenClawImagePluginProvenance: true` manifest with missing `openclawImagePluginInstalls` before restoring any dirs or files. The changed production code is in sandbox restore lifecycle logic and depends on OpenShell/SSH/tar behavior. The PR adds a focused local fake OpenShell/SSH restore test plus E2E assertions, which is good coverage for static review; runtime validation remains valuable for this class of change.
  • PRA-T2 Runtime validation — device-auth health E2E fixture remains reachable from inside the sandbox through `host.openshell.internal` while unauthenticated chat-completion requests are rejected. The changed production code is in sandbox restore lifecycle logic and depends on OpenShell/SSH/tar behavior. The PR adds a focused local fake OpenShell/SSH restore test plus E2E assertions, which is good coverage for static review; runtime validation remains valuable for this class of change.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@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/lib/state/sandbox-recreated-openclaw-restore.test.ts (1)

99-155: 🎯 Functional Correctness | 🔵 Trivial | ⚖️ Poor tradeoff

Mock's cleanup simulation doesn't exercise the real exclusion list — only the toContain assertions verify it.

The stub ssh's rm handler (Line 130-136) preserves entries from its own freshExtensionDirs closure, not by parsing cmd. That means staleUserExtensionExists/freshMarkers (Lines 202-203, 233-236) pass regardless of whether buildRestoreCleanupCommand actually emitted the right -name exclusions — the Line 243-244 cleanupCommand.toContain(...) checks are the only assertions tying the test to the real command-building logic, and they lock in on literal command text rather than observable behavior. As per path instructions, "Flag ... broad mocks that bypass the behavior under test, and conditionals that make a test pass without exercising its claim." Consider having the mock parse the exclusion names from cmd (or actually shell out to find) so the filesystem assertions genuinely depend on the production-generated command.

Also applies to: 243-244

🤖 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/state/sandbox-recreated-openclaw-restore.test.ts` around lines 99 -
155, The cleanup test is still passing through a stubbed rm branch that
preserves entries from a hardcoded freshExtensionDirs list instead of validating
the command built by buildRestoreCleanupCommand. Update the mock ssh handler to
derive the exclusion set from the actual cmd (or execute a real find-based
cleanup) so staleUserExtensionExists and freshMarkers only pass when the
generated -name exclusions are correct. Keep the focus on the ssh stub,
buildRestoreCleanupCommand, and the filesystem assertions in this test.

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.

Nitpick comments:
In `@src/lib/state/sandbox-recreated-openclaw-restore.test.ts`:
- Around line 99-155: The cleanup test is still passing through a stubbed rm
branch that preserves entries from a hardcoded freshExtensionDirs list instead
of validating the command built by buildRestoreCleanupCommand. Update the mock
ssh handler to derive the exclusion set from the actual cmd (or execute a real
find-based cleanup) so staleUserExtensionExists and freshMarkers only pass when
the generated -name exclusions are correct. Keep the focus on the ssh stub,
buildRestoreCleanupCommand, and the filesystem assertions in this test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 13cd1ff2-e1aa-463c-a936-1da229e89ad3

📥 Commits

Reviewing files that changed from the base of the PR and between f684ce8 and b8b84fc.

📒 Files selected for processing (4)
  • src/lib/state/sandbox-recreated-openclaw-restore.test.ts
  • src/lib/state/sandbox.ts
  • test/e2e/live/device-auth-health.test.ts
  • test/e2e/live/rebuild-openclaw.test.ts

@cv
cv merged commit 94af5e2 into main Jul 9, 2026
45 checks passed
@cv
cv deleted the codex/fix-release-e2e-regressions branch July 9, 2026 03:05
ericksoa pushed a commit that referenced this pull request Jul 9, 2026
<!-- markdownlint-disable MD041 -->
## Summary
This follow-up keeps the v0.0.78 release notes synchronized with PR
#6495, which merged after the original release-prep docs refresh. The
deeper network-policy reference already documents the exact endpoint,
methods, and managed binaries.

## Changes
- #6495 -> `docs/about/release-notes.mdx`: Add policy-routed repository
reads to the v0.0.78 lead and explain that managed Deep Agents Code
`fetch_url` uses NemoClaw's policy proxy with read-only
`raw.githubusercontent.com` access.
- Reviewed #6534 against the existing backup/restore and lifecycle
documentation; no additional prose is needed because it restores the
documented contract.

## 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
<!-- Check exactly one tests line and one docs line. Check other lines
when applicable. Add every requested justification or approval
reference. -->
- [ ] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [x] Tests not applicable — justification: release-note prose only; no
code sample or generated behavior changed.
- [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
<!-- 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 the DCO sign-off declaration 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 — tests are not applicable to prose-only
release notes
- [ ] 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) —
completed with 0 errors and 2 pre-existing Fern 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)

---
<!-- 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: Charan Jagwani <cjagwani@nvidia.com>


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

## Summary by CodeRabbit

* **Documentation**
* Updated release notes to reflect new opt-in thread-scoped
auto-approval and policy-routed repository reads.
* Added notes about sandboxed `fetch_url` handling for GitHub source
access and the allowed GitHub request types.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
This PR fixes the two deterministic failure families that blocked the
v0.0.78 release candidate. It restores legacy and stock OpenClaw backups
without weakening authoritative custom-image provenance checks, makes
the device-auth fixture reachable from inside OpenShell sandboxes, and
prevents incomplete rebuilds from appearing green in E2E.

## Changes
- Preserve fresh image-managed extension directories while passing
plugin provenance to the `openclaw.json` merge only when the backup
contains the corresponding previous baseline.
- Cover missing, known-empty, and populated previous-provenance restore
paths, including stale image-owned configuration removal and
fresh/user-owned state preservation.
- Bind the device-auth fake inference service to the runner host bridge
and advertise `host.openshell.internal` to the sandbox.
- Require the rebuild E2E to observe the explicit success message and
reject incomplete post-restore completion.

## 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)

## Quality Gates
<!-- Check exactly 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:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: the runtime fix restores the
documented backup/restore contract without changing commands,
configuration, defaults, migrations, or operator actions; the remaining
changes are test-only.
- [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: focused correctness
review confirmed that missing legacy provenance takes the compatibility
path, authoritative empty and populated provenance still reconcile,
marked custom-image manifests remain fail-closed, and the random-port
fake server follows the existing OpenShell host-bridge test pattern.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## 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 the DCO sign-off declaration 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 — command/result or justification:
- `npx vitest run --project cli
src/lib/state/sandbox-recreated-openclaw-restore.test.ts
src/lib/state/openclaw-config-restore-input.test.ts
src/lib/state/openclaw-config-merge.test.ts
src/lib/state/openclaw-plugin-restore.test.ts` (68 passed)
- `npx vitest run --project integration
test/snapshot-openclaw-managed-extensions.test.ts --reporter=verbose` (6
passed)
- `npx vitest run --project e2e-support
test/e2e/support/device-auth-health-helpers.test.ts
test/e2e/support/rebuild-openclaw-old-base-context.test.ts` (7 passed)
  - `npm run typecheck:cli` and `npm run test:projects:check` passed
- [ ] 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)
- [ ] 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)

---
<!-- 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: Charan Jagwani <cjagwani@nvidia.com>


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

## Summary by CodeRabbit

* **Bug Fixes**
* Improved sandbox restore behavior so recreated OpenClaw environments
recover configuration and extension state more reliably.
* Fixed restore handling to avoid carrying over stale extensions and to
better preserve expected plugin installs.
* Improved sandbox connectivity for health checks in live environments.
* Rebuild flow now reports successful completion more clearly and avoids
misleading incomplete-step messages.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
This follow-up keeps the v0.0.78 release notes synchronized with PR
NVIDIA#6495, which merged after the original release-prep docs refresh. The
deeper network-policy reference already documents the exact endpoint,
methods, and managed binaries.

## Changes
- NVIDIA#6495 -> `docs/about/release-notes.mdx`: Add policy-routed repository
reads to the v0.0.78 lead and explain that managed Deep Agents Code
`fetch_url` uses NemoClaw's policy proxy with read-only
`raw.githubusercontent.com` access.
- Reviewed NVIDIA#6534 against the existing backup/restore and lifecycle
documentation; no additional prose is needed because it restores the
documented contract.

## 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
<!-- Check exactly one tests line and one docs line. Check other lines
when applicable. Add every requested justification or approval
reference. -->
- [ ] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [x] Tests not applicable — justification: release-note prose only; no
code sample or generated behavior changed.
- [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
<!-- 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 the DCO sign-off declaration 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 — tests are not applicable to prose-only
release notes
- [ ] 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) —
completed with 0 errors and 2 pre-existing Fern 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)

---
<!-- 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: Charan Jagwani <cjagwani@nvidia.com>


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

## Summary by CodeRabbit

* **Documentation**
* Updated release notes to reflect new opt-in thread-scoped
auto-approval and policy-routed repository reads.
* Added notes about sandboxed `fetch_url` handling for GitHub source
access and the allowed GitHub request types.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@wscurran wscurran added bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior labels Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants