Skip to content

fix: let the next update recover from an interrupted update after a reboot renumbers the disk - #201336

Merged
steipete merged 1 commit into
mainfrom
codex/issue-201057
Nov 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/issue-201057

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #201057

What Problem This Solves

If an update is interrupted, for example by a reboot, and the reboot also renumbers the disk (macOS APFS and other filesystems can assign a new device number at boot), every later update fails with update-recovery-pending: "Package publication journal does not match its installation … device number changed only". Updates from the Control UI and from openclaw update stay blocked until someone runs openclaw update repair by hand.

User Impact

The next update now settles the leftover interrupted operation by itself and proceeds. It uses the same verified remount settlement that openclaw update repair already performs, so a user whose machine rebooted mid-update no longer has to find and run a repair command first. Ordinary update admission stays strict: nothing is admitted unless the remount checks (same inodes under one consistent device mapping, recorded package and launcher fingerprints) pass. Unfinished rollback and live original updaters still refuse as before.

Already-released updaters (including 2026.11.2, 2026.11.4 and 2026.11.5) still refuse. Their recovery, verified below: run openclaw update repair --yes, then update again.

Why This Change Was Made

settlePendingPackageActivation runs automatically before update admission. Its first automatic gate compared the operation's recorded previous/candidate identities (device:inode, recorded before the reboot) with the live installation's identity. After a device renumbering, those never match, so automatic settlement declined, and the strict admission check that follows refused the update. The rest of the same function already compares through the verified remount mapping (inspectRemount → currentIdentity), which is why openclaw update repair succeeds on the same state. The gate dates from #169038, which predates remount settlement (#170046), and was never moved onto the mapped identities.

The fix computes the remount-mapped previous/candidate identities once, before that gate, and uses them there. Production change: 9 lines moved/changed in one function, no new state, no schema or config change. Docs: the remount recovery section of docs/install/updating.md now says the next update settles this automatically, and gives older updaters the repair-then-update step.

Alternatives considered: relaxing admission itself to accept device-only drift, rejected because admission must keep refusing unsettled foreign or unfinished operations; and leaving the repair-only path in place, rejected because it leaves Control UI updates blocked with no in-product way forward.

Evidence

  • Regression tests in src/infra/package-update-activation-remount.test.ts (the next update settles a remounted publication with the previous|candidate installed) run real prepared journals with recorded devices shifted. Both fail on base (automatic settlement returns undefined; admission then throws device number changed only) and pass with the fix.
  • Consumer suites (remount, repair command, recovery helper, legacy recovery, lease recovery, retirement, publication boundary, publication kill process, plugin cohort settlement): 4 Vitest shards passed. pnpm tsgo:core, oxlint and oxfmt are clean.
  • Real remount on Linux (Crabbox AWS, main 7eb33cc). The npm prefix sits on a loop-mounted ext4 image. openclaw update is SIGKILLed after its package activation reached prepared. The image is then remounted on a different loop device, giving the same inodes and st_dev 1795 → 1796. Then openclaw update runs again:
