Repository navigation
Harden managed Gateway release setup and restart recovery - #1120
Conversation
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 184fa070-4567-45dc-ac2d-c81c2840af14
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 184fa070-4567-45dc-ac2d-c81c2840af14
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 184fa070-4567-45dc-ac2d-c81c2840af14
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 184fa070-4567-45dc-ac2d-c81c2840af14
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 184fa070-4567-45dc-ac2d-c81c2840af14
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 15b5584f-677b-453f-8aa4-4f33fe60bc50
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 15b5584f-677b-453f-8aa4-4f33fe60bc50
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 15b5584f-677b-453f-8aa4-4f33fe60bc50
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 15b5584f-677b-453f-8aa4-4f33fe60bc50
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 15b5584f-677b-453f-8aa4-4f33fe60bc50
Classify the Gateway 2026.7.1 terminal restart from stable model-check context, and bound managed-local NoListener retries without weakening endpoint ownership checks. Co-authored-by: Copilot App <[email protected]>
|
Codex review: needs changes before merge. Reviewed August 7, 2026, 3:48 PM ET / 19:48 UTC. ClawSweeper reviewWhat this changesThe PR hardens managed Gateway setup, restart recovery, endpoint provenance, and durable credential cleanup with expanded Windows/WSL E2E coverage. Merge readinessKeep open. The latest commit fixes the registry persistence race, but the previously reported restart-classification blocker remains on the current head. Priority: P1 Review scores
Verification
How this fits togetherThe setup engine provisions and pairs a managed Gateway, then tray and node clients reconnect through it. This change governs endpoint ownership checks, credential handling, WebSocket recovery, and the resulting authenticated session. flowchart LR
A[Setup wizard answer] --> B[Restart recovery policy]
B --> C[Endpoint ownership check]
C --> D[Reconnect and hello handshake]
D --> E[Gateway registry cleanup]
E --> F[Tray and node connection]
C --> G[Fail closed on unknown owner]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Classify the restart from the authenticated running Gateway version and cover the normal LKG configuration route before merge. Do we have a high-confidence way to reproduce the issue? Yes, from source: apply the normal LKG configuration, run Gateway 2026.7.1, and trigger terminal model-check close 1012. The configured version remains 2026.6.11, so the exact recovery branch does not run. Is this the best way to solve the issue? No. The compatibility path is narrowly scoped, but it uses installation configuration rather than the authenticated running server version, which is the durable source of truth. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a1d933a3c7b7. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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 (2 earlier review cycles)
|
Keep retryable startup close 1013 and typed listener snapshot changes inside the existing managed-local restart window while preserving immediate failure for every other unknown owner. Co-authored-by: Copilot App <[email protected]>
Keep gateway registry memory aligned with persisted state when bootstrap credential cleanup cannot be saved, so later connection lifecycle events can retry safely. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 73908040-d4b7-493b-b024-b0c9ebcfc98d
Summary
model-checkrestartNoListenerand the typed listener-snapshot race may retry inside the existing bound; every other unknown, conflicting, incomplete, or changed owner fails immediatelyArchitecture ownership
The old restart classification and retry behavior was split across
WizardPageandSetupWizardRunner.GatewayWizardRestartRecoveryPolicynow owns exact-version terminal classification and bounded restart provenance/reconnect policy, while hosted and headless callers retain lifecycle application. The preserved invariant is that no credential is sent until the managed endpoint is verified, and terminal success requires a fresh authenticatedhello-ok.GatewayRegistryremains the authoritative persistence owner. Its atomic update-and-save operation now rolls back the in-memory record if persistence fails, so credential cleanup can be retried by the next connection lifecycle event without memory/disk divergence.Validation
Validated pushed head:
e359b8f02782e2f2d4501b72bebd987a8bb022c9$env:OPENCLAW_REPO_ROOT=(Get-Location).Path; .\build.ps1: passed, 45 documentation files and all 5 projectsdotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore: 543 passed, 0 failed, 0 skippeddotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore: 738 passed, 0 failed, 0 skippeddotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 3,413 passed, 0 failed, 32 skippeddotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 2,166 passed, 0 failed, 0 skipped.\scripts\validate-mxc-e2e.ps1without-AllowSkip: 12 passed, 0 failed, 0 skippedCI blocker correction
The first PR check run exposed two source-owned restart races:
UNAVAILABLE/startup-sidecars, then WebSocket close 1013, which the setup waiter treated as terminal before automatic reconnectUnknownListener, which the bounded restart wait rejected before the endpoint settledThe second PR check run proved both restart fixes: the
network-recoveryandrevocation-recoveryshards passed. It then exposed a separate source-owned persistence race in reused setup-code pairing. Both durable role tokens were written, but bootstrap cleanup first changed the in-memory registry and then hit a transient access-denied error while saving. Later lifecycle events saw the in-memory null and could not retry, while disk still retained the bootstrap token.The final fix keeps update, save, and rollback under the registry lock. Failed persistence leaves the prior in-memory token intact and emits no successful registry change; the next pairing or connection event retries the cleanup. Credential precedence and setup-code pairing behavior are unchanged.
The repeated hosted
McpHttpServerIntegrationTests.SystemRun_Where_ReturnsExpectedOutput10-second timeout is unrelated to this release stack and remains a rerunnable infrastructure failure; its command-execution source was not changed.Real behavior proof
Gateway 2026.7.1 final isolated run
8d7904b1:Strict MXC final isolated run
a27d70b5:No firewall dialog was observed. The worktree was clean after commit, the pushed SHA matched the remote branch, and
git diff --checkpassed.