Repository navigation
fix(update): updates fail verification on a healthy Gateway after a protocol version change - #182399
Conversation
Native updates verify the restarted Gateway from the retained previous package. Its readiness probe connects in cli mode pinned to its own protocol version, so any protocol change between the updater and the target (a bump or a revert) rejects every handshake with PROTOCOL_MISMATCH. Verification then waits out the full readiness and recovery deadlines on a healthy Gateway and reports state-migrated-no-rollback. Treat a correlated PROTOCOL_MISMATCH handshake like the existing RPC authentication rejection: verify through the protocol-independent local HTTP /startupz version/build identity and /readyz, and record an RPC protocol warning on the update result. Version and build mismatches are still enforced.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR verifies restarted Gateways through local HTTP readiness and runtime identity when the retained updater encounters a protocol mismatch. Example: A protocol-5 updater verifies a healthy protocol-4 Gateway running version 2026.10.6.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a current update-verification failure with a focused extension of the existing fallback, and no actionable correctness or security finding was established. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe update CLI feeds expected runtime identity into the restart-health owner, which inspects the local service, probes the Gateway, and returns verification facts for update history and recovery. flowchart TD
A[Retained updater] --> B[Restart health owner]
B --> C[Local service inspection]
B --> D[Gateway RPC]
D --> E[Correlated protocol mismatch]
E --> F[Local HTTP readiness and identity]
F --> G[Version and build checks]
G --> H[Update result and warning]
Technical reviewBest possible solution: Extend the existing restart-health fallback while preserving strict checks, runtime identity enforcement, and the recorded protocol warning. Do we have a high-confidence way to reproduce the issue? Current main accepts the HTTP fallback only after authentication rejection, while protocol admission produces a distinct correlated mismatch response; the body supplies matching production failure details. Is this the best way to solve the issue? The patch uses the existing verification owner and HTTP contracts without changing Gateway admission or adding a subprocess boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 191e1cda731c. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +28, Tests +50, Docs +4. Total +82 across 6 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 24, 2026, 4:18 AM ET / 08:18 UTC. |
|
Merged via squash.
|
Keep the live executor assertion at socket construction and every authenticated frame, including deferred startup retries. Reuse canonical request settlement and record connect timing only after an actual send. Refresh main and retire the private verifier handoff: #182399 already owns protocol-mismatch HTTP identity verification. Final focused proof: consumer 3/3 and package authority/timing/close siblings 11/11; independent P0/P1 review scoped-clean.
…aw#182399) Native updates verify the restarted Gateway from the retained previous package. Its readiness probe connects in cli mode pinned to its own protocol version, so any protocol change between the updater and the target (a bump or a revert) rejects every handshake with PROTOCOL_MISMATCH. Verification then waits out the full readiness and recovery deadlines on a healthy Gateway and reports state-migrated-no-rollback. Treat a correlated PROTOCOL_MISMATCH handshake like the existing RPC authentication rejection: verify through the protocol-independent local HTTP /startupz version/build identity and /readyz, and record an RPC protocol warning on the update result. Version and build mismatches are still enforced.
What Problem This Solves
Fixes:
openclaw updatereports a failed, data-at-risk update after an hour of waiting, even though the restarted Gateway is healthy, whenever the update changes the Gateway protocol version.User Impact
User impact: updates that cross a protocol change (a bump such as #182109, or a revert such as #182277) now settle as soon as the restarted Gateway is ready, instead of timing out after the 30-minute readiness and 30-minute recovery waits and ending
failed/state-migrated-no-rollback. The update result records an RPC protocol warning so the skipped RPC health detail stays visible.This only takes effect for updates whose updating package includes the fix, because the verifier runs from the previous package.
Why This Change Was Made
Native updates verify the restarted Gateway from the retained previous package. Its readiness probe (
confirmGatewayReachable) opens acli-mode RPC connection pinned to its own protocol version, so the new Gateway rejects every handshake withPROTOCOL_MISMATCH. The loop never sees health, and the deadline fires while it happens to be inport-inspection(lsof is the slowest step on a loaded host). That made the error message point at port inspection rather than the handshake.A correlated
PROTOCOL_MISMATCHresponse now takes the same path as the existing RPC authentication-rejection fallback: the verifier checks the protocol-independent local HTTP/startupzversion/build identity and/readyz. Version and build mismatches are still enforced, the fallback stays limited to update verification that does not require plugin or channel health, and Gateway authentication and protocol admission are unchanged.Evidence
protocol mismatch: Control UI v5, Gateway v4, connection check min v3readiness probes. The Gateway log showed the matchingprotocol mismatch ... client=cli cli min=5 max=5 expected=4rejections. Meanwhile/readyzreturned 200, and the new CLI'sgateway status --deep --require-rpcsucceeded in about 3 s.restart-health-probe.test.ts(two rows: verified target settleshealthy, stale build still failsbuild-id-mismatch). Red on base withtimeout, green with the fix.confirmGatewayReachableverified the Gateway through/startupz+/readyz(reachable: true, matching version). A base-side run of the same proof could not start its fixture Gateway under host load (60 s readiness budget after a cold worker compile), so base behavior rests on the regression test and the production failure above.restart-health*(7 files),update-command-verification,update-command-readiness.windows,update-immutable-verification,update-command-native-recovery,update-command-post-update-recovery. 172/174 pass. The 2 failures (settles Doctor-rewritten config, both operator-edit variants) fail identically on unmodified base6ba8529d86d3.pnpm tsgo:coreandoxfmt --checkclean. Codex autoreview (P0–P2) scoped-clean.Release-note context: CLI/update: verify the restarted Gateway through local HTTP identity when an update changes the Gateway protocol version, instead of timing out and reporting a failed update.