Skip to content

fix(update): let repair settle a pending recovery whose lease database identity changed - #164849

Merged
steipete merged 1 commit into
mainfrom
upd/upd-recovery-pending-lease-identity-changed
Oct 4, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-recovery-pending-lease-identity-changed

Conversation

@steipete

@steipete steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes openclaw update repair refusing an orphaned package recovery with managed handoff lease database identity changed, leaving every subsequent update blocked by update-recovery-pending.

Closes #164817
Closes #164826

User Impact

Repair can close the obsolete package operation as recovery-lease-identity-changed, warn with its original operation ID and retained evidence directory, and admit the next update. It preserves the installed package, launchers, staged files, and recovery helper. Matching identities and a current live update owner retain their existing refusals.

Run repair from a CLI containing this fix. An older installed updater cannot receive the correction from a candidate it refuses before staging; the documented manual installation hop remains necessary in that case. Pending state restoration keeps its own admission checks. No new options, dependencies, or SQLite table migrations.

Reported by @szef-svg and @izrl613.

Why This Change Was Made

The existing package-activation settlement owner required the obsolete lease database even for explicit repair. It now captures the current database identity and acquires a fresh executor fence before settling custody. The completed receipt allows the next package preparation to reuse the journal without requiring the obsolete identity. The journal retains its original descriptor; settlement moves recovery artifacts through the existing durable archival path without restoring an old package over the current installation.

The historical package descriptor records an operation ID rather than an update-ledger run ID; the warning uses that recorded ID without inventing a run association.

Evidence

  • Regression failed on the original code with the exact reported identity-change error through updateRepairCommand.
  • pnpm test src/cli/update-cli/update-repair-package-activation.test.ts --maxWorkers=1 passed three times on Blacksmith Testbox tbx_01m43190gqrwr67x9kra46mn3r: 9 tests per run; command wall times 21.35 s, 18.32 s, and 17.24 s, with approximately 1–1.3 s of test execution per run. Compiler preparation dominates wall time.
  • The regression checks retained bytes and identities, the unchanged package and launcher, next package preparation, matching-identity refusal, and refusal while a current executor owns the replacement database.
  • Importer discovery with rg -l "package-update-activation|update-repair-command" --glob "*.test.ts" src extensions packages test, followed by the repository test runner: 608 passed, 13 existing skips; 37 files passed and one suite skipped, 169.15 s wall time.
  • node scripts/check-changed.mjs --base 9c66d4c9a39b16d70e7c55186fe7e8550468a663 passed, including core types, all 27 test typecheck graphs, lint (0 warnings/errors), docs, ratchets, and import-boundary checks. Combined importer/gate command exited 0 in 25m54s.
  • Final macOS arm64 single-file check: 9 passed, 31.90 s command wall time (about 4 s in tests; shared compiler preparation dominates).
  • Independent Codex P1 review through the configured direct route: no actionable findings.

Remote regression and gate environment.

Published-driver compatibility was exercised with the actual package-update-activation-recovery.mjs from the integrity-verified [email protected] registry tarball on Node 24.19.0. The helper returned status exit 0 with a matching lease, then exit 1 with the exact reported refusal after replacement. Candidate repair settled the operation, preserved all 66,233,478 helper bytes, and admitted the next preparation. The targeted cell passed in 2.452 s of test time / 22.53 s command wall time on Testbox tbx_01m433dee52k8dmhkjvgh0nzg7 (environment). This is isolated recovery/next-admission proof; no operator Gateway was touched and no full live Gateway update is claimed.

Tooling diagnosis: npm pack initially refused the exact published version because of its release-age cutoff; the named tarball was instead downloaded directly and its SHA-512 checked against registry metadata. The first temporary compatibility fixture spent over 210 s in Vitest deep Buffer comparison and was cancelled. Vitest traverses every byte and builds Object.entries; replacing that temporary fixture assertion with native Buffer.equals preserved exact-byte verification and reduced the complete compatibility test to 2.452 s. No timeout increase, weaker assertion, or product-code change was used to hide it. A local post-fix attempt also stopped before tests because simultaneous lease creation changed the compiler input namespace; subsequent tooling and compilation were serialized.

Source tree verified against remote proof: 648982a845f6bdf54696ba0bb0d5f332c8162e32. Production LOC: +49/-20; tests: +106/-87; docs: +11/-0. PR CI timing is pending; no CI success is claimed from the Testbox workflow status.

Explicit repair closes obsolete package activation as recovery-lease-identity-changed under fresh executor ownership, retaining artifacts and preserving matching-identity and live-owner refusals. Completed receipts permit the next package preparation against the current database.
@clawsweeper

clawsweeper Bot commented Oct 4, 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 labels Oct 4, 2026
@steipete
steipete marked this pull request as ready for review October 4, 2026 09:26
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 5:32 AM ET / 09:32 UTC.

ClawSweeper review

What this changes

The PR lets explicit update repair settle obsolete package recovery after its lease database changes, preserve recovery artifacts, and admit the next update.

Merge readiness

✅ Ready for maintainer review

This PR addresses a confirmed update-recovery dead end that remains on current main and in the latest release. The focused repair and published-driver evidence support keeping it as the implementation candidate; no actionable introduced defect was found.

Priority: P0
Reviewed head: c7967e13d84e4ea6828f0995fbba2187a0d05880

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with useful negative controls and specific published-driver compatibility evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured evidence ties the package-settlement owner to an integrity-verified 2026.9.7 helper on Node 24.19.0, observes the exact replacement refusal, then records preserved bytes and successful next preparation after candidate repair. Its source-tree identity matches this head. Existing-journal compatibility is covered; raw linked logs were proxy-blocked, and no full Gateway update is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured evidence ties the package-settlement owner to an integrity-verified 2026.9.7 helper on Node 24.19.0, observes the exact replacement refusal, then records preserved bytes and successful next preparation after candidate repair. Its source-tree identity matches this head. Existing-journal compatibility is covered; raw linked logs were proxy-blocked, and no full Gateway update is claimed.
Evidence reviewed 12 items Pinned introduction: Reviewed the merge-base-to-head delta across all eight introduced paths. The checkout and original PR head are c7967e1; its recorded parent is 9c66d4c. Current-base drift was not attributed to this PR.
Current ownership before settlement: Repair captures the existing replacement database, acquires a fresh executor fence, admits journal recovery under that fence, and checks the installation identity before invoking archival custody. The executor refuses acquisition when another live updater owns the installation.
Final-effect fencing: The archival owner rechecks current executor authority, journal revision, installation identity, and transfer identities around renames and directory synchronization. Completion requires the retained anchor and helper identities; it does not grant execution authority.
Findings None None.
Security None None.

How this fits together

Package activation records custody of installed packages, staged replacements, launchers, and recovery helpers. Update repair uses that journal and current executor ownership to settle stranded operations before another update proceeds.

flowchart TD
  A[Explicit update repair] --> B[Read recovery journal]
  B --> C[Compare lease database identities]
  C --> D[Acquire current update ownership]
  D --> E[Archive recovery artifacts]
  E --> F[Record completed settlement]
  F --> G[Admit next package update]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +29, Tests +19, Docs +11. Total +59 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 6 49 20 +29
Tests 1 106 87 +19
Docs 1 11 0 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 166 107 +59

Review metrics

Metric Value Why it matters
Published-driver compatibility 2026.9.7 driver × candidate repair The recorded cell exercises the shipped helper's exact refusal, preserved artifacts, and subsequent update admission.

Technical review

Best possible solution:

Keep settlement in the existing package-recovery owner, preserve evidence and current ownership checks, and retain the documented installation hop for older blocked drivers.

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

Yes: replacing the recorded lease database while package recovery remains pending reaches the current-main identity refusal. The PR records a failing pre-fix public-entrypoint regression and published-driver reproduction; this review did not execute code.

Is this the best way to solve the issue?

Yes: extending the existing settlement owner avoids deleting evidence or weakening normal recovery admission, and the completed-receipt change permits the next update under fresh ownership.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P0: The linked official-installation reports show ordinary updates and supported repair blocked, with recovery requiring a technical installation hop.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured evidence ties the package-settlement owner to an integrity-verified 2026.9.7 helper on Node 24.19.0, observes the exact replacement refusal, then records preserved bytes and successful next preparation after candidate repair. Its source-tree identity matches this head. Existing-journal compatibility is covered; raw linked logs were proxy-blocked, and no full Gateway update is claimed.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; 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. Sufficient (live_output): The captured evidence ties the package-settlement owner to an integrity-verified 2026.9.7 helper on Node 24.19.0, observes the exact replacement refusal, then records preserved bytes and successful next preparation after candidate repair. Its source-tree identity matches this head. Existing-journal compatibility is covered; raw linked logs were proxy-blocked, and no full Gateway update is claimed.

Label justifications:

  • P0: The linked official-installation reports show ordinary updates and supported repair blocked, with recovery requiring a technical installation hop.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; 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. Sufficient (live_output): The captured evidence ties the package-settlement owner to an integrity-verified 2026.9.7 helper on Node 24.19.0, observes the exact replacement refusal, then records preserved bytes and successful next preparation after candidate repair. Its source-tree identity matches this head. Existing-journal compatibility is covered; raw linked logs were proxy-blocked, and no full Gateway update is claimed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured evidence ties the package-settlement owner to an integrity-verified 2026.9.7 helper on Node 24.19.0, observes the exact replacement refusal, then records preserved bytes and successful next preparation after candidate repair. Its source-tree identity matches this head. Existing-journal compatibility is covered; raw linked logs were proxy-blocked, and no full Gateway update is claimed.

Evidence

What I checked:

  • Pinned introduction: Reviewed the merge-base-to-head delta across all eight introduced paths. The checkout and original PR head are c7967e1; its recorded parent is 9c66d4c. Current-base drift was not attributed to this PR. (c7967e13d84e)
  • Current ownership before settlement: Repair captures the existing replacement database, acquires a fresh executor fence, admits journal recovery under that fence, and checks the installation identity before invoking archival custody. The executor refuses acquisition when another live updater owns the installation. (src/infra/package-update-activation.ts:185, c7967e13d84e)
  • Final-effect fencing: The archival owner rechecks current executor authority, journal revision, installation identity, and transfer identities around renames and directory synchronization. Completion requires the retained anchor and helper identities; it does not grant execution authority. (src/infra/package-update-activation-custody.ts:202, c7967e13d84e)
  • Existing journal compatibility: The persisted intent gains a settlement reason without changing SQLite tables or the original descriptor. Journal reuse relaxes obsolete database identities only for a verified completed identity-change settlement, while retaining the database-path, custody, revision, and live-authority checks. (src/infra/package-update-activation-journal.ts:317, c7967e13d84e)
  • Meaningful regression coverage: The public repair test exercises replacement of the lease database, preservation of package and launcher identities and helper bytes, completed receipts, next preparation, matching-identity refusal, and rejection while another executor owns the replacement database. Existing interrupted-archive and installation-change cases remain. (src/cli/update-cli/update-repair-package-activation.test.ts:127, c7967e13d84e)
  • Published-driver boundary proof: The captured PR body records the integrity-verified [email protected] recovery helper on Node 24.19.0: matching-lease status exited 0, replacement produced the exact refusal, candidate repair settled recovery, preserved 66,233,478 helper bytes, and admitted the next preparation. The reported source tree 648982a845f6bdf54696ba0bb0d5f332c8162e32 matches HEAD's tree. Environment: https://github.com/openclaw/openclaw/actions/runs/37191820918. This proves isolated recovery and next admission, without claiming a full Gateway update. (c7967e13d84e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit a0a1f18 into main Oct 4, 2026
201 of 202 checks passed
@steipete
steipete deleted the upd/upd-recovery-pending-lease-identity-changed branch October 4, 2026 09:46
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…aw#164849)

Explicit repair closes obsolete package activation as recovery-lease-identity-changed under fresh executor ownership, retaining artifacts and preserving matching-identity and live-owner refusals. Completed receipts permit the next package preparation against the current database.
RomneyDa pushed a commit that referenced this pull request Oct 6, 2026
Explicit repair closes obsolete package activation as recovery-lease-identity-changed under fresh executor ownership, retaining artifacts and preserving matching-identity and live-owner refusals. Completed receipts permit the next package preparation against the current database.

(cherry picked from commit a0a1f18)
steipete added a commit that referenced this pull request Oct 9, 2026
…eanup (#167564)

Adds recovery regressions for the three ways OS temp cleanup removes the managed-update handoff lease database (missing file, recreated parent directory, replacement inode), as reported in #167506 and #167557: recovery settles and admits the next package preparation. Main already settles these via #165238 and #164849; 2026.9.9 does not include them. Refs #167506 #167557.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…eanup (openclaw#167564)

Adds recovery regressions for the three ways OS temp cleanup removes the managed-update handoff lease database (missing file, recreated parent directory, replacement inode), as reported in openclaw#167506 and openclaw#167557: recovery settles and admits the next package preparation. Main already settles these via openclaw#165238 and openclaw#164849; 2026.9.9 does not include them. Refs openclaw#167506 openclaw#167557.
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 P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

Update failure: requested (2026.9.7) Update failure: managed-service-update-handoff (2026.9.7)

1 participant