Skip to content

fix(update): make completed recovery evidence best effort - #167330

Merged
RomneyDa merged 1 commit into
mainfrom
fix/package-completion-admission
Oct 8, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/package-completion-admission

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Related: #167302, #164074, #166135. Companion fixes: #167358; release qualification: #167377.

What Problem This Solves

Historical recovery evidence can permanently block future package updates even after the live package is verified or recovery is already complete. This includes changed retained-package metadata or bytes, obsolete helper/anchor and lease identities, and newer completion receipts that shipped 2026.9.8/2026.9.9 cannot parse.

User Impact

Verified cleanup becomes best effort: keep changed evidence, durably close the obligation, report the result, then archive the entire historical control directory. New completion details no longer remain in older updaters’ active admission path. Completed history does not regain restoration authority when filesystems, leases, or retained copies change.

This does not make candidate-only code run before an unchanged, already-blocked 9.8 updater downloads it. A compatible installed recovery implementation is still needed to clear such an existing blocker; releasing a new target alone cannot change old admission code. The maintained released-driver negative control proves this boundary.

Why This Change Was Made

Builds on Scott Hanselman’s merged #167302 and expands this existing follow-up rather than creating a replacement PR:

  • Exclude activation/control/superseded recovery trees from retained-runtime collection, preventing updater-created hardlinks from changing their metadata.
  • Reverify the selected live package and launchers before converting retirement failures into retained evidence and warnings.
  • Treat known completed receipts independently of obsolete filesystem and lease identities, while retaining strict schema, installation binding, and current journal custody checks.
  • Use one durable settlement/archive owner for verified publication, manual replacement, and unused preparation. Historical helper/anchor identities do not authorize current mutation and no obsolete helper is executed.
  • Report settlement before archival so an interrupted reporting step remains replayable.
  • Archive complete control/evidence best effort. If archival cannot finish, retain the closed receipt and warn rather than permanently block the next update.
  • Keep unfinished rollback, unknown active operations, live-candidate verification, current journal custody, and sticky writer authority strict. Lease loss never bypasses live verification.

Archival-failure disposition

Retain the warned fallback. This is an intentional availability choice in the requested best-effort historical-cleanup scope: after a known completed record cannot be archived, preserve it and allow the existing non-journaled package-swap implementation. That particular update has no standalone publication-recovery helper; an interruption can therefore require installer/manual recovery. The warning states that limitation.

This fallback does not apply to an unknown or unfinished operation, does not discard old evidence, does not bypass current writer/journal authority, and does not relax live-package verification. A cleanup-only collision or permission failure must not become a permanent update-admission prerequisite. No new storage schema or intent is introduced. Packed released-writer qualification is completed below.

Scott’s missing publication-complete eligibility remains in the merged base. The conflict with his public repair test is resolved in this consolidated branch. No new schema version or receipt intent is introduced.

Evidence

  • 177 distinct focused tests passed across the affected runtime, public repair, retirement, retained-runtime, and historical-evidence runs. Final 72-case public repair regression pass includes interrupted-report replay; final retirement suite passed 6/6.
  • Full changed-file gates passed: production and all 27 test typecheck graphs, lint, formatting, caps, dead exports, repository and storage guards.
  • Independent P0–P2 review found one reporting-order defect. Fixed and proven red/green: the callback now runs after durable closure and before archival. No finding remains unresolved; the authentic review result is retained as findings plus disposition, not relabeled clean.
  • Actual released 9.8/9.9 reader integration previously proved the completed receipt rejects before archival and admits after archival. Those were source bundles, not packed release binary proof.

Completed packed-candidate qualification (2026-10-08)

All five maintained Docker cells passed on their first attempt, with no timeout; final scheduler status is passed and cleanup joined. The parent independently reran assertPackageRecoveryEvidence on all five structured receipts.

Released writer / scenario Result Cell time
2026.9.8 / publication interruption Passed 930 s
2026.9.9 / publication interruption Passed 752 s
2026.9.8 / post-publication Doctor failure Passed 827 s
2026.9.9 / post-publication Doctor failure Passed 659 s
2026.9.7 → unchanged 2026.9.8 / stranded first hop Passed negative control 322 s

Positive cells used the exact composed candidate 1aa57206f693d5e2fbce607289d0bbeefbff32d1, tarball SHA-256 20f5375db04391e3155d1a1386843e8aeb80cade377193b71e7221e5b7d490f7. This is a local qualification package labeled 2026.9.9, not a published release. Runtime owners match #167330 at 2c6986b123f8ce44bbeb9c714ab20a3515a73a30 and #167358 at d3932c61a3517bb171d4c1242a2699897bae1ee8.

