Repository navigation
fix(update): repair refuses forever when a plugin changed after the update - #193632
fuller-stack-dev merged 6 commits into
Conversation
…lback A plugin cohort rollback refused outright when a later writer had changed a plugin migration obligation or install record after the update published it. The refusal wrote nothing, so the later value survived either way, but the cohort could never settle and `update repair` failed on every attempt. Rollback now keeps those later values, restores everything that still matches the update's publication, completes, and records what it kept as a warning on the update run, which repair prints and Doctor and status reports show.
|
🦞👀 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. What this changesPlugin rollback preserves later migration decisions and install records, restores matching entries, and records a warning. Example: Doctor completes discord's migration obligation after an update reopened it, and the update subsequently needs rollback.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This maintainer-authored PR fixes a recovery failure that remains on current main. Both prior findings are resolved, and no additional actionable defect was found. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe update recovery owner consumes recorded plugin publications under installation custody and restores migration rows, install records, and source snapshots before releasing recovery admission. flowchart TD
A[Update repair] --> B[Installation custody]
B --> C[Plugin cohort settlement]
C --> D[Migration obligation owner]
C --> E[Installed plugin index]
D --> F[Preserve later changes]
E --> F
F --> G[Clear cohort and record warning]
Technical reviewBest possible solution: Complete this focused preservation fix through the existing cohort owner, leaving other conflict types to the explicitly stacked follow-up. Do we have a high-confidence way to reproduce the issue? Current-main conflict checks establish the failing path, and supplied real-SQLite regressions report the intended base failure and corrected outcome; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch makes the smallest coherent change in existing restoration owners: preserve later values, restore matching entries, retain associated snapshots, and report the result without adding another recovery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ec702e833882. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +47, Tests +260, Docs +3, Other +7. Total +317 across 10 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed November 5, 2026, 3:30 PM ET / 20:30 UTC (Revision 3). |
Rollback settlement now completes when repair keeps a rollback selected, so the merged settlement cases assert the kept decision and its warning.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Install records are keyed by installation owner while source snapshots are keyed by plugin ID, so keeping a later `package-owner` record left `demo`'s snapshot restoration queued and the index owner rejected it. Kept installations now drop every snapshot they own. Also prove that cohort rows stored by released updaters settle unchanged, and describe the kept-change outcome in the npm plugin rollback docs.
…n kept config Merges openclaw#193632's review fixes, then applies the same installation-owner mapping to later source snapshots: a later `demo` snapshot now keeps its `package-owner` record instead of letting it roll back. Kept config files are written to the run warning before settlement counts them, and later writes merge into that warning, so a resumed repair still reports them. The kept-change warning helpers move to their own module, and the rollback docs cover package files, snapshots and config.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…pdate (openclaw#193632) * fix(update): keep later plugin changes instead of refusing cohort rollback A plugin cohort rollback refused outright when a later writer had changed a plugin migration obligation or install record after the update published it. The refusal wrote nothing, so the later value survived either way, but the cohort could never settle and `update repair` failed on every attempt. Rollback now keeps those later values, restores everything that still matches the update's publication, completes, and records what it kept as a warning on the update run, which repair prints and Doctor and status reports show. * fix(update): keep an installation's snapshots with its later record Install records are keyed by installation owner while source snapshots are keyed by plugin ID, so keeping a later `package-owner` record left `demo`'s snapshot restoration queued and the index owner rejected it. Kept installations now drop every snapshot they own. Also prove that cohort rows stored by released updaters settle unchanged, and describe the kept-change outcome in the npm plugin rollback docs. * test(update): match best-effort rollback test-line allocation to added lines
…pdate (openclaw#193632) * fix(update): keep later plugin changes instead of refusing cohort rollback A plugin cohort rollback refused outright when a later writer had changed a plugin migration obligation or install record after the update published it. The refusal wrote nothing, so the later value survived either way, but the cohort could never settle and `update repair` failed on every attempt. Rollback now keeps those later values, restores everything that still matches the update's publication, completes, and records what it kept as a warning on the update run, which repair prints and Doctor and status reports show. * fix(update): keep an installation's snapshots with its later record Install records are keyed by installation owner while source snapshots are keyed by plugin ID, so keeping a later `package-owner` record left `demo`'s snapshot restoration queued and the index owner rejected it. Kept installations now drop every snapshot they own. Also prove that cohort rows stored by released updaters settle unchanged, and describe the kept-change outcome in the npm plugin rollback docs. * test(update): match best-effort rollback test-line allocation to added lines
Related: #193132
What Problem This Solves
Fixes:
openclaw update repairfails on every attempt when a plugin's data/settings obligation or install record changed after an update published it.User Impact
User impact: repair now finishes the plugin rollback instead of refusing forever. It keeps the newer change, restores everything else, and reports what it kept as a warning. The warning shows in repair output, in
openclaw doctorunder update history, and in the update report.Why This Change Was Made
When rollback found a plugin migration obligation or install record that matched neither the update's original value nor what the update wrote, it threw. That throw happened before anything was written, so the newer value survived either way. The only effect was that the cohort could never settle. Repair, Doctor and triage then kept pointing at each other, and the cohort pinned capture and rollback artifacts indefinitely.
Rollback now keeps that newer value, skips it, restores every item that still matches, and completes.
restorePluginCohortMigrationRowsInDatabasereturns the plugins it kept.settleUpdatePluginCohortcollects those along with any install records it kept, and writes onewarning:plugin-cohort:later-changes-keptstep on the update run. Doctor and the run report already show completed warning steps. A kept install record also keeps its source snapshot, so the record and snapshot can't disagree.One related refusal goes the same way. If the obligation table itself is gone, because the database was restored from a backup older than it, rollback no longer refuses. It now leaves that state alone instead of initializing the candidate schema, and reports the original obligations as kept.
The settlement result shape is unchanged, so the worker callers' strict result parsing still holds. Commit does not restore anything and is unaffected. The live updater rollback still rechecks the database before it restores the previous package. Repair's ordering doesn't need to change: once rollback can't refuse, repair no longer gets stuck settling the cohort before package recovery runs.
Three refusals are left for a follow-up: published artifacts that changed, config files edited after publication, and a source snapshot that changed while its install record did not. Corrupt publication chains still refuse, because that is a journal integrity failure rather than a later writer.
Evidence
Red on base
480d50305383, using real SQLite and the real install index:src/infra/update-plugin-cohort-recovery.test.ts: the later-Doctor-decision case, in both baseline variants, fails with "Plugin migration obligation changed after update publication". The older-backup case fails with "Plugin migration recovery is missing its original obligations". The two other older-database cases fail only on the new return value.src/plugins/update-cohort-recovery.test.ts: the new later-install-record case fails with "Plugin fixture changed after the update; cohort recovery preserved it."Green on head:
node scripts/test-projects.mtsacross the two files above, plussrc/plugins/update-cohort.test.ts,src/cli/update-cli/update-repair-command.test.ts,src/cli/update-cli/update-repair-handoff.test.ts,src/cli/update-cli/update-command-plugin-cohort-handoff.test.ts,src/infra/update-plugin-cohort-commit.process.test.tsandsrc/cli/update-cli/update-command-database-rollback.test.ts: 127 passed.Format check passes,
lint:corehas no findings in the touched files, and the import cycle check is clean. Locally,tsrson core and the infra, plugins-platform and cli-update test shards shows only the existingpackages/aierror that base also has. The test-line allocation matches the 260 lines this branch adds against current main.After #193132 merged, I merged main into this branch. Repair's forward settlement and best-effort rollback now share
settleUpdatePluginCohort, and rollback uses the action that settlement resolved. The repair settlement tests insrc/cli/update-cli/update-plugin-cohort-settlement.test.tsthat used to expect a refusal ("keeps rollback selected") now check that rollback completes, the later decision is kept, and the kept-change warning is recorded. The forward cases check that no warning is recorded, so the two paths stay distinguishable. All 11 cases pass. The related suites, including the cohort and repair tests above, pass with 138 tests.Review follow-up:
package-ownerrecord used to leave thedemoplugin's snapshot restoration queued. The installed-index owner then rejected it ("Plugin demo source snapshot changed after the update"). A kept installation now drops every snapshot restoration whose recorded install owner is that key. It falls back to the plugin ID only when no owner is recorded. New test insrc/plugins/update-cohort-recovery.test.ts, using thedemo/package-ownershape: red with that error before the fix, green after (18/18).src/cli/update-cli/update-plugin-cohort-settlement.test.tswrites the update recovery and plugin cohort rows into real SQLite exactly as shipped updaters and the refused repair stored them on the affected install: dispositionrollback, revision 2,settledPublications: 0, and oneplugin-migrationspublication for discord and whatsapp. Only paths and the run identity differ. It then repairs with this branch's code. The rows load without migration, rollback completes, both later obligations stay as they are, recovery admission clears, and the warning names both plugins. Run against current main's source, the same stored rows load and then refuse with "Plugin migration obligation changed after update publication: discord". This PR adds no stored field, so released rows keep the same shape.docs/install/updating.mdnow describes the new outcome in the npm plugin rollback section. Later install-record and obligation changes are kept, rollback completes, and an update warning names them. Settings and artifacts still leave recovery unfinished in this PR; fix(update): repair refuses forever when plugin files, config or snapshots changed after the update #193645 covers those.tsrs(apart from the existingpackages/aierror) are clean. Autoreview at P2 is clean.