Installed updater Next update Recovery
main without fix rc=1 update-recovery-pending, device number changed only openclaw update repair --yes rc=0 (publication-not-started), then update rc=0
published 2026.11.5 same refusal repair rc=0, then update rc=0
published 2026.11.2 (the reporter's version) same refusal repair rc=0, then update rc=0
main with fix (×2) rc=0, Settled previous package update … (publication-not-started), updated not needed

Gap: the kill always landed in prepared, so the candidate-installed (publishing) remount case is covered by the regression test, not by the live run.

  • Reviews: autoreview scoped-clean at P2; an independent Codex review found no findings.

@steipete
steipete marked this pull request as ready for review November 18, 2026 16:19
@clawsweeper

clawsweeper Bot commented Nov 18, 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 18, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T16:21:07.312221Z db59bd3 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS labels Nov 18, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lets the next update automatically settle an eligible interrupted package publication after filesystem device numbers change.

Example: An update is interrupted in prepared state, then the filesystem device number changes from 1795 to 1796 while its inodes remain unchanged.

  • Before: The next openclaw update refuses with update-recovery-pending and requires manual repair.
  • After: The updater verifies the remapped installation, archives the interrupted operation, and proceeds.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A minimal, well-supported repair with real CLI evidence; its scope covers future eligible automatic recovery rather than resolving every retained-state question in the linked report.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied CLI results exercise a real interrupted update on loop-mounted ext4 with unchanged inodes and changed device numbers, then show the fixed next update settling prepared state and succeeding; candidate-installed publishing state is covered by the reported red/green regression rather than the live run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: A reboot during an update can leave later updates blocked until the user discovers and runs a terminal repair command.
Reason: The maintainer-authored direction removes avoidable recovery work with a minimal change, but cannot retrofit already-installed released updaters or establish recovery eligibility for the reporter's unknown retained state.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a focused repair to automatic update recovery, with no actionable code findings; the exact-head CI gate remains pending.

Priority: P0
Reviewed head: db59bd37f7f0b96629f65ba4103fc1f85f5356cc

Before merge

None.

Findings

None.

Agent review details

How this fits together

CLI and Control UI updates reach package-activation admission, whose shared settlement owner verifies retained journals, installation identities, launchers, and lease ownership before closing eligible recovery operations.

flowchart TD
  A[CLI or Control UI update] --> B[Update preparation]
  B --> C[Package activation settlement]
  C --> D[Verified remount mapping]
  D --> E[Lease and package verification]
  E --> F[Archive retained operation]
  F --> G[Strict update admission]
Loading

Technical review

Best possible solution:

Use the existing verified remount settlement before strict admission, while preserving its lease, fingerprint, launcher, and unfinished-rollback checks.

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

Current-main source deterministically declines automatic settlement after device-only drift; the PR additionally supplies real CLI reproduction results and reports both new regression cases failing on base and passing with the fix.

Is this the best way to solve the issue?

The patch is the smallest complete repair for the automatic identity gate: it reuses already-computed remount projections and leaves verification and persistence with their existing owners.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Automatic package settlement identity gate keeps the original intent (ff6f58a: Automatically settle eligible retained operations before admission while preserving fresh ownership and installation checks.)
  • Remount mapping and recovery documentation changes intended behavior with a stated reason (c66da3d: Permit verified settlement after device remapping without weakening ordinary admission or granting remapped handles publication authority; this PR explains why automatic settlement should use the same identities.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit 0ce9c77 adds src/infra/package-update-activation.ts:301 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0ce9c779f48d; files: src/infra/package-update-activation.ts)

PR surface

Source -1, Tests +21, Docs +5. Total +25 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 8 9 -1
Tests 1 21 0 +21
Docs 1 6 1 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 35 10 +25

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P0: The linked community report establishes a blocked managed update with terminal-only recovery; this PR restores automatic recovery for eligible remounted operations.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit 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:

  • P0: The linked community report establishes a blocked managed update with terminal-only recovery; this PR restores automatic recovery for eligible remounted operations.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • 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 18, 2026, 11:34 AM ET / 16:34 UTC.

@steipete
steipete merged commit ea1c9d5 into main Nov 18, 2026
135 of 202 checks passed
@steipete
steipete deleted the codex/issue-201057 branch November 18, 2026 16:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…201336)

Co-authored-by: Peter Steinberger <[email protected]>

(cherry picked from commit ea1c9d5)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit f609c48b515324682cc89d024b987dfafb59a187)
tideclaw-bot added a commit that referenced this pull request Nov 24, 2026
…201336)

Baseline adaptation: Use verified current device identities at .33 automatic admission, before the existing ownership and fingerprint checks. Adapt regressions to the branch remount fixture.

(cherry picked from commit ea1c9d5)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 71e59e7e8c275ee8cf639d64b921cf08a1ce4ee7)
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…aw#194058)

Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139.

Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact.

Co-authored-by: TorstenW <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>

(cherry picked from commit 7c702c3)

Release adaptation: Capture invoking operator env before candidate admission, forward to interactive triage only; preserve latest target selectors, confirmation and lease cleanup ordering. Exact three authorized production paths plus real lifecycle regression.

Follow-up dispositions: ad4863d fix: preserve the running installation when an agent updates its Gateway (openclaw#201570); dc73ec0 fix: let updates finish when another tool briefly reads OpenClaw's databases (openclaw#202541); d07b530 fix: clarify PostgreSQL schema upgrades for Git installs (openclaw#202098); e60ea9f test(update): add a Git release upgrade-survivor scenario (openclaw#201956); 2ef6f7b fix(update): build and serve Git releases outside node_modules (openclaw#201917); dbc1aa0 fix: keep the openclaw command and Gateway working after updating a pnpm install (openclaw#201735); f5e7641 fix: Git checkout updates across a schema change no longer end as post-update-failed after the new release starts (openclaw#201600); 2183caf fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database (openclaw#201463); 47e8649 fix: explain why Doctor cannot restore a scheduled job’s account (openclaw#201550); 8f2cfd4 fix: remove updater-only restrictions from agent maintenance guidance; cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 24cb734 fix: keep carried-over scheduled jobs running after updates (openclaw#200653); d1276e1 feat(doctor): check OpenClaw ID member roles and honor an optional roles default (openclaw#197785); 0a39956 fix: finish updates when another tool reads OpenClaw's databases during the update (openclaw#201330); ea1c9d5 fix(update): settle remounted package publications before admission (openclaw#201336); 66b5212 fix(update): isolate malformed retained-install markers (openclaw#201199); 7e79c83 fix: let the next update finish a killed source checkout update (openclaw#201009); d905d8a fix: let the next update finish a killed update after the machine restarted (openclaw#200994); fdf0c95 fix: let the next update finish a killed update that had already installed the new version (openclaw#200866); 0c19bcd chore(release): close out 2026.11.5 on main (openclaw#200577); a1940e0 fix(matrix): keep explicit recovery available during deferred migration (openclaw#200805); 18b4776 improve: explain package baseline drift during updates (openclaw#200802); 1ad4cad fix(doctor): reclaim macOS updater runtimes blocked by non-updater processes (openclaw#200732); 427c857 fix: keep one missing archived transcript from blocking every update (openclaw#200733); 802e3f7 fix(update): keep valid cold archives from blocking updates (openclaw#200659); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); 3afe212 fix: let Doctor publish unchanged plugin migrations in any order (openclaw#200658); f65e4db fix(doctor): reclaim runtimes blocked by unrelated Linux processes (openclaw#200657); dab086c fix(update): let candidate Doctor read plugin dependencies from the staged package (openclaw#200595); 3447bee fix(update): keep updates going when the predecessor writes during its stop (openclaw#200569); 0ce9c77 fix: let the next update settle a package publication that a killed update left behind (openclaw#200550); ae31ea3 fix(update): repair handoffs in the journal-pinned lease store (openclaw#200532); 74020ea fix: continue updates when initial SQLite capture is stale (openclaw#200328); 6747b1e feat(update): run Git checkout installs from releases behind the release link (openclaw#199706); e3f8a67 fix(state): keep completed retained agent stores out of startup upgrade (openclaw#200284); 3c512c5 fix(gateway): move managed update lease operations off the main thread (openclaw#200169); ea69fcb chore(release): close out 2026.11.4 on main (openclaw#199956); 618bf31 fix(state): bound startup upgrade copies and pruning to owned state (openclaw#199929); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); 5dbf569 fix(update): plugin failures never fail an update or Gateway health; 764761e fix(update): refuse missing host prerequisites in one line and record a cause per attempt; 4c4fef4 fix(ui): update dialog claims installation before progress is confirmed (openclaw#199254); 136e1f6 fix(update): retrying an update from a dev checkout is refused after a killed update (openclaw#198673); 3bd03da fix(update): avoid duplicate database copies while the Gateway is stopped (openclaw#198148); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); e333f7e chore(ci): drop retired test-lines allocation records (3/3) (openclaw#197657); fd6fa47 fix: converge Gateway updates with environment-only service overrides (openclaw#196371); 7cf5e75 fix: clarify split-install updates and blocked Doctor repairs (openclaw#196342); 6ff8c86 fix(update): retain lazy sqlite catalog generation (openclaw#197095); 930e1f7 fix: keep stable updates and recovery free of premature migrations (openclaw#196474); a15f737 fix: preserve external plugin data during update rehearsal (openclaw#196301); 92798ae fix: updates survive interrupted heartbeat runs (openclaw#195656); c1e55e2 fix(update): restore LaunchAgent registration after repair contention (openclaw#195406); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685); 689cfc8 fix(update): reclaim dead closing triage repair leases (openclaw#194503); 86bc89e fix(doctor): keep standing Codex parameter advice out of retirement blockers (openclaw#193650); 691bc8d fix(backup): read the backup engine without copying the live database (openclaw#194234); 000542f fix(backup): backups and updates fail on slow storage when a header probe batch misses its deadline (openclaw#194239); 31a65d5 fix(update): skip --no-lazy-fetch on Git versions without it (openclaw#194198); e45e99d fix(update): preserve dev update sources in tag-only Git clones (openclaw#193109)

Validation: Baseline2 intended operator-agent failures/32 controls passed; candidate34/34passed (194058-green.log). Accept launches synthetic operator-only CLI with expected env, decline starts nothing. Isolated updater flow, not live systemd/upgrade qualification.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 6689fd575ada8fe40a9593784deac18ec73041cd)
(cherry picked from commit 92e7a9fa223b0dc35801f25f70be90b472d9a6b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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