fix(snapshot): never capture or restore OpenClaw runtime auth state#6882
Conversation
Snapshot backups run every .json file through the credential sanitizer, which scrubs the key/token fields of OpenClaw's device identity (identity/device.json) and paired-device token store (devices/). Restoring a snapshot then wiped the sandbox's working pairing state and installed those corrupt copies, so the gateway destabilized and every ordinary CLI client failed with GatewayCredentialsRequiredError once OpenClaw 2026.6.10 and the local-loopback pairing path (NVIDIA#6291) stopped providing an ambient gateway token. Declare identity/ and devices/ as runtime_auth_state_dirs in the OpenClaw manifest: they stay in state_dirs so destroy still wipes them from the durable volume, but backup never captures them and restore never touches them — including for legacy snapshots whose embedded manifests still list them, since the current target manifest is authoritative. OpenClaw regenerates the device identity on demand and NemoClaw auto-pair re-pairs on connect, matching fresh-onboard behavior. Fixes NVIDIA#6852 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: harjoth <harjoth.khara@gmail.com>
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughOpenClaw declares ChangesRuntime authentication state
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Review Advisor — InformationalAdvisor assessment: Informational / high 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: 3 optional E2E recommendations
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
The codebase-growth-guardrails check forbids newly added test files from introducing if statements. Replace the manual HOME/PATH/OPENSHELL_BIN save-and-restore conditionals with vi.stubEnv / vi.unstubAllEnvs, which records and restores prior env values (including unset) without branching. No behavior change; the embedded fake-ssh script's conditionals live inside a template string and were never counted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: harjoth <harjoth.khara@gmail.com>
|
✨ Thanks for the fix. Preventing snapshot from capturing and restoring OpenClaw runtime auth state avoids gateway destabilization after clone or restore. Ready for maintainer review. Related open issues: Related open PRs: Related open issues: |
|
@cv Exact head |
|
@prekshivyas approved, please review |
prekshivyas
left a comment
There was a problem hiding this comment.
Reviewed exact head 10637bc. Snapshot filtering and legacy-restore behavior are correct and covered; CI, PR Advisor, CodeRabbit, and the policy-approved fork E2E gate are clear.
<!-- markdownlint-disable MD041 --> ## Summary Adds the canonical `docs/changelog/2026-07-15.mdx` entry with the exact `## v0.0.84` heading for the release candidate range from `v0.0.83` through `710d2b36b9eebcb6bca3c2b2f796a1bdb69c3a31`. Fills two owner-page gaps for model-aware local inference health and pre-write OpenClaw candidate validation. ## Changes - Add the complete shared Fern changelog entry for `v0.0.84`, with literal CLI names and root-absolute OpenClaw and Hermes routes. - Document that sandbox status and doctor compare the configured Ollama or vLLM model with provider inventory without issuing a completion. - Document that host-side OpenClaw `config set` validates the complete candidate before replacing live config or reaching gateway restart. - Reconcile the `v0.0.84` release label with the commit range. PR #6773 is already contained in `v0.0.83` and remains documented there; CI, test-harness, docs-infrastructure, and `.js` to `.mts` migration-only changes require no additional user guidance. ### Source summary - [#6882](#6882) -> `docs/manage-sandboxes/backup-restore.mdx`, `docs/changelog/2026-07-15.mdx`: Explain that OpenClaw runtime identity and pairing state are excluded from snapshots and ignored during restore. - [#6873](#6873) -> `docs/inference/set-up-ollama.mdx`, `docs/changelog/2026-07-15.mdx`: Record the Ollama requested-model environment fallback and interactive default. - [#6835](#6835) -> `docs/changelog/2026-07-15.mdx`: Include the sandbox name in the documented rebuild resume-recovery behavior. - [#6886](#6886) -> `docs/inference/custom-endpoint-security.mdx`, `docs/inference/set-up-openai-compatible-endpoint.mdx`, `docs/changelog/2026-07-15.mdx`: Explain the exact-host trusted-private endpoint opt-in and retained SSRF boundaries. - [#6887](#6887) -> `docs/reference/commands.mdx`, `docs/changelog/2026-07-15.mdx`: Document Telegram channel health verdicts, summary behavior, and exit status. - [#6863](#6863) -> `docs/manage-sandboxes/lifecycle.mdx`, `docs/changelog/2026-07-15.mdx`: Add the missing model-inventory behavior for local status and doctor checks. - [#6902](#6902) -> `docs/manage-sandboxes/runtime-controls.mdx`, `docs/changelog/2026-07-15.mdx`: Add the missing pre-write OpenClaw candidate-validation contract. - [#6916](#6916) -> `docs/changelog/2026-07-15.mdx`: Preserve the failed-session fresh-install recovery correction in the release entry. - [#6934](#6934) -> `docs/reference/commands.mdx`, `docs/reference/troubleshooting.mdx`, `docs/security/credential-storage.mdx`, `docs/changelog/2026-07-15.mdx`: Summarize completed-prompt checkpointing and validated credential reuse during OpenClaw resume. - [#6898](#6898) -> `docs/inference/switch-models.mdx`, `docs/inference/switch-providers.mdx`, `docs/reference/troubleshooting.mdx`, `docs/changelog/2026-07-15.mdx`: Explain Hermes dashboard convergence after in-place inference changes. - [#6711](#6711) -> `docs/manage-sandboxes/run-sandboxes.mdx`, `docs/manage-sandboxes/uninstall-nemoclaw.mdx`, `docs/reference/architecture.mdx`, `docs/reference/commands.mdx`, `docs/changelog/2026-07-15.mdx`: Summarize port-scoped host state and uninstall preservation. - [#6767](#6767) -> `docs/inference/configure-model-limits.mdx`, `docs/inference/set-up-ollama.mdx`, `docs/reference/troubleshooting.mdx`, `docs/changelog/2026-07-15.mdx`: Record the Hermes `64000`-token Ollama floor and unchanged OpenClaw floor. - [#6862](#6862) -> `docs/get-started/quickstart.mdx`, `docs/inference/verify-inference-route.mdx`, `docs/changelog/2026-07-15.mdx`: Explain retryable not-ready finalization for unhealthy inference routes. - [#6766](#6766) -> `docs/security/tcb-boundary.mdx`, `docs/changelog/2026-07-15.mdx`: Document definitive stale transition-lock recovery and fail-closed ambiguous cases. - [#6948](#6948) -> `docs/manage-sandboxes/manage-mcp-servers.mdx`, `docs/changelog/2026-07-15.mdx`: Include Hermes MCP apply-state race recovery in the release entry without changing the established user workflow. - [#6964](#6964) -> `docs/reference/troubleshooting.mdx`, `docs/changelog/2026-07-15.mdx`: Record complete agent-specific fresh-install and resume recovery commands. - [#6883](#6883) -> `docs/get-started/quickstart.mdx`, `docs/inference/set-up-vllm.mdx`, `docs/reference/platform-support.mdx`, `docs/changelog/2026-07-15.mdx`: Summarize the DGX Station Nemotron Ultra express path and pinned managed-vLLM recipe. - [#6985](#6985) -> `docs/inference/set-up-vllm.mdx`, `docs/reference/commands.mdx`, `docs/changelog/2026-07-15.mdx`: Capture the final automated and interactive storage-warning behavior. ## 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 - [x] Existing tests cover changed behavior — `test/changelog-docs.test.ts` validates the dated-entry structure, exact version heading, and preserved history. - [ ] Tests not applicable — justification: - [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 — `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 run for this doc-only 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) — completed with 0 errors; Fern reported the unchanged unauthenticated redirect-check and light-theme contrast 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 intentionally has no frontmatter. --- Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added the v0.0.84 changelog entry covering setup, endpoint onboarding, model handling, sandbox readiness, recovery, channel status, and configuration safeguards. * Clarified that sandbox health checks validate configured models against local Ollama and vLLM provider inventories without generating completions or consuming tokens. * Documented that invalid runtime configuration changes are rejected while preserving the existing working configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
nemoclaw snapshot createruns every backed-up.jsonfile through the credential sanitizer, which scrubs the key/token fields of OpenClaw's device identity (identity/device.jsonEd25519 keypair) and paired-device token store (devices/).snapshot restorethen wiped the sandbox's live pairing state and installed those scrubbed copies, so after a clone or restore the gateway destabilized and ordinary CLI clients (openclaw agent,openclaw tui) failed withGatewayCredentialsRequiredError. This surfaced at v0.0.75 once OpenClaw 2026.6.10 and the local-loopback pairing path (#6291) stopped providing an ambient gateway token that had been masking the corruption. After this change, backup no longer captures device identity or pairing state and restore never touches it; OpenClaw regenerates the device identity on demand and NemoClaw auto-pair re-pairs on connect.Related Issue
Fixes #6852
Changes
runtime_auth_state_dirsagent-manifest field (src/lib/agent/definition-types.ts,src/lib/agent/defs.ts). Its consumer is the snapshot backup/restore path insrc/lib/state/sandbox.ts, which needs to distinguish machine-local auth state (device keys, pairing tokens) from durable user state. A direct exclusion in code would hard-code OpenClaw-specific dir names into the shared backup engine; the manifest keeps the agent contract declarative and per-agent. The reader validates that every entry is also astate_dirsmember. Protected bysrc/lib/agent/runtime-auth-state-dirs.test.ts.identityanddevicesasruntime_auth_state_dirsinagents/openclaw/manifest.yaml. They stay instate_dirssodestroystill wipes them from the durable volume.backupSandboxStatefiltersruntime_auth_state_dirsout of the captured set;restoreSandboxStateInternalfilters them out of the pre-restore cleanup and tar extract, keyed on the current target manifest so legacy snapshots that still contain those dirs are also skipped. Protected bytest/snapshot-runtime-auth-state.test.ts(a round-trip integration test that fails on unpatchedmain).docs/manage-sandboxes/backup-restore.mdx(OpenClaw variant).AI-assisted contribution.
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 unavailablenpx vitest run test/snapshot-runtime-auth-state.test.ts src/lib/agent/runtime-auth-state-dirs.test.ts→ 5 passed; the integration test is red on unpatchedmain(expected [ 'agents', 'identity', 'devices' ] to not include 'identity'), green on this branch.npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:npm run docsbuilds without warnings (doc changes only)Note: dynamic Linux/Brev end-to-end verification was not run, so the gateway-crash symptom is not confirmed live. The credential-loss root cause and fix are static-traced (through NemoClaw's backup sanitizer and OpenClaw's
GatewayCredentialsRequiredErrorthrow site) and covered by the red-green integration test above.Signed-off-by: harjoth harjoth.khara@gmail.com
Summary by CodeRabbit