fix(restore): restart gateway after pairing approval - #7608
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
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 restored gateway pairing flow now uses bounded cycles, restarting before warm-up and after approval before verification. Unit, snapshot-restore, E2E authentication, and risk-plan tests cover the revised sequence and routing. ChangesRestored gateway pairing
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant SnapshotRestore
participant RestoredGatewayPairing
participant Gateway
participant PairingVerifier
SnapshotRestore->>RestoredGatewayPairing: establish pairing
RestoredGatewayPairing->>Gateway: restart before warm-up
RestoredGatewayPairing->>Gateway: warm up and approve transition
RestoredGatewayPairing->>Gateway: restart after approval
RestoredGatewayPairing->>PairingVerifier: verify pairing
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in commit b545da5 in the TypeScript / code-coverage/cliThe overall coverage in commit b545da5 in the Show a code coverage summary of the most impacted files.
Updated |
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
PR Review Advisor — No blocking findings reportedAdvisor assessment: No blocking advisor findings reported 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: 1 optional E2E recommendation
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/snapshot-gateway-guard.test.ts (1)
305-305: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert restart ordering, not only restart count.
The assertion at Line 318 verifies two identical restart entries but does not prove that the second restart occurred before authenticated pairing verification. Add an observable verification marker to the fixture and assert the full sequence so the title at Line 305 reflects actual behavioral coverage.
As per path instructions, tests should prioritize behavioral confidence over implementation lock-in.
Also applies to: 318-318
🤖 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 `@test/snapshot-gateway-guard.test.ts` at line 305, Update the test named “snapshot restore --to uses registered imageTag and restarts the VM gateway before pairing verification” to add an observable pairing-verification marker in the fixture, then assert the complete event sequence showing both gateway restarts occur before authenticated pairing verification. Replace the count/duplicate-entry assertion near the restart checks with this ordered behavioral assertion.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 `@test/snapshot-gateway-guard.test.ts`:
- Line 305: Update the test named “snapshot restore --to uses registered
imageTag and restarts the VM gateway before pairing verification” to add an
observable pairing-verification marker in the fixture, then assert the complete
event sequence showing both gateway restarts occur before authenticated pairing
verification. Replace the count/duplicate-entry assertion near the restart
checks with this ordered behavioral assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 0d787b71-b0d1-4847-8162-f5f53fd50a51
📒 Files selected for processing (1)
test/snapshot-gateway-guard.test.ts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/e2e/live/snapshot-commands.test.ts`:
- Line 214: Update the test around the “snapshot restore --to returns only after
restored gateway pairing is authenticated” case and its corresponding lines
430-442 so authentication is observed or asserted before the restore command
resolves. Start the authentication event/status probe before invoking restore,
and ensure the assertion proves the pairing was already authenticated at
completion rather than allowing a later recovery to satisfy the test.
- Around line 128-130: Update the assertions around resultText(result) to avoid
passing raw child output as Vitest messages or asserting directly on unsanitized
stdout/stderr. Use the existing redaction/observation helper to derive
timestamp/stream-only data, then assert on sanitized lengths or boolean match
results while preserving the exit-code and rejection checks without exposing
command contents, tokens, or credentials.
- Around line 113-125: Update the pairing probe helper around sandbox.execShell
to pass the target sandboxName and inference fixture into commandEnv(). Ensure
commandEnv() accepts and uses both values, so the openclaw agent request routes
through the restored clone and its intended inference fixture before
inference.requests() is asserted.
🪄 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: 50047e64-d30b-4f50-b1c1-559abdbffe1a
📒 Files selected for processing (1)
test/e2e/live/snapshot-commands.test.ts
…teway-pairing-restart
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
<!-- markdownlint-disable MD041 --> ## Summary `docs/changelog/2026-07-25.mdx` now includes the user-facing fixes that merged after #7607 and before the v0.0.96 tag. The follow-up covers safer bulk backup and clone restore behavior, policy and inference repairs, cleaner onboarding diagnostics, and OpenClaw base-image validation while leaving test-only and maintainer-internal merges out of the release entry. ## Changes - Document the Shields-safe `backup-all` flow from #7557 and the clone-specific restore pairing publication from #7608. - Record the Claude Code resolved-launcher policy repair from #7581, Hermes namespaced-model handling from #7604, and persisted Ollama proxy-token reuse from #7620. - Record OpenClaw immutable base-inventory validation from #7606, hidden route-only reservations from #7621, and clean invalid gateway-management errors from #7630. - Link the gateway lifecycle and snapshot authorities, retain #7622's already-merged Docker Engine wording, and exclude internal or test-only merges from the release entry. ## 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 changes release-entry prose only. The changelog contract test and Fern validation cover the dated entry, published routes, and rendering requirements. - [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: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: At exact PR head `29316da26`, a Codex Desktop documentation writer reviewed `docs/changelog/2026-07-25.mdx` against `AGENTS.md`, `WRITING.md`, and `docs/CONTRIBUTING.md`. The review confirmed that the full entry accurately reflects the merged user-visible behavior, retains #7622's existing wording, appropriately excludes internal and test-only PRs, and uses conforming terminology, structure, links, and release classification. It also confirmed that the review follow-ups use active third-person release-entry voice, name the actor and recovery requirement directly, and accurately preserve the trusted-backup, cached-release refresh, and local-build fallback constraints. The changelog test passed 6/6, and the docs build completed with 0 errors and 2 pre-existing hidden warnings. - Agent: Codex Desktop <!-- docs-review-head-sha: 29316da --> <!-- docs-review-agents-blob-sha: be20a09 --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## 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 — command/result or justification: `npx vitest run test/changelog-docs.test.ts` passed 6/6 tests after the final review fix. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: Not applicable to this prose-only changelog change. - [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) — exited 0 with 0 errors and 2 pre-existing hidden warnings after the final review fix. - [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: Carlos Villela <cvillela@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Expanded the changelog to clarify persistent `policy exclude`/`policy restore` behavior across rebuilds and snapshot restores, including reporting on removed endpoints and exclusion consistency. * Updated `claude-code` preset guidance to allow the npm-installed OpenShell launcher path while maintaining endpoint/HTTP method scope. * Documented hardened handling for invalid gateway-management declarations, improved gateway/agent-version diagnostics scope, and clarified onboarding/restore credential and reasoning precedence. * Tightened bulk backup/restore guidance (safety windows, approval limits, and failure recovery) and refined OpenClaw base selection to avoid incompatible cached releases and `:latest` fallback. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
<!-- markdownlint-disable MD041 --> ## Summary The snapshot-command E2E test for #7608 did not distinguish a restored-clone pairing probe from one run in the source sandbox. The test now installs a source-sandbox negative control and requires one authenticated clone-fixture request, no negative-control request, and no source-sandbox session. ## Related PR Follow-up to #7608. ## Changes - The test installs a source-sandbox marker before restored-clone pairing verification. - If the pairing probe enters the source sandbox, it sends a distinct negative-control model request and exits before the ordinary agent run. - The test requires one authenticated clone-fixture request, no source-sandbox negative-control request, clone session presence, and source-sandbox session absence. - The evidence records fixed request counts and session-ownership booleans. An asserted `finally` block removes the marker. ## 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 - [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: This PR changes one live E2E test and no user-visible behavior or supported contract. - [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: Codex Desktop reviewed commit `9146a55fa3d4fc1aa495ce0c15727705222b82bf` against base SHA `4cd4d64fe67143b57707f874afa0b9d269dfeff2`. Each of the nine categories received PASS, with no findings. [Security review](#7652 (comment)). - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `no-docs-needed` - Evidence: Commit `9146a55fa3d4fc1aa495ce0c15727705222b82bf` changes only `test/e2e/live/snapshot-commands.test.ts`. It adds a source-sandbox negative control for restored-clone pairing verification and changes no command, flag, configuration, output contract, API, protocol, policy schema, or supported behavior. The changed test contract, identifiers, artifact names, and assertion labels were reviewed against the repository writing rules. - Agent: Codex Desktop <!-- docs-review-head-sha: 9146a55 --> <!-- docs-review-agents-blob-sha: 3dd7c24 --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification GitHub CI is authoritative and is still running for commit `9146a55fa3d4fc1aa495ce0c15727705222b82bf`. Required checks must pass before merge; no non-success result is waived. No broad local tests were run for this review. - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [ ] 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 - [ ] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: GitHub CI is still running for commit `9146a55fa3d4fc1aa495ce0c15727705222b82bf`. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: Not applicable to this one-file live E2E test change. - [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) --- Signed-off-by: Carlos Villela <cvillela@nvidia.com> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com> Co-authored-by: cjagwani <cjagwani@nvidia.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
Cross-sandbox snapshot restore could inspect a gateway-global pending-device list and approve a different sandbox's request before verifying the restored clone. After restore, this change restarts and warms the clone, approves at most one bounded pairing or scope-upgrade request that matches the clone's local identity, restarts its gateway, and treats one ordinary authenticated verifier as the sole success condition.
Related Issue
Related to #7431 and #4462. Corrects the restore-pairing lifecycle introduced by #7437.
Changes
restart → warm-up → approval → restart → authenticated verificationsequence to publish approved state before verification.isRepair: false,scopes: ["operator.write"]shape; reject malformed, ambiguous, duplicate, foreign, empty, read-only, noncanonical, or over-scoped requests.snapshot-commandswhen restored-gateway pairing production modules change.Type of Change
Quality Gates
9f439dfd418d89be4870c4f3378c57af8a530b3cagainstorigin/main1bc0283144062b560e7496baa92d3293e4a65089. It reviewed all 16 changed files and confirmed accepted product scope, clone-only environment/inference routing, exact paired device/public-key binding, bounded canonical scopes, storedoperator.pairingauthorization for the pre-convergence write request, canonical locked publication, fixed output-free classifications, and the unchanged one-approval/one-verifier sequence without retries or longer timeouts.Documentation Writer Review
no-docs-needed9f439dfd418d89be4870c4f3378c57af8a530b3c, the writer reviewed the complete 16-file diff. Existing snapshot documentation already defines automatic clone pairing, ordinary authenticated verification, nonzero failure, retained restored state, andconnectrecovery. The OpenClaw2026.7.1dependency review already bounds exact CLI/operator pairing/read/write transitions through stored-device authentication and canonical fail-closed approval. This internal repair adds no CLI syntax, flag, configuration, API, schema, policy, or supported workflow, so no docs, changelog, or docs build is required.DGX Station Hardware Evidence
Verification
Signed-off-by:line and every published commit appears asVerifiedin GitHub; exact head9f439dfd418d89be4870c4f3378c57af8a530b3chas a valid SSH signature and DCO trailer, and GitHub reportsverified: truewith reasonvalid.pre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailable9f439dfd418d89be4870c4f3378c57af8a530b3c, 299/299 targeted tests passed: compiled OpenClaw patch regressions 53/53, clone pairing lifecycle 32/32, snapshot helper 17/17, real pinned OpenClaw dist proof 6/6, and adjacent risk/lifecycle/workflow/dependency/provenance suites 191/191.npm run typecheck:cli,git diff --check, signed commit hooks, and exact committednpm run check:diffall passed.npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result: not applicable to this focused restore-path repair; affected and exact suites pluscheck:diffpassed.npm run docsbuilds without warnings (doc changes only)Trusted E2E on exact prior head
2193b9ea83e001bcca6b92cb6467eda7d835f037(child run30249871943, snapshot job89925344542) failedsnapshot-commandswith fixed classificationscope-upgrade-pending; that SHA was not retried. Trusted E2E on exact prior headd2808095c7da86640b29affe911b0600dc5fdb11(child run30259361580, snapshot job89955535331) passed seven selected lanes and failed onlysnapshot-commandswith the same fixed classification; that SHA was not retried. Trusted E2E on exact prior headc45892130795ce1e22143af00046b386bb24ee72(controller30263636883, child30263933229, snapshot job89970220974) again passed seven selected lanes and failed onlysnapshot-commandsat restore-to-clone with fixed classificationcommand-failure; its captured verifier layer wasscope-upgrade-pending. Retry/reconciliation steps were skipped and that SHA will not be retried. Trusted E2E on exact prior headf2fd8676e156bdd31ca29ec51660a8c9a6d04525(controller30269186094, child30269513049, snapshot job89988454045) passed every companion selected lane and failed onlysnapshot-commandsat the first restore-to-clone phase. Artifact8654481473(sha256:74af24bfafbc6fa1fb1cf7abe1233a4c1b202d5d70f086c6a9afd77bad154906) recorded fixed outer classificationcommand-failureand verifier layerscope-upgrade-pending, exit 1 without timeout. Evidence verification passed, every retry step was skipped, and that SHA will not be retried. Fresh ordinary gates and automated review must pass on9f439dfd418d89be4870c4f3378c57af8a530b3cbefore authorizing only its exact trusted coverage.Signed-off-by: Carlos Villela cvillela@nvidia.com