Each authentic released writer created its own journal and helper and reached publication-complete. Installed-candidate public repair and repeated repair exited 0. Full retained-tree inventory, identity and original helper digest, unchanged candidate bytes, and authored settings were preserved. Every positive cell then installed the distinct expected package/build identity 2026.9.10-first-hop.0 through the updater, with retained evidence and settings still preserved. This supplies the requested shipped-writer compatibility/repair/next-update proof; focused unfinished-restoration refusal regressions remain separate supporting evidence.

The negative control confirms unchanged 9.8 blocks before staging/accessing the deliberately absent candidate: update-recovery-pending, candidateCodeInvoked:false. It does not claim candidate-only rescue of a stranded old updater. Old-reader → external-new-repair → old-reader remains uncovered, and no full release upgrade or release publication is claimed.

Frozen trusted harness: ec0a4e67d8a3ae45e0311cb27a62f4e00b745820. At final harness head 6c05dc5bfebacd61b25333d5b07a3a3913c52f80, recovery-specific modules, policy and Docker planner remain byte-identical; shared main phase-logging/restart-fixture changes are covered by focused conflict tests, not claimed byte-identical. Aggregate cell time is 3,490 s (58m10s), excluding setup. These are local Docker measurements, not CI seconds.

Current-head required CI is green on all three PRs. Exact-head ClawSweeper reviews completed with no code findings; their outstanding qualification requests are addressed by these results. Existing independent source-review dispositions and the harness's inherited local Knip failure remain recorded, not relabeled as clean checks.

@clawsweeper

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

@RomneyDa
RomneyDa marked this pull request as ready for review October 8, 2026 16:40
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: M labels Oct 8, 2026
@clawsweeper clawsweeper Bot added 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. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 8, 2026, 2:38 PM ET / 18:38 UTC (Revision 3).

ClawSweeper review

What this changes

The branch makes verified package-recovery cleanup best effort, preserves historical evidence, and archives completed journals outside future update admission.

Example: A verified update cannot remove its recovery anchor

  • Before: The update reports failure and leaves package retirement pending.
  • After: The update completes with a recoverable-maintenance warning and preserves the recovery evidence.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful shared-owner repair with no concrete finding, but shipped upgrade compatibility remains unqualified.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The MEMBER-authored PR is outside the ordinary external-contributor proof gate. Its changed recovery owners have in-process regression evidence, but packed released-writer upgrade qualification is explicitly pending; source-bundle reader checks and the old-updater negative control do not establish compatible repair and subsequent update.
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 healthy installed package can remain unable to update because completed recovery evidence changed or cannot be cleaned up.
Reason: The change repairs a concrete update blocker through the existing owner. It deliberately leaves unchanged older updaters' first-hop limitation outside its claim and records the cleanup fallback tradeoff.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: the fix remains necessary, but packed-release upgrade compatibility still needs qualification before merge. No actionable patch defect was found.

Priority: P1
Reviewed head: 2c6986b123f8ce44bbeb9c714ab20a3515a73a30

Before merge

  • Complete next step (P2) - Attach the four packed-release recovery qualification results, bound to the composed candidate identity, showing preserved settings/evidence and a successful distinct next update; redact private information.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

None.

Tests

  • Missing end-to-end proof: The four positive cells remain pending: actual 2026.9.8 and 2026.9.9 writers, each with publication interruption and Doctor failure, followed by the exact composed packed candidate repairing twice and completing a distinct next update with settings and evidence preserved. This review did not execute base/head regressions.
Agent review details

How this fits together

The package updater replaces the installed package and command launchers while recording recovery obligations in SQLite. Repair verifies the installation, closes those obligations, and preserves historical evidence.

flowchart TD
  A[Update or repair command] --> B[Recovery journal]
  B --> C{Operation completed?}
  C -->|No| D[Verify installation and current writer]
  D --> E[Durably close recovery]
  C -->|Yes| F[Preserve and archive evidence]
  E --> F
  F --> G[Report outcome and admit later updates]
Loading

Technical review

Best possible solution:

Keep completion and archival in the existing recovery owner, with released-writer qualification demonstrating preserved settings and evidence through repair and a subsequent update.

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

Yes, source and focused regression scenarios establish how obsolete recovery evidence blocks later admission; this read-only review did not execute a failing run.

Is this the best way to solve the issue?

