Repository navigation
fix(update): repair refuses forever when plugin files, config or snapshots changed after the update - #193645
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.
…cohort rollback Plugin cohort rollback still refused outright when a later writer had changed a published package payload, a config file the update wrote, or a plugin's source snapshot. Like the earlier obligation and install record cases, the refusal wrote nothing and left repair unable to settle. Rollback now keeps those later changes, restores everything that still matches, completes, and records them in the same update warning. Config path identity guards and corrupt publication chains still refuse.
|
🦞👀 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 changesThis PR lets update rollback preserve later plugin files, configuration edits, and source snapshots while restoring matching state and recording warnings. Example: An update changes gateway.port from 18789 to 1, then an independent writer changes it to 18791.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses recovery refusals still present on main, and the previously reported findings are resolved. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherUpdate repair passes the recorded plugin cohort and current recovery authority to settlement, which restores matching config and installed-index state and reports preserved changes through update history. flowchart TD
A[Update repair] --> B[Cohort settlement]
C[Recovery journal] --> B
B --> D[Config owner]
B --> E[Installed index owner]
B --> F[Artifact retention owner]
B --> G[Update history warnings]
Technical reviewBest possible solution: Use the existing recovery owners to preserve later changes with durable warnings while retaining path-identity, validation, and journal-integrity refusals. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically refuses later artifact, config, and snapshot changes; the PR supplies failing-before and passing-after owner-test results, which were inspected but not rerun during this read-only review. Is this the best way to solve the issue? The patch extends the established best-effort settlement policy through existing config, index, and retention owners, with focused regressions for distinct failure boundaries and no unnecessary parallel recovery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ee00ba6be092. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +124, Tests +325, Docs +1, Other +9. Total +459 across 11 files. Added test files: 2. 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. Review metrics
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 (4 earlier review cycles)
Reviewed November 5, 2026, 5:46 PM ET / 22:46 UTC (Revision 5). |
Rollback settlement now completes when repair keeps a rollback selected, so the merged settlement cases assert the kept decision and its warning.
…ack' into fix/update-cohort-besteffort-artifacts-config
…onflict A later config edit no longer stops rollback, so the settlement test that reached a partial rollback through a config conflict now interrupts the config restore directly, and a separate case covers keeping the edit.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…ion to added lines
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
… later snapshot When a later writer refreshed one plugin's snapshot, settlement kept that installation's record but left its other plugins' snapshot restorations queued. The index owner then rejected them because they no longer matched the kept record. A kept installation now drops all of its plugins' restorations. The installation-owner tests move to a sibling file with shared fixture helpers, keeping the cohort recovery test file under its line cap.
…teffort-artifacts-config
…ion to added lines
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…shots changed after the update (openclaw#193645) * 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 later plugin payloads, config and snapshots during cohort rollback Plugin cohort rollback still refused outright when a later writer had changed a published package payload, a config file the update wrote, or a plugin's source snapshot. Like the earlier obligation and install record cases, the refusal wrote nothing and left repair unable to settle. Rollback now keeps those later changes, restores everything that still matches, completes, and records them in the same update warning. Config path identity guards and corrupt publication chains still refuse. * test(update): exercise partial rollback by interruption, not config conflict A later config edit no longer stops rollback, so the settlement test that reached a partial rollback through a config conflict now interrupts the config restore directly, and a separate case covers keeping the edit. * 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 * fix(update): keep cohort rollback pending for invalid config A config file that no longer validates is not a later edit to keep. Its restore now refuses with its own error, so repair stays pending as the docs describe, while ordinary later edits are still kept. * fix(update): refuse a malformed included config before treating it as a later edit An included file edited into malformed JSON5 has no include provenance, so the ownership check classified it as a later edit and settlement kept it. Check validity first and refuse with the same invalid-config error, so repair stays pending. * test(update): match best-effort artifact and config test-line allocation to added lines * fix(update): keep every plugin snapshot of an installation kept for a later snapshot When a later writer refreshed one plugin's snapshot, settlement kept that installation's record but left its other plugins' snapshot restorations queued. The index owner then rejected them because they no longer matched the kept record. A kept installation now drops all of its plugins' restorations. The installation-owner tests move to a sibling file with shared fixture helpers, keeping the cohort recovery test file under its line cap. * test(update): match best-effort artifact and config test-line allocation to added lines
Related: #193632, #193132
#193632 has landed (
351af32a) and is merged into this branch, so the diff now contains only this PR's changes.What Problem This Solves
Fixes:
openclaw update repairstill fails on every attempt when a plugin's package files, a config file the update wrote, or a plugin's source snapshot changed after the update.User Impact
User impact: repair finishes the plugin rollback in these cases too. It keeps the newer files or snapshot, restores everything that still matches, and lists what it kept in the same update warning that repair,
openclaw doctorand the update report show.Why This Change Was Made
#193632 made rollback keep a later plugin migration obligation or install record instead of refusing. Three related checks still refused, and like the earlier ones they wrote nothing before refusing:
artifactUnchangedreplaces the throwingassertArtifact. A payload that a later writer replaced, or an originally absent one that now exists, keeps that plugin's current index entry. So does a missing retained or published artifact entry. Retention markers for those payloads are left alone. The begin-time check still throws, because that path is not a rollback.restorePluginCohortConfigPublicationnow returns false when a later writer changed what the publication wrote. Before, its own conflict check threw "Configuration changed after update publication". Settlement keeps that file and moves on.listLaterPluginSourceSnapshotChangesuses the same comparison as the restore.These still refuse on purpose:
Evidence
Red on #193632's head
53d4e682e068, with real install-index files and SQLite:src/plugins/update-cohort-recovery.test.ts: three cases fail.src/infra/update-plugin-cohort-recovery.test.ts: the config tests fail on the new restored/kept return value. In the same test, a later edit to the publication's own leaf used to throw "Configuration changed after update publication".Green on this head:
node scripts/test-projects.mtsacross those two files, 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 and plugins-platform test shards shows only the existingpackages/aierror. The test-line allocation matches the 325 lines this PR adds against current main.After merging #193632's current head, which includes #193132, one repair settlement test needed a new route. It used to reach a half-finished rollback through a config conflict, and a later config edit no longer stops rollback. The test now interrupts the config restore once, after the migration rows were restored, and checks that the verified candidate still finishes the rollback. Disabling the "already restored" check makes it fail. A separate case checks that rollback keeps a later config edit and names the file in the warning.
src/cli/update-cli/update-plugin-cohort-settlement.test.tspasses 12/12, and the related suites pass with 139 tests.Review follow-up:
listLaterPluginSourceSnapshotChangesnow returns the later snapshot changes themselves, and they are matched to install-record keys by recorded installation owner. A laterdemosnapshot under thepackage-ownerinstallation used to let that record roll back to its original. Now the record is kept along with the snapshot. The test covers a later record and a later snapshot in thedemo/package-ownershape, with intact payloads so only the later state can stop the restore. It was red before the fix and is green after (19/19).warning:plugin-cohort:later-changes-keptstep before settlement counts it. Every later write merges with the items already recorded instead of replacing them. If the run's history was pruned, settlement still completes. New test: a config edit is kept, then settlement is interrupted after counting the file. Before the fix the next repair reported no warning; now it reports the config file. The helpers moved tosrc/plugins/update-cohort-kept-changes.ts, which keeps the cohort owner under the line limit.tsrs(apart from the existingpackages/aierror) are clean. Autoreview at P2 is clean after the invalid-config fix.Second review follow-up:
src/infra/update-plugin-cohort-recovery.test.tswith a realgateway.json5include: red ("resolved false") before the fix, green after.settledPublications. A probe interrupted settlement after all three publications were counted, and the resumed repair still reported the kept install record or package files. Config is different because a counted config file is never revisited.tsrs(apart from the existingpackages/aierror) are clean.Third review follow-up:
pack/aandpack/b, under one install owner. When a later writer refreshed onlypack/a's snapshot, settlement kept the installation's record but leftpack/bqueued for its old snapshot. The installed-index owner then rejected that with "Plugin pack/b source snapshot restoration no longer matches its install record". A kept installation now drops every snapshot restoration it owns. New test with a real two-entry npm package: red with that error before the fix, green after. The installation-owner tests moved tosrc/plugins/update-cohort-recovery.owner.test.ts, with shared fixtures inupdate-cohort-recovery.test-support.ts, to keep the main test file under its line cap.update-cli.already-currentCI failure. "ends unfinished retention at --timeout with the installed package untouched" fails the same way on currentmain(071ea8338d93), 3 of 3 local runs, as on this branch, 3 of 3. It isn't caused by this PR.tsrs(apart from the existingpackages/aierror) are clean. Autoreview at P2 is clean.