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? |
4e4ad7d to
64eb7b2
Compare
|
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. |
64eb7b2 to
c886914
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 26, 2026, 6:40 AM ET / 10:40 UTC. ClawSweeper reviewWhat this changesAdds a user-confirmed Tray workflow that detects a local Companion-owned WSL Gateway version mismatch, protects its state, updates it in place, and verifies recovery plus Gateway and Windows-node synchronization. Merge readiness⛔ Blocked until stronger real behavior proof is added - 6 items remain This PR remains necessary because current main does not yet provide the requested Companion-owned Gateway alignment workflow. The branch has credible unit and partial disposable-runtime evidence, but it still lacks a current-head, disposable full update followed by recovery or rollback and healthy Gateway/node confirmation; it also intentionally carries the unresolved package-lifecycle dependency from #999. Priority: P2 Review scores
Verification
How this fits togetherThe Windows Tray owns setup-managed local WSL Gateway lifecycle while the connection layer manages Gateway and Windows-node health. This change sits between startup keepalive/version probing and the post-update reconnect path, adding protected package alignment and recovery handling. flowchart LR
A[Tray startup keepalive] --> B[Local WSL Gateway]
B --> C[Installed version probe]
C --> D{Version matches target?}
D -->|No| E[User-confirmed update plan]
E --> F[Verified backup or VHD protection]
F --> G[In-place package update]
G --> H[Gateway and node health synchronization]
D -->|Yes| H
Decision needed
Why: The implementation adds a substantial new user-facing update, recovery, retention, and persisted-settings contract. The collaborator feedback establishes a preferred protection shape, but it does not establish final maintainer acceptance of this product boundary or its dependency split. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land or explicitly retire the package-lifecycle dependency first, then rebase this work into a focused Gateway-alignment PR and attach redacted current-head disposable proof of update, rollback or recovery, and healthy Gateway/node synchronization. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this PR proposes a new update and recovery capability. Its partial disposable evidence is credible, but the full intended runtime flow has not yet been demonstrated on the current head. Is this the best way to solve the issue? Unclear. The in-place, user-confirmed approach is aligned with the linked requirement and the layered-protection review feedback, but maintainers must first accept the new product contract and review it after the package-lifecycle dependency is separated. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f50af187865c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
526e933 to
b571afe
Compare
Rebase and secure package-policy alignment publishedCurrent head: This branch is now rebased onto #999 head
Fresh exact-head local proof:
The complete stacked Auto-review bundle exceeded the helper's safe size limit and was not sent truncated. Patch-ID comparison showed four of five rebased functional commits unchanged; the new convergence delta was reviewed separately. Its sole finding referred to a removed workflow writer and was rejected against the exact source. GitHub checks started automatically from this push; no manual ClawSweeper request was added. |
Closes #901
Credit to @iamalin for originating and detailing the lock-step Gateway proposal in #901. This implementation preserves that direction and extends it with a recoverable in-place update transaction.
Thanks to @shanselman for identifying that routine full-VHD rollback would not scale for long-lived Gateways. The revised design keeps VHD protection explicit and uses OpenClaw's native verified backup for routine updates.
Stacked Dependency
This PR remains stacked conceptually on #999, which owns the package lifecycle, reload-schema, LKG, and setup/reconnect contracts consumed here. This PR adds the in-place update, protection, recovery, retention, and synchronization transaction.
After #999 lands, this branch should be rebased once onto
main; the resulting diff should contain only the #901-specific update path. The current proof is intentionally frozen at this PR head rather than chasing unrelated upstream drift.Problem
The Windows Companion can update while its Companion-owned WSL Gateway remains on the version installed during onboarding. This leaves the Tray, Windows node, and Gateway on a runtime combination that the installed Companion was not built or tested against.
The update must preserve the existing distro, agents, configuration, memory, channels, node identity, and ownership. It also needs a bounded rollback path that does not require routine full-distro exports on ordinary user machines.
Changed Behavior
openclaw backup create --verify --jsonfor routine protection.0700staging directory and rejects symlink or ownership substitution.User Impact
Users can align the Gateway owned by their installed Companion without recreating the distro or rerunning onboarding. Routine updates use a compact native backup rather than a full VHD export, while explicit VHD protection remains available where byte-for-byte rollback is required.
Any malformed receipt, identity mismatch, digest mismatch, insufficient VHD capacity, ambiguous installer outcome, or replacement Gateway record fails closed before the transaction is completed.
Non-Goals
latestchasing;Change Type
Scope
winnodeExact-Head Validation
Validated candidate:
b571afe5900a9f11e26087bb33af0d4c5eb268d1git diff --check: passed; Windows line-ending notices only6277c35d9a97cb128d32ed7ab5632cfc4163c746with exact PR #110382 head6edc1e40f37b833ec0493ec331eba6cd49db4fb6; merged Core PR #111956 is consumed from main at2296e898e13a5b250bf557e9632e000c093e61f1rather than reapplied.The final follow-up commit changes only the CI composition contract and one stale reparse-boundary expectation. The complete Connection suite was rerun afterward: 621 passed, 3 declared host reparse-capability skips, 0 failed.
Real Behavior Proof
OpenClawUpdateLabWSL target, not the operator Gateway, created a real OpenClaw native backup with--verify --json.openclaw backup verify --jsonreturnedok=true.update.complete, retained protection metadata, and zero VHD terminate/export calls on the native path.The previous public CI run provided failed-first evidence: it reapplied Core PR #111956 after that change had already merged, used stale composed refs, and expected the later restore boundary even though the fixture is rejected earlier at the staging-root boundary. Those causes are corrected on the current head. The branch was then rebased onto #999 head
f5958e2190e5484a40ce551783765c0637a1786a, which restores the2026.7.1minimum security floor and stable-only forward-update rule. Current-head GitHub Windows/WSL CI is running after publication.Disposable full update-to-rollback runtime proof remains a pre-promotion gate; no operator runtime was mutated.
Security Impact
No)No)No; the existing pinned installer path is reused)Yes)No)Mitigations:
Compatibility And Migration
Yes)Yes)No)Existing settings default to native verified backup, one retained previous version, and a seven-day retention window. Schema v3 rollback receipts remain readable as Full VHD protection. Existing Companion-owned Gateway records keep the same distro, identity, and connection ownership.
The ordinary package fallback is inherited from #999:
2026.7.1is the minimum security floor and may advance only to a strictly newer official stable release. Composed packages continue to use exact immutable metadata.Review Conversations
Agent Transcript
Redacted operator/agent design and implementation timeline
This is a bounded reconstruction from the local Codex sessions used for this PR. It omits raw logs, private paths, credentials, unrelated work, and internal reasoning. Discussion records design provenance; the validation sections above remain the proof authority.
1. Destination locked by the operator
OpenClawGateway, not a replacement distro or a parallel Linux install.2. First design and challenge
3. Alternatives debated
4. Contract selected
openclaw backup create --verifystate backup.5. Implementation and failed-first evidence
6. Proof and current boundary
b571afe5900a9f11e26087bb33af0d4c5eb268d1preserves those corrections and aligns with fix(setup): validate current OpenClaw package lifecycle #999's security-floor decision.