Yes, the existing recovery owner is the appropriate repair boundary, and the fallback tradeoff is explicitly recorded; packed-release compatibility remains unproven.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • src/infra/package-update-activation-journal.ts and package-update-activation-paths.ts changes intended behavior with a stated reason (2d26ebd: Reconcile completed Linux device drift while preserving the cross-version journal format and requiring original inodes and installation binding.)
  • src/infra/package-update-activation-custody.ts and package-update-activation-settlement.ts changes intended behavior with a stated reason (fb84dd5: Settle a verified live candidate while preserving evidence and requiring helper, custody, and executor checks.)
  • src/infra/package-update-publication-owner.ts and package-update-swap-retirement.ts changes intended behavior with a stated reason (b107d4a: Use one durable package journal and external helper for interrupted publication, recovery, and retirement under live authority.)
  • src/infra/package-update-backup-paths.ts keeps the original intent (9a62cc8: Exclude updater-owned historical backup artifacts from runtime inventory to avoid following unrelated installations.)
  • src/cli/update-cli/update-repair-command.ts keeps the original intent (fb84dd5: Record settlement and retained evidence in update history while preserving the original failed outcome.)
  • src/infra/package-update-activation.ts publication-complete eligibility keeps the original intent (3ed1e21: Admit completed publication into the existing verified external-publication settlement path.)

Testing

Proof path: in-process harness. Added test files: 6.

Security

None.

Evidence

What I checked:

  • Pinned introduced changes: Reviewed the verified merge-base-to-head delta, including production owners, documentation, and all six changed test files; endpoint drift was excluded. (2c6986b123f8)
  • Current-main necessity: The relevant updater, repair, and documentation paths are unchanged between the merge base and fetched main. The merged fix: recover completed package updates with changed rollback evidence #167302 supplies publication-complete eligibility, but not this broader cleanup and archival behavior. (src/infra/package-update-activation.ts, b3b40e1615d5)
  • Accepted archival-failure tradeoff: The current MEMBER-authored body explicitly retains the warned non-journaled fallback after known completed evidence cannot be archived, acknowledging that interruption can require installer/manual recovery. This resolves the previous decision request within that scope. (src/infra/package-update-activation.ts:160, 2c6986b123f8)
  • Upgrade qualification remains pending: The complete current body distinguishes released-reader source bundles from packed-release execution and explicitly leaves exact composed packed-candidate qualification pending. Captured body source identity: 4d140dc7b8eba570e4d9cfa32c46c69838385fd1fdbeec1c348e204e45a13518. (2c6986b123f8)
  • Companion qualification boundary: fix: release validation misses interrupted package upgrades #167377 reports authentic published-writer interruption and a passed old-updater negative control, but still leaves all four positive 2026.9.8/2026.9.9 repair-and-next-update cells pending. Its negative control does not prove this branch's recovery. (03fd479007c1)
  • Closure and reporting order: Settlement commits the completed obligation before reporting, then archives its control directory; interrupted reporting leaves a replayable active receipt. (src/infra/package-update-activation-custody.ts:195, 2c6986b123f8)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Scott Hanselman: Raw commit 3ed1e21 adds src/infra/package-update-activation.ts:245 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3ed1e21065ea; files: src/infra/package-update-activation.ts)

PR surface

Source +67, Tests +441, Docs +41. Total +549 across 23 files.

View PR surface stats
Area Files Added Removed Net
Source 14 526 459 +67
Tests 6 660 219 +441
Docs 3 68 27 +41
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 23 1254 705 +549

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/package-update-activation-status.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: partial_overlap
Canonical: #164074
Summary: The branch addresses historical package evidence, while the canonical report also includes the immutable installed-updater first-hop limitation.

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: Completed package-recovery obligations can prevent users from completing subsequent updates.
  • merge-risk: 🚨 compatibility: Persisted completion interpretation changes, and the explicitly accepted archival-failure fallback gives a later update weaker standalone recovery guarantees.
  • 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.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-08T16:47:22.456Z sha 4cd5478d0622d613a11a8f3e90dd038b581f1a6d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T18:27:26.691Z sha 2c6986b :: blocked before merge. :: none

@RomneyDa
RomneyDa force-pushed the fix/package-completion-admission branch from 4cd5478 to 2c6986b Compare October 8, 2026 18:20
@RomneyDa RomneyDa changed the title fix: completed recovery receipts block older updaters fix(update): make completed recovery evidence best effort Oct 8, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 8, 2026
@GitHoubi

GitHoubi commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

