Repository navigation
fix(update): let repair settle a pending recovery whose lease database identity changed - #164849
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 5:32 AM ET / 09:32 UTC. ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherPackage 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +29, Tests +19, Docs +11. Total +59 across 8 files. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…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.
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)
…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.
…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.
What Problem This Solves
Fixes
openclaw update repairrefusing an orphaned package recovery withmanaged handoff lease database identity changed, leaving every subsequent update blocked byupdate-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
updateRepairCommand.pnpm test src/cli/update-cli/update-repair-package-activation.test.ts --maxWorkers=1passed three times on Blacksmith Testboxtbx_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.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 9c66d4c9a39b16d70e7c55186fe7e8550468a663passed, 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.Remote regression and gate environment.
Published-driver compatibility was exercised with the actual
package-update-activation-recovery.mjsfrom 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 Testboxtbx_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 nativeBuffer.equalspreserved 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.