Skip to content

fix(update): updates fail verification on a healthy Gateway after a protocol version change - #182399

Merged
steipete merged 1 commit into
mainfrom
claude/angry-archimedes-e1ea89
Oct 24, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/angry-archimedes-e1ea89

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: openclaw update reports 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 a cli-mode RPC connection pinned to its own protocol version, so the new Gateway rejects every handshake with PROTOCOL_MISMATCH. The loop never sees health, and the deadline fires while it happens to be in port-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_MISMATCH response now takes the same path as the existing RPC authentication-rejection fallback: the verifier checks the protocol-independent local HTTP /startupz version/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

  • Live diagnosis on a personal macOS Git install: two consecutive native updates failed this way. In the first, a protocol 4 updater verified a freshly started protocol 5 Gateway. In the second, a protocol 5 updater verified a protocol 4 Gateway. The updater's stderr recorded 1,317 consecutive protocol mismatch: Control UI v5, Gateway v4, connection check min v3 readiness probes. The Gateway log showed the matching protocol mismatch ... client=cli cli min=5 max=5 expected=4 rejections. Meanwhile /readyz returned 200, and the new CLI's gateway status --deep --require-rpc succeeded in about 3 s.
  • Regression test in restart-health-probe.test.ts (two rows: verified target settles healthy, stale build still fails build-id-mismatch). Red on base with timeout, green with the fix.
  • End-to-end proof, not committed: a real Gateway child process on protocol 4 with a client whose protocol module was forced to 5. The real handshake was rejected with the same message, and confirmGatewayReachable verified 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.
  • Consumer suites: 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 base 6ba8529d86d3.
  • pnpm tsgo:core and oxfmt --check clean. 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.

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.
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 24, 2026 08:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T08:04:38.558338Z b4c147c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: S labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: RPC handshakes repeatedly fail, eventually reporting the update as failed.
  • After: Matching HTTP version/build identity and readiness settle verification successfully with an RPC protocol warning.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with useful reported transport proof and regression coverage, but limited full-update evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports an incompatible real Gateway handshake followed by successful production-owner HTTP verification, rather than a captured shipped-update run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An update reports failure after prolonged waiting even though the newly started Gateway is healthy.
Reason: The maintainer-authored direction repairs an observed failure within the existing update-verification contract and adds no public setting.

Regression provenance

Possible 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
Reviewed head: b4c147c2d55e676edc67b6a0ba84d06eb9a6b0d3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The reported real-Gateway child exercise covers the fallback, but no full openclaw update from the latest stable release preserving settings and data is supplied.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Restart-health HTTP fallback keeps the original intent (ea0111c: Verify healthy updated Gateways despite rejected retained-client credentials, using local readiness and expected runtime identity.)
  • Update verification warnings keeps the original intent (ea0111c: Retain a visible warning when HTTP verification substitutes for unavailable authenticated RPC health details.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ea0111c adds src/cli/daemon-cli/restart-health-probe.ts:335 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ea0111cec749; files: src/cli/daemon-cli/restart-health-probe.ts)

PR surface

Source +28, Tests +50, Docs +4. Total +82 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 30 2 +28
Tests 1 50 0 +50
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 84 2 +82

Labels

Label changes:

  • add P1: Reported real updates repeatedly wait through readiness and recovery deadlines and falsely fail despite a healthy replacement Gateway.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: Reported real updates repeatedly wait through readiness and recovery deadlines and falsely fail despite a healthy replacement Gateway.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted output from a full protocol-crossing update that preserves existing settings and data.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 24, 2026, 4:18 AM ET / 08:18 UTC.

@steipete
steipete merged commit fb5692c into main Oct 24, 2026
210 of 213 checks passed
@steipete
steipete deleted the claude/angry-archimedes-e1ea89 branch October 24, 2026 08:38
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 24, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant