Skip to content

fix(update): unblock repair after filesystem device remapping - #170046

Merged
steipete merged 2 commits into
mainfrom
upd/upd-l1567
Oct 12, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/upd-l1567

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes package-update recovery that stays blocked after a reboot or remount changes filesystem device numbers, including an old operation left behind by a newer manual installation.

Fixes #169352. Fixes #169050.

User Impact

openclaw update repair can settle the installed candidate or a verified newer manual installation and archive the old operation. It preserves the live package, retained package trees, helper, and journal evidence. Normal update admission remains strict, and unfinished rollback remains owned by its recovery path.

Older installed updaters still need the separately installed recovery helper or the documented manual upgrade first; downloading a candidate cannot repair the already-running old updater.

Why This Change Was Made

The journal owner now validates matching journal inodes under a consistent, bidirectional device mapping for settlement inspection of prepared, publishing, publication-complete, and superseded records. In-process repair and the separate helper share that owner. Remapped handles can only durably settle and archive; they cannot republish or restore, rewrite the descriptor, or change publication facts.

A newer manual replacement uses the existing manifest, inventory, entry-target, launcher, and current-authority verification before the existing supersession/archive path. Recorded identities remain historical evidence. No configuration, schema, dependency, or persisted-format changes.

The follow-up deletes the helper-only settleRemountedPackageActivation entry point and the extra settlePendingPackageActivation → settlePackageActivation forwarding layer. The sealed helper now calls the shared settlement operation with its operation ID. It also removes the duplicate publication custody/archive completion block, the separate untouched-preparation identity guard, and repeated previous/candidate device projections. These deletions remove 42 net production lines from the reviewed head while retaining the helper remount restriction and all integrity, authority, callback, and warning contracts.

Evidence

Follow-up verification at 8eb11dc7cf93bf2e8c21271140ef3dc1359f3b8b: 97 tests passed across seven focused files, including all 22 public-repair tests and all 5 adapter/store tests. The combined command completed in 382.85 s; the public CLI file took 99.89 s wall time (about 57 s test time), and the infra group took 138.20 s wall time (about 108 s test time). Production and infra-test typechecks, changed-file lint, and independent Codex review passed. Madge: 0 cycles; runtime import check: 0 cycles. The importer run passed the tooling group (46 tests), infra group (287 tests, 66 existing skips), and 10 process tests, then stopped on the same pre-existing 120 s post-core subprocess timeout recorded below. Its setup counters were 138.4 s for fixture preparation, 34.1 s for publication, and 61.5 s for the first healthy child. The fallback command passed eight CLI files (109 tests, 277.93 s wall time), including a repeated runtime-preview file. The final coverage audit identified the unreached retained-executor file, which then passed all 14 tests (144.06 s wall time). All 40 selected importer files were reached. Excluding the repeated runtime-preview run, the focused and importer runs total 553 passed, 66 existing skips, and that one known timeout. The broad importer command exited nonzero; the focused and continuation commands passed. The failed test was not rerun.

Additional existing slow-test evidence from the follow-up: the declaration build/cache case took 58.212 s, bounded-plugin declaration selection 46.650 s, and missing-receipt cases 38.513 s and 31.208 s. These perform real compiler/build work. The lifetime test “preserves version-1 launcher receipts and reads completion through status after helper removal” took 60.503 s (15.387 s in the original-head run); it combines real repair/retirement with a cold CLI-status import. The repair-ledger cases accumulated 163.393 s. These cases passed unchanged; no timeout, retry, assertion, or skip was added.

Original-head evidence follows.

The two new public-repair regressions fail on the original main code with Package publication journal does not match its installation, then pass with this change. They cover a remapped publishing journal with the candidate installed and a remapped publication-complete journal replaced by a manual 2026.10.1 installation, including preservation of both live and archived trees.

node scripts/run-vitest.mjs src/cli/update-cli/update-repair-package-activation.test.ts --maxWorkers=1: 22 passed, 111.38 s wall time, about 28 s test time. Cold shared compiler preparation dominates the remaining time.

Final independent Codex review found no actionable P0–P2 findings. The importer campaign ran all 40 selected files: 548 tests passed and 66 existing tests were skipped, with one pre-existing cold subprocess composition timing out under concurrent host load. Its original main implementations then passed in 58.2 s of test time; the current implementations passed in 84.3 s under the same isolated command. The original 120 s timeout remains recorded; no timeout, assertion, or retry policy was changed, and the diagnostic passes are not presented as a timeout fix. CI timings are not available yet.

check:changed passed the growth, ownership, dependency, formatting, documentation, production typecheck, and all 28 test type graphs before detecting the unused internal TransactionRecipes export. This patch mirrors the one-line cleanup already landed in main as 4cdac89. The failed and remaining steps were resumed individually: unused-export scans, production typecheck, lint, and all remaining guards passed. The full command did not exit successfully on that run. An earlier Node 26 launch crashed with SIGILL during source planning; the completed proof used supported Node 24. Both direct adapter/store consumer files passed (5 tests). Madge reports zero import cycles.

