feat: update Companion-owned Gateway safely in place#1049
Conversation
|
Bot perspective: I think the full-VHDX rollback strategy may be operationally untenable for routine Gateway updates. Every update runs I also could not find a free-space preflight before the distro is stopped and export begins. On a machine with limited storage, that means an otherwise routine Gateway package update can consume many gigabytes, fill the system drive, and fail after disrupting the running Gateway. Could we reconsider whether a complete VHDX is proportionate for every update? A safer layered policy might be:
What failure model requires a byte-for-byte distro copy for every package update, and is that benefit worth the potentially 2x steady-state and 3x transient storage cost on ordinary user machines? |
1250e3c to
4e4ad7d
Compare
4e4ad7d to
64eb7b2
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: feat: update Companion-owned Gateway safely in place This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Thanks, Scott @shanselman . You're right about the storage model. We optimized for the strongest possible rollback on machines with plenty of disk and made the most expensive recovery path routine. That does not scale to a normal user machine, especially as the Gateway distro grows over time. We'll rework this into layered rollback:
For retention, our current direction is to keep the latest verified pre-update recovery point until the next update is healthy, then apply a seven-day grace period by default. Users will be able to choose a longer window or indefinite retention. Before changing the implementation, we'll verify that the official staged rollback works with the exact pinned package used by the Companion and document precisely what the native backup includes and excludes. If either leaves a recovery gap, we'll map that gap to the specific cases that still need a VHDX instead of requiring one for every update. This is a better design. Thanks for catching it before we shipped the expensive path as the default. |
Closes #901
Credit to @iamalin for originating and detailing the lock-step Gateway proposal in #901. This implementation preserves that product direction and extends it with a recoverable update transaction.
Stacked Dependency
This PR is intentionally stacked on #999 at exact head
10fbccb0f44d15ec1aaeb385b157ccc2738a2310.#999 owns the current package lifecycle, reload-schema, LKG, and setup/reconnect contracts that this in-place update path consumes. This PR contains the additional update/rollback transaction only. After #999 merges, this PR should be rebased onto
main; its displayed diff will shrink to the #901-specific delta.What Problem This Solves
The Windows Companion can update while its Companion-owned WSL Gateway remains frozen at the version installed during onboarding. That allows the Tray and local Gateway to drift, leaving users on a runtime combination the Companion was not built or tested against.
Why This Change Was Made
The Companion now compares the installed OpenClaw package with its pinned required version and offers a user-confirmed in-place alignment path. Before mutation it exports and verifies an offline rollback point, records durable transaction receipts, revalidates distro ownership, package version, node command policy, and registration state at destructive boundaries, then updates and resynchronizes the existing Companion-owned Gateway without unregistering or replacing it.
Emergency restore remains a separate confirmed operation. It is resumable across destructive phases, fails closed on ambiguous or corrupt receipts, preserves the distro name and identity, restores the registered default user and complete node allowlist, and retains the immutable rollback VHD until post-restore health is proven.
Rollback retention is configurable as one previous version (default), two versions, or indefinite retention, with an optional additive age window.
Non-goals:
latestchasing;User Impact
Users receive a clear prompt when their local Companion-owned Gateway differs from the version required by the installed Companion. They can align it in place while preserving agents, configuration, memory, channels, node identity, and WSL ownership, with an explicit verified rollback path if the update does not recover cleanly.
Evidence
Change Type
Scope
winnodeValidation
dotnet test tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj: 528/528 passeddotnet test tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj: 766/766 passeddotnet test tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 3,177 passed; 31 explicit environment-dependent skipsdotnet test tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 1,931/1,931 passed.\build.ps1 -NoTrustRepository: Shared, Cli, WinNodeCli, SetupEngine, and WinUI succeededgit diff --check: passedopenclaw-autoreview: two bounded cycles completedReal Behavior Proof
64eb7b2b8551c2c9872cab0bcecb812a960ea9f9N/A)Security Impact
No)No)No; the existing pinned installer path is reused)Yes)No)Yes, explain the risk and mitigation:Compatibility and Migration
Yes)Yes)No)Review Conversations
Agent Transcript
Redacted operator/agent implementation timeline
identityPath, reload-schema, LKG, and setup/reconnect contracts; duplicated old-base tests were removed rather than forked.