One data point on how common the "obsolete lease identity" case is. On Debian 13 /tmp is tmpfs by default, and the managed handoff store lives at /tmp/openclaw/managed-update-handoffs.sqlite (resolvePreferredOpenClawTmpDir()). Every reboot therefore recreates it with a new inode.

  • A receipt completed by a normal 2026.9.7 -> 2026.9.8 openclaw update recorded databaseIdentity 43:4514. After a few reboots the store was 43:4572, and openclaw update status --json reported packageActivationError: "managed handoff lease database identity changed" for that already-completed receipt.
  • Today's successful 2026.9.8 -> 2026.9.9 update wrote a new completed receipt bound to 43:4572 again, so it will go stale at the next reboot.

From reading v2026.9.8 and v2026.9.9: a top-level CLI update captures the current store identity as its authority, and replaceCompleted() throws The previous package receipt is not safely replaceable. when the receipt's databaseIdentity/parentIdentity differ. So on such hosts, the first update after any reboot should be refused by the installed 9.9 driver. That includes users who followed the one-time npm install -g [email protected], because the manual install leaves the old receipt in place. I have not observed that refusal yet; on 9.8 the hard-link refusal fired first. I will report back after the next update.

If that reading is right, it might be worth noting in the release notes or troubleshooting docs which recovery the 9.9 driver supports for this case until a driver with this PR is installed.

@RomneyDa
RomneyDa merged commit 4821885 into main Oct 8, 2026
150 of 151 checks passed
@RomneyDa
RomneyDa deleted the fix/package-completion-admission branch October 8, 2026 19:48
RomneyDa added a commit that referenced this pull request Oct 8, 2026
Backport all required recovery fixes to 2026.10.1: #167302, #167330,
#167358, and #167377. Include their missing settlement prerequisites
#164997, #165238, and #165607.

Close obsolete recovery custody durably before best-effort evidence archival;
keep unfinished rollback and current mutation authority strict. Completed
history cannot block subsequent updates. Qualify authentic interruptions
from pinned 9.8/9.9 updaters plus the unchanged 9.7-to-9.8 negative control.

Adapt donor APIs to the release-owned publication and lease database owners.
No version, dependency, budget, permission, or publication changes.

Proof:619 focused tests passed, including14 release-profile cases;
fresh complete69-file P0-P2 review clean. Complete changed gate passed.
Exact combined release build and stable/all/soak qualification remain pending.

Sources:
3ed1e21 (#167302)
4821885 (#167330)
8879e5e (#167358)
bc860ad (#167377)
9497527 (#164997)
5ae6497 (#165238)
fb84dd5 (#165607)

Co-authored-by: Scott Hanselman <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
roboclaw-bot added a commit that referenced this pull request Oct 8, 2026
Keep the canonical completed-history repairs from #167330 and #167358 rather than duplicate their owners. Retain the reviewed Git, native, and optional restart-install-history fixes. Integrated focused validation: 429 infrastructure and 61 CLI tests passed; independent review clean through P2.

Co-authored-by: fuller-stack-dev <[email protected]>

Copy link
Copy Markdown

Independent installed-release evidence for the completed-receipt / obsolete-lease case discussed here. Linux x64, npm-global installation (~/.npm-global), managed systemd user Gateway. Current installed OpenClaw: 2026.9.9 (bcfc888).

openclaw update status currently reports:

Package recovery: managed handoff lease database identity changed

Read-only inspection of the retained package activation journal shows:

  • completed historical operation: 2026.9.7 → 2026.9.8
  • phase: anchor-retired; intent: unlink-helper; selected: candidate
  • anchor and helper absent
  • journal mode 0600, link count 1; control directory mode 0700
  • retained lease DB: /tmp/openclaw/managed-update-handoffs.sqlite
  • recorded file identity 36:32, parent 36:23
  • current file identity 37:370, parent 37:21

In the installed bundle, readPackageActivationReceipt in dist/package-update-activation-Cqu5HWNm.mjs calls assertManagedUpdateLeaseDatabaseIdentity(record.descriptor.authority) before returning the completed receipt. The identity guard rejects the obsolete temporary DB identity.

The temporary storage was recreated; the exact event was not reconstructed. Proven impact is the erroneous current recovery status. We have NOT tested whether the next upgrade is blocked.

This appears to match this PR's intended fix, so I am adding evidence rather than opening a duplicate regression. Which published npm release/build contains the fix, and what is the supported way for an already-installed 2026.9.9 reader to settle this completed record? The local qualification package labeled 2026.9.9 is not evidence that the published npm package contains it.

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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

3 participants