Skip to content

fix(update): released updaters fail with state-migrated-no-rollback after #188978 - #190176

Closed
steipete wants to merge 2 commits into
mainfrom
codex/delegated-doctor-artifact-read
Closed

steipete wants to merge 2 commits into
mainfrom
codex/delegated-doctor-artifact-read

Conversation

@steipete

@steipete steipete commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

On current main, native openclaw update from every current stable release (2026.10.7, 10.8 and 10.9) fails with state-migrated-no-rollback and leaves the Gateway stopped. The candidate Doctor refuses with SQLite migration source changed after update capture: ~/.openclaw/state/openclaw.sqlite. The bisect points to #188978 (6fd646e86cd): its parent a5d66ef passes, and 6fd646e and every later main build tested fail.

Why This Change Was Made

The installed (older) updater captures each state database's file generation before it hands off to the candidate's delegated Doctor (update-migrated-finalize.worker.js --doctor). #188978 wrapped that Doctor in withPluginCohortConfigCapture. That wrapper reads the plugin-cohort pair with allowNativeRead: true, a native open of the live state database, before Doctor's migration capture begins. The native open changes the captured file family. The first migration then sees a different generation and refuses the update as an unattributed write.

A SQL write trace on the delegated Doctor process showed no logical writes to the state database before the failure. The changed generation therefore came from the native open itself, not from a writer, which is why earlier write traces found nothing.

The fix reads the pair through the default artifact-preserving snapshot read, which returns the same rows from a private copy. #188978's plugin-restore behavior is unchanged. This replaces the full revert in #189617, which no longer applies cleanly: #189624 and later commits build on the cohort code.

User Impact

Updates driven by the 2026.10.7–10.9 updaters (the first hop for every current user) complete again, and the Gateway is restarted and verified.

Evidence

  • Native Linux Crabbox lane: published 2026.10.9 snapshot with a systemd user Gateway, using the installed 10.9 updater (openclaw update --tag <tarball>). Tarballs were built on the lease.
    • main 1e293027afc: rc=1, state-migrated-no-rollback, unit inactive.
    • main with only this one-line change: rc=0, verification recorded (service running, version verified, channels, HTTP and core ready), unit active.
    • Exact-head result: see the comment below.
  • Regression test: update-plugin-cohort-recovery.test.ts, "keeps the installed updater's captured state generation before Doctor starts". It fails without the fix (generation changes) and passes with it. The whole file passes, 16/16.

…egated Doctor start

Builds with #188978 opened the live state database natively before Doctor's
migration capture, changing its captured file generation. Released updaters
(2026.10.7-10.9) then refused the update with state-migrated-no-rollback and
left the Gateway stopped. Read the plugin cohort pair from a private snapshot.
@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reads plugin recovery metadata through the existing private snapshot reader before candidate Doctor starts.

Example: The published OpenClaw 2026.10.9 updater installs a candidate containing plugin-cohort recovery.

  • Before: Doctor rejects the changed SQLite file generation with state-migrated-no-rollback, leaving the Gateway stopped.
  • After: The metadata read preserves the captured generation, allowing Doctor and Gateway activation to complete.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with a meaningful generation-preservation regression and reported published-driver upgrade success; detailed exact-head CI attribution remains unavailable.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied Linux Crabbox result exercises the installed 2026.10.9 openclaw update entry point against a candidate with this production change and reports successful activation and Gateway verification after the unpatched failure.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Updating from a published stable installation to affected main candidates fails and leaves the Gateway stopped.
Reason: The maintainer-authored direction restores the documented installed-updater contract while preserving the plugin rollback capability.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR narrowly repairs a current-main update regression while preserving plugin rollback recovery; no introduced defect was found, but required CI remains unresolved.

Priority: P1
Reviewed head: 1cffcd13e8c2ab3db1844379b37b1e0f4254bc32

Before merge

None.

Findings

None.

Agent review details

How this fits together

The installed updater captures database generations before delegating to candidate Doctor; plugin recovery reads reservation metadata at that handoff, and migration admission checks that captured state remains unchanged.

flowchart TD
  A[Installed updater] --> B[Capture database generations]
  B --> C[Candidate Doctor handoff]
  C --> D[Read plugin recovery snapshot]
  D --> E[Validate migration source]
  E --> F[Migrate and activate Gateway]
Loading

Technical review

Best possible solution:

Use the existing artifact-preserving reader before Doctor capture while retaining current-row reads and live ownership checks at publication.

Do we have a high-confidence way to reproduce the issue?

The native read is reachable before Doctor migration capture, and the supplied Linux upgrade results and linked bisect identify the matching failure; no target code was executed during this review.

Is this the best way to solve the issue?

Removing the native-read override is the smallest complete repair: it reuses the existing snapshot owner without reverting plugin recovery or weakening migration-source checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 59ef5cdce44f.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source 0, Tests +18. Total +18 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 4 0
Tests 1 18 0 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 22 4 +18

Root-cause cluster

Relationship: canonical
Canonical: #190176
Summary: This PR provides a targeted replacement for the broad revert addressing the same pre-Doctor database-generation failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P1: The documented regression blocks published updaters from activating affected main candidates and leaves the Gateway stopped.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: The documented regression blocks published updaters from activating affected main candidates and leaves the Gateway stopped.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 November 1, 2026, 4:03 AM ET / 09:03 UTC.

@steipete

steipete commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head proof at 1cffcd13e8c, run on Linux Crabbox cbx_dda3b0eeef27 (now released). I restored the published 2026.10.9 snapshot with a systemd user Gateway, built the tarball for this head on the lease, and used the installed 10.9 updater to run openclaw update --tag:

  • The update returned rc=0 after 385 s, through requested → staging → validating → activating → restarting → verifying.
  • Recorded verification reported the service running (2026.10.9), the version verified, and channels, HTTP and core ready.
  • The unit is active, and /readyz returns ready:true,coreReady:true.

The same lane on main 1e293027afc returned rc=1 with state-migrated-no-rollback, and the unit was inactive.

Reviews: autoreview came back scoped-clean. The independent Codex review found nothing in this change. It flagged one existing pre-capture write, update-candidate-predecessor-stop recording a run step when it stops a live supervised predecessor. That write predates #188978 and is not on this lane's path, because the updater stops the Gateway first. I'm tracking it as a separate follow-up.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Superseded by #190179, merged as 9172615. It makes the same production change in src/config/plugin-cohort-recovery.ts: plugin-cohort discovery before Doctor now uses the artifact-preserving snapshot read instead of allowNativeRead: true, and it adds a regression test that the installed updater's physical SQLite capture is unchanged across withPluginCohortConfigCapture.

Thank you for the bisect to #188978 and for the native Crabbox proof that 10.7–10.9 fail. Our deep-pass matrix reproduced the same failure from released 2026.9.36 in all three flows, and #190179 replayed those flows green with the fix. Not yet released.

The remaining follow-up is tracked separately: update-candidate-predecessor-stop records a run step before capture when it stops a live supervised predecessor. That write predates #188978 and is not on the gateway-stopped path.

@clawsweeper

clawsweeper Bot commented Nov 1, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 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-11-01T08:51:09.746267Z 1cffcd1 PR opened
ℹ️ 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.

@steipete
steipete deleted the codex/delegated-doctor-artifact-read branch November 1, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants