Repository navigation
fix(update): let repair settle a publication whose live package already serves the candidate - #165607
Conversation
|
🦞👀 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: blocked before merge. Reviewed October 5, 2026, 11:22 AM ET / 15:22 UTC (Revision 2). ClawSweeper reviewWhat this changesAdds guarded repair settlement for interrupted package publication, preserves recovery artifacts, records a replayable completion receipt, and updates recovery documentation and test fixtures. Merge readiness⛔ Blocked before merge - 3 items remain This remains a useful fix for an unresolved update-recovery dead end. No concrete introduced bug was established, but the earlier published-driver compatibility requirement remains unmet. Priority: P1 Review scores
Verification
How this fits togetherPackage activation publishes an installed OpenClaw update and retains evidence for recovery. Repair uses that evidence and exclusive update ownership to decide whether recovery can finish and another update may proceed. flowchart TD
A[Interrupted package publication] --> B[Update repair]
C[Installed package and recovery journal] --> B
B --> D[Verify contents and exclusive ownership]
D --> E[Refuse unsafe settlement]
D --> F[Archive recovery artifacts]
F --> G[Record completed receipt]
G --> H[Allow next update]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +357, Tests +426, Docs +19, Other +2. Total +804 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep settlement in the existing recovery owner and establish published-driver compatibility before landing the new durable receipt contract. Do we have a high-confidence way to reproduce the issue? Yes, from source: mutate and restore an inventoried file while publication remains publishing, then attempt repair, retirement, and another update. The reporter and focused fixture support this path; this review did not execute it. Is this the best way to solve the issue? Yes in direction: guarded settlement through the existing custody owner is narrower than replacing the sealed helper or deleting recovery artifacts. Upgrade safety remains unproven for an operation created by the published driver. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4e011b13e48a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…dy serves the candidate (openclaw#165607) Closes openclaw#164214 Refs openclaw#164422 Reported by @NovaeonStudio.
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]>
…es the candidate (#183479) A 2026.9.33 to 2026.9.34 update or repair that found a package activation journal at publication-complete, with the live package already serving the recorded candidate and the executor lease intact, refused with "Package publication recovery is pending". settlePendingPackageActivation only settled a prepared operation for an installed candidate, so automatic admission and openclaw update repair both dead-ended. Extend the existing external-publication settlement to publication-complete: the publication owner verifies the closure and evidence through its retire preflight, the original executor authority is still acquired, and the operation is retired without republishing files. Dry-run admission accepts the same verified state. Publishing and other incomplete phases stay blocked. Minimal 2026.9.x port of the publication-complete settlement that main carries in 3ed1e21 (#167302), fb84dd5 (#165607), and 0679b18 (#181307); main's separate settlement verifier and custody modules are not ported.
What Problem This Solves
Adds a guarded settlement path for native package updates remaining blocked at
publishingafter an operator's external write changes sealed package evidence, even when the installed candidate's packaged contents are healthy. Restoring file contents cannot restore the original filesystem fingerprint, so the old helper refuses both repair and retirement.Closes #164214. Related: #164422. Thanks @NovaeonStudio for the report and preserved incident evidence.
User Impact
openclaw update repaircan close the stranded operation aspublication-settled-external-changeand admit the next update. It preserves the installed package, launchers, previous package, and sealed helper. Ordinary extra dist files appear in the warning and run ledger. Extra uninventoriedpackage.jsonscopes underdist/refuse settlement and keep recovery armed; expected dependency manifests undernode_modules/are ignored. Failed inventoried content, invalid root manifest fields or targets, the wrong candidate version, a changed helper, or a live executor also refuse settlement.The reporter's npm layout is supported: root
package.json,openclaw.mjs, a bin symlink, dist inventories, ordinary top-level README/license files, dependency manifests, and an operator's extra dist backup. Manifest entry targets outside dist must exist and resolve within the package; their content is not verified in this settlement path. Targets within dist remain inventory-verified.Use a CLI containing this fix. Modified inventoried files must first be restored to their packaged contents; the original sealed helper retains its original checks.
Why This Change Was Made
The activation/custody owner verifies the installed build-info's exact candidate version and both installed inventories through the existing dist-inventory contract. It retains launcher checks, the sealed helper digest, exclusive executor ownership, observation rechecks through archival, and launcher-directory durability before disarming recovery. The inventory reader loads only when settlement runs, preserving the native wrapper's startup dependency boundary.
The P1 correction addresses Node's nearest-manifest semantics: an extra
dist/package.jsonwithtype: commonjscan break inventoried ESM without changing its bytes. Rootpackage.jsonis not byte-inventoried today, so settlement requires parsed fieldsname: openclaw, the exact candidate version, andtype: module; everymain,exports, andbintarget must resolve to a file in the package, with content-inventory membership required for dist targets. Outside-dist targets such as the stock launcher are checked for resolution, not content; the receipt states that distinction. The warning and ledger receipt explicitly say field-verified, not content-verified. The same existing inventory collectors/comparator verify content, and the helper/executor/artifact guarantees remain intact.Named follow-up: extend the sealed inventory to the top-level launcher and root manifest for NEW operations. This changes the publication contract and belongs in a separate PR; it is not a new prerequisite imposed on existing operation seals here.
Interrupted archival and completed receipts survive lease-database loss or replacement. The ledger owner records an atomic completed receipt keyed by the operation ID, so interrupted reporting can replay without overwriting the original failed update. Warnings report current inventory differences and extra paths; the old whole-tree digest cannot reconstruct historical per-file metadata changes.
No CLI flags, config options, dependencies, SQLite tables, or schema versions change.
Evidence
c4bec41b601781e5884c862dbd657f88e88c4a1bbecause the previous guard required the root bin launcher to be inventoried. With the correction, the reporter's layout is proven settleable through the public repair boundary: root field-verified manifest, rootopenclaw.mjs, an npm bin symlink, dist inventories, README/license files, three ordinary/scoped/nested dependency manifests, and the operator'sdist/index.js.bak. Recovery is disarmed only after verification, artifacts and the working launcher remain, the warning/ledger name the backup, and the next update can prepare. This is an isolated synthetic npm-layout fixture, not a claim of running on the reporter's machine.node scripts/run-vitest.mjs src/cli/update-cli/update-repair-package-activation.test.ts --maxWorkers=1passed 40/40 three times. Vitest wall 49.25 / 32.06 / 42.29s; wrapper wall 54.45 / 34.97 / 45.54s. The reporter-layout case took 1.085 / 0.981 / 1.017s. Negative cases include extradist/package.jsonanddist/nested/package.json, root type/name/version/parse failures, missing or dangling entry targets, failed content inventory, changed helper, and live executor. The suite uses actual package publication/custody and isolated ledger fixtures to prove recovery remains armed on refusal; no deadlines or assertions were weakened. Hosted CI timing for this head is not yet available.node scripts/run-vitest.mjs test/scripts/eager-import-closure.test.ts test/scripts/pr-wrapper-source-closure.test.ts --maxWorkers=1passed 20/20, Vitest wall 33.87s, wrapper 36.25s. No new production module or wrapper-inventory entry was needed.node scripts/check-changed.mjs --base c4bec41b601781e5884c862dbd657f88e88c4a1b --timedpassed, exit 0 / 486.11s wall, including formatting, core types, all 27 test type graphs, lint, all three unused-export scans (zero findings), schema and architecture guards.git diff --checkpassed. All current proof ran locally with isolatedOPENCLAW_STATE_DIR; no remote lease or operator Gateway was used.dist/package.json,dist/nested/package.json) and the root version/type regressions failed on the previous owner because repair incorrectly resolved. Native Node loaded the synthetic inventoried ESM before the extra manifest (exit 0), then failed parsing it as CommonJS afterward (exit 1).package-dist-importsscanner inspected 10,834 files / 70,764 relative edges, finding 0 CommonJS require edges and no extensionless CommonJS edge. Built ESM references use exact paths; the CommonJS extension resolver considers the exact path,.js,.json, and.node(not.mjs). No separate alternate-extension shadow guard was added because this inventory audit identified no applicable extensionless import. This static audit does not claim coverage of arbitrary computed plugin paths.dist/index.jsduring publication, retaindist/index.js.bak, and observe repair/retirement refusal with status stillpublishing. The healthy settlement regression failed before the fix. Before the P1 correction, the corpus had 31/31 settlement regressions passed, including content mismatch, inventoried symlink, live executor, helper/version mismatch, failed directory sync, interrupted archival/reporting, lease loss, retained artifacts, and next-update preparation.node scripts/run-vitest.mjs src/cli/update-cli/update-repair-package-activation.test.ts --maxWorkers=1: Vitest wall 96.50 / 59.59 / 101.26s, wrapper 107.73 / 70.02 / 112.91s. The other three touched Gateway/Git-service suites passed 32/32 three times. That prior-head corpus also passed all 121 service integration cases. Hosted CI timing is not yet available.eager-import-closure.test.ts,pr-wrapper-source-closure.test.ts) and staged recovery-runtime checks passed 22/22. The new module and eager contract dependencies are included inscripts/pr-lib/wrapper-components.txt. Fullnode scripts/check-changed.mjs --base c3b2b7d3fc1a053d2f6907e55e1629c16fc53706 --timedpassed every step: core types, all 27 test type graphs, lint, three unused-export scans with zero findings, and architecture guards. One stale max-lines baseline entry was removed; shrink only.update-repair-agent.e2e.test.tsturn/validating (70.408s) and turn/verifying (70.268s) exhausted the turn budget before tool execution. Each performed 94 live-authority checks, consuming 60.216 / 60.215s in requester/ledger snapshot work; fence checks took under 73ms. The test and measured cost owners are byte-identical to main6ddf5a6106c18c4cf803a601b3a099e497d943fb. This is source attribution, not a separate baseline execution. Fresh nested authority reads are an explicit contract, so this needs a separate owner-level performance fix; freshness checks, deadlines, and assertions remain intact.update-finalization-output.process.test.tsonce on that clean detached main, then restored the branch: 18 passed, 2 failed.doctor-hangpassed 8.013s;doctor-progressfailed 9.332s (3342ms phase versus the under-3000ms assertion);borrowed-phasefailed 7.623s. The final branch corpus passed all 20 cases, including those three in 5.092 / 5.066 / 4.967s. That passing sample is not a claimed fixture fix. Deterministic child-custody readiness remains the named follow-up.Current correction numstat: production +27/-10; tests +30/-9; docs +9/-7 (+66/-26 total). Full PR against the integrated base: production +397/-40; tests/support +485/-59; docs +21/-2; wrapper inventory +3/-0; baseline +0/-1.