Pre-existing tooling cost: write-unified-entry-dts.test.ts took 155.43 s of test time; its build/cache/restore case took 83.965 s, bounded-plugin selection 39.305 s, and compiler-failure preservation 31.618 s. These exercise real repeated declaration/runtime builds and a consumer typecheck. The staged package-runtime build/load case in managed-handoff-build-config.test.ts took 59.842 s (62.763 s for the file), building the real standalone runtime and exercising isolated recovery commands. Both suites passed unchanged; the repair-ledger suite also accumulated 137.902 s across its existing cases. These costs are recorded under the campaign exception for pre-existing slow suites.

Production: +163/-143 lines (net +20). Tests: +103/-16 lines (net +87). Docs: +17/-6 lines. The production growth adds newer-install verification and shared journal mapping; the follow-up removes superseded entry points and duplicate settlement logic.

Let the journal owner qualify matching inodes and consistent device maps for
settlement only. Use that path from public repair and the separate helper,
verify newer manual installs, and preserve the original recovery evidence.
Normal update admission and unfinished rollback remain strict.

Mirror the upstream internal TransactionRecipes export cleanup from 4cdac89
to keep the required unused-export checks clean.

Fixes #169352
Fixes #169050
@clawsweeper

clawsweeper Bot commented Oct 12, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: M labels Oct 12, 2026
@steipete
steipete marked this pull request as ready for review October 12, 2026 17:36
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR lets update repair settle device-remapped journals for an installed candidate or a verified newer manual installation while preserving recovery evidence.

Example: A retained 2026.9.9 operation records device 57, the filesystem now reports device 32, and a manual 2026.10.1 installation is live.

  • Before: Repair refuses with “Package publication journal does not match its installation.”
  • After: Repair verifies the newer installation and archives the obsolete operation.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful owner-directed recovery work with meaningful integration coverage, blocked by the retained correctness finding and incomplete persisted-recovery compatibility qualification.
Proof confidence 🦐 gold shrimp (3/6) The supplied maintainer-authored classification exempts ordinary media proof; public-repair harness coverage supports the changed owner, but released-state compatibility qualification for the broader repair path remains missing.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After filesystem device numbers change, repair cannot settle a preserved unfinished journal even when a healthy newer package is installed.
Reason: The linked reports establish a recovery dead end, and the supplied maintainer-authored direction authorizes extending the existing owner without new settings or public APIs.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open: it addresses an evidenced update-recovery failure, but the earlier unverified previous-generation settlement finding remains unresolved.

Priority: P1
Reviewed head: 8eb11dc7cf93bf2e8c21271140ef3dc1359f3b8b

Before merge

  • Project identities before refusing unfinished previous-generation recovery (P2) - The earlier finding remains unresolved. An update can stop after recording publishing/displace but before renaming the previous package. After a remount, previous identity 57:100 becomes 32:100: manualReplacement is false and externalPublication is false, but this refusal still compares 32:100 with historical identities. Repair falls through, skips both verification branches, and durably settles and archives the unfinished operation using only the live directory identity. This can clear recovery despite a damaged previous package or changed launcher. Use the projected identities in the remaining eligibility checks and retain refusal or verified retirement for this state; add a public-repair regression.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Project identities before refusing unfinished previous-generation recovery — src/infra/package-update-activation.ts:341-343

Tests

  • Missing end-to-end proof: Qualify the changed CLI/helper repair against released installation state, including v2026.10.2 upgrade compatibility and preserved legacy journals, with settings and recovery evidence intact and subsequent update admission succeeding.
Agent review details

How this fits together

The package-activation owner receives repair requests, persisted journals, and filesystem observations; it acquires current executor ownership and produces a durable settlement and preserved evidence archive.

flowchart TD
  A[Update repair CLI] --> C[Package activation owner]
  B[Separate recovery helper] --> C
  D[Journal and filesystem identities] --> C
  C --> E[Current executor ownership]
  E --> F[Package and launcher verification]
  F --> G[Settlement and evidence archive]
Loading

Technical review

Best possible solution:

Use projected identities consistently and preserve refusal or verified retirement whenever the previous generation remains installed.

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

Reported device/inode comparisons establish the current-main refusal, and source tracing establishes the retained previous-generation bypass; this read-only review ran no target code.

Is this the best way to solve the issue?

Sharing mapping in the journal owner is appropriate, but all recovery selectors must consume that mapping consistently before relinquishing unfinished recovery.

Full review comments:

  • [P2] Project identities before refusing unfinished previous-generation recovery — src/infra/package-update-activation.ts:341-343
    The earlier finding remains unresolved. An update can stop after recording publishing/displace but before renaming the previous package. After a remount, previous identity 57:100 becomes 32:100: manualReplacement is false and externalPublication is false, but this refusal still compares 32:100 with historical identities. Repair falls through, skips both verification branches, and durably settles and archives the unfinished operation using only the live directory identity. This can clear recovery despite a damaged previous package or changed launcher. Use the projected identities in the remaining eligibility checks and retain refusal or verified retirement for this state; add a public-repair regression.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Unfinished remount admission and settlement changes intended behavior with a stated reason (d5c2462: The earlier helper deliberately qualified only the installed-candidate lost-publication acknowledgement and prohibited unverified settlement fallthrough.)
  • Previous-generation retirement keeps the original intent (9497527: Untouched preparation could be retired through the publication owner while verifying the installed previous package and launchers.)
  • Settlement reporting and evidence archival keeps the original intent (4821885: Durably closed history became best-effort maintenance, with reporting before archival and current ownership retained at effects.)
  • Internal TransactionRecipes export changes intended behavior with a stated reason (9dc6466: The shared experimental database adapter introduced the type; this PR explicitly mirrors the unused internal-export cleanup already present on fetched main.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ff6f58a adds src/infra/package-update-activation.ts:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ff6f58a8c32b; files: src/infra/package-update-activation.ts)
  • Patrick Schiller: Raw commit d5c2462 adds src/infra/package-update-activation-settlement.ts:39 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d5c246249673; files: src/infra/package-update-activation-settlement.ts)
  • Dallin Romney: Raw commit 4821885 adds src/infra/package-update-activation.ts:320 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4821885e5b4d; files: src/infra/package-update-activation.ts)

PR surface

Source +20, Tests +87, Docs +11. Total +118 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 163 143 +20
Tests 3 103 16 +87
Docs 1 17 6 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 283 165 +118

Review metrics

Metric Value Why it matters
Production versus test changes Production +163/-143; tests +103/-16 The modest production growth adds shared journal mapping and newer-install verification while removing duplicate settlement paths; the regressions cover distinct repair and custody contracts.

Root-cause cluster

Relationship: canonical
Canonical: #170046
Summary: This PR owns the proposed broader recovery for unfinished journal device remapping; the merged helper addresses a narrower state.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Official-release installations remain blocked from subsequent updates through the documented recovery workflow.
  • merge-risk: 🚨 compatibility: The changed recovery selector can durably close an existing unfinished operation without verifying its installed previous generation.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-12T17:43:36.261Z sha 9345b59 :: blocked before merge. :: [P2] Project identities before refusing unfinished previous-generation recovery

Reviewed October 12, 2026, 2:33 PM ET / 18:33 UTC (Revision 2).

Remove the helper-only settlement entry point and forwarding wrapper, reuse projected identities and the live-package guard, and share custody completion and archive reporting. Keep remount-only helper restrictions and the publication-owner return contract intact.
@steipete
steipete merged commit c66da3d into main Oct 12, 2026
121 of 122 checks passed
@steipete
steipete deleted the upd/upd-l1567 branch October 12, 2026 18:40
RomneyDa pushed a commit that referenced this pull request Oct 13, 2026
…rift (#170046) (2026.10.5 backport)

After a reboot or remount changed the device number (btrfs, APFS renumbering) with every inode intact, the strict journal identity check rejected recovery before settlement could run, blocking every later update. The journal owner now provides a settlement-only remount validation shared by openclaw update repair and the recovery helper: repair settles the installed candidate or verifies a newer manual install and archives the superseded operation. Normal update admission stays strict. Fixes #169352, #169050.

Backport notes: companion of #169410 (previous commit). Production code
applied as on main. Conflict resolution: the sealed helper's remount branch
again omits the FreeBSD selectPackageActivationNativeRoots() call (not on
2026.10.5, see #168775/#168942); the public-repair test file keeps the
branch's existing obsolete-recovery tests and archival-refusal cases and adds
main's two remounted-journal regressions.

Extracted-from: c66da3d
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…rift (openclaw#170046)

After a reboot or remount changed the device number (btrfs, APFS renumbering) with every inode intact, the strict journal identity check rejected recovery before settlement could run, blocking every later update. The journal owner now provides a settlement-only remount validation shared by openclaw update repair and the recovery helper: repair settles the installed candidate or verifies a newer manual install and archives the superseded operation. Normal update admission stays strict. Production net +20 LOC after removing the helper-only path and duplicate identity checks. Fixes openclaw#169352, openclaw#169050.
@alec-avontade-openclaw

Copy link
Copy Markdown

Related Linux case, if anyone hits the repair path again after this fix: 2026.9.36 on a npm-global Linux install (not the macOS device:inode drift reported here) still refuses with a different predicate:

Package publication recovery refused: Package publication generation roles are ambiguous.

Full environment, journal dump and repro sequence: #170031 (comment)

The distinction worth noting: recovery refuses ~53s after the request, and update status reports packageActivation.phase: "prepared" with operationId present, so it is not the same binding check that device remapping broke.

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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

2 participants