Repository navigation
fix(update): a plugin step that throws after a core update rolls the whole update back - #200507
fuller-stack-dev merged 8 commits into
Conversation
…ould keep its result After a core update, plugin convergence that throws before publishing any record or config, or an updater failure around a started post-plugin Doctor, no longer rolls the package back. The update keeps its result, records the step as owed with its reason, exits 0, and the next update or repair retries it. Config refusals, Doctor refusals, unsettled package state, lost authority and Gateway readiness still fail the update.
…he previous plugin set Review follow-up. Plugin convergence is owed only when a plugin cohort deferred every package and record change, the pass carries no channel config that only this update can restore, and publication has not started. Already-current updates and repair commit installs plugin by plugin, so they keep failing as before. A plugin phase that ends in error owes nothing.
…ealthy cohort Review follow-up. Adds rows for a refused config write, a revoked requester and an unsettled child, makes the no-cohort row replace a package for real, and corrects the docs on what the first update from an older updater does.
|
🦞👀 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. What this changesThe PR preserves successful core updates after safely recoverable plugin failures and records the unfinished work for later retry. Example: Plugin convergence throws “plugin registry exploded” before publication during a cohort-backed core update.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this maintainer-authored repair addresses a current update failure, but its retry accounting can clear unfinished plugin work. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe CLI updater coordinates core installation, plugin transactions, Doctor, Gateway verification, and maintenance; plugin outcomes feed the existing update ledger and status commands. flowchart TD
A[Update command] --> B[Core installation]
B --> C[Plugin convergence]
C --> D[Doctor and config validation]
D --> E[Gateway verification]
E --> F[Owed step ledger]
F --> G[Status and later repair]
Technical reviewBest possible solution: Retain the existing cohort and ledger owners, but preserve owed convergence when config publication is deferred. Do we have a high-confidence way to reproduce the issue? Current-main exception paths establish the rollback behavior, and the PR supplies failing-base and passing-branch harness results; no target code was executed during this read-only review. Is this the best way to solve the issue? The cohort rollback and existing owed-step ledger are appropriate boundaries, but a warning alone cannot establish successful plugin publication. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4c61c20fb1a7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +152, Tests +331, Docs +50. Total +533 across 16 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. 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 Reviewed November 17, 2026, 3:56 AM ET / 08:56 UTC. |
|
Merged via squash auto-merge.
|
…whole update back (openclaw#200507) * fix(update): a plugin convergence failure rolls back an update that could keep its result After a core update, plugin convergence that throws before publishing any record or config, or an updater failure around a started post-plugin Doctor, no longer rolls the package back. The update keeps its result, records the step as owed with its reason, exits 0, and the next update or repair retries it. Config refusals, Doctor refusals, unsettled package state, lost authority and Gateway readiness still fail the update. * fix(update): owe plugin convergence only when its rollback restores the previous plugin set Review follow-up. Plugin convergence is owed only when a plugin cohort deferred every package and record change, the pass carries no channel config that only this update can restore, and publication has not started. Already-current updates and repair commit installs plugin by plugin, so they keep failing as before. A plugin phase that ends in error owes nothing. * test(update): prove blocking convergence failures still fail with a healthy cohort Review follow-up. Adds rows for a refused config write, a revoked requester and an unsettled child, makes the no-cohort row replace a package for real, and corrects the docs on what the first update from an older updater does. * docs(update): say the owed Doctor pass starts after plugin convergence * fix(update): a plugin phase deferred by a config conflict settles no owed plugin step * docs(update): a config-conflict deferral settles no owed plugin step
…is never retried after an update (#200331) * fix(update): a failed shell completion or service definition refresh is never retried after an update * fix(update): keep a step owed when the update that took it over fails A run that still owes a step now records its own row and leaves the earlier run's row unchanged. The newest run that kept its result decides, so the earlier run owes the step again if the later run fails or rolls back. Before, the later run settled the earlier row when it took the step over, and a failure after that dropped the step without a record. The retry pass and `update status` group and match owed steps by key instead of comparing update run ids. * fix(update): report owed steps without changing the finalization status * test(update): keep deliberately owed completion steps out of the shared ledger (cherry picked from commit 89924a8) Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 10f65fb6bddfad042a845bbe88fdb26cd3e91b5f)
…whole update back (#200507) * fix(update): a plugin convergence failure rolls back an update that could keep its result After a core update, plugin convergence that throws before publishing any record or config, or an updater failure around a started post-plugin Doctor, no longer rolls the package back. The update keeps its result, records the step as owed with its reason, exits 0, and the next update or repair retries it. Config refusals, Doctor refusals, unsettled package state, lost authority and Gateway readiness still fail the update. * fix(update): owe plugin convergence only when its rollback restores the previous plugin set Review follow-up. Plugin convergence is owed only when a plugin cohort deferred every package and record change, the pass carries no channel config that only this update can restore, and publication has not started. Already-current updates and repair commit installs plugin by plugin, so they keep failing as before. A plugin phase that ends in error owes nothing. * test(update): prove blocking convergence failures still fail with a healthy cohort Review follow-up. Adds rows for a refused config write, a revoked requester and an unsettled child, makes the no-cohort row replace a package for real, and corrects the docs on what the first update from an older updater does. * docs(update): say the owed Doctor pass starts after plugin convergence * fix(update): a plugin phase deferred by a config conflict settles no owed plugin step * docs(update): a config-conflict deferral settles no owed plugin step (cherry picked from commit c48b829) Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit c7e8a882e3e1503b3091ef079730d881462c10e2)
`openclaw update repair` prepared uncertain-handoff recovery in the default per-user lease store, while package settlement then entered the lease store pinned by the package activation journal. When that journal pinned an existing historical store (such as the legacy /tmp/openclaw store) holding a stale uncertain triage lease, ordinary admission refused with "Another update executor owns this installation", so repair could never settle. Repair now reads the journal through the same reader settlement uses, runs its existing recovery checks against the pinned store, and reuses the admitted claim for settlement. Recovery checks and ordinary admission are unchanged; without a pinned store, repair behaves as before. Fixes #200508 Reported-by: @garrietv Co-authored-by: steipete <[email protected]> (cherry picked from commit ae31ea3) Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 8d8ace39e6d59c2017d197ac460dc4d489c95a84)
…pdate left behind (#200550) * fix(update): settle a killed package publication on the next update An update killed between publishing its journal and installing the new package left the next `openclaw update` and `openclaw update repair` refusing with "Package publication is incomplete" until someone ran the printed recovery command. Settlement now first brings such a publication to rest with the recovery that command runs, under a claim in the recorded lease store that proves the original updater gone, then closes the aborted or published operation through the existing settlement. It resumes only a journal this build's own helper was sealed for, never replaces an installed package, and never resumes under a caller-supplied claim. The update records what it settled as a package-publication-recovery warning step. Refusals that remain name their cause and a step that works: a lost lease store and a changed installation now name the reinstall that supersedes the operation. * fix(ci): expect readable package modes in the installed recovery lane Recovery keeps group/other read and execute access on retained package contents and clears only write access (#193272). The installed recovery lane still expected owner-only modes, so its first tree comparison failed on every entry. * test(update): keep the replaced launcher's inode distinct Unlinking a link and creating it again can reuse the freed inode on Linux, which leaves the launcher's recorded identity unchanged and the publication legitimately resumable. The control now keeps the old link under another name, so the new one always has a new identity. * docs(update): say what repair does with a publication under its own claim (cherry picked from commit 0ce9c77) Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 2dd257b6ce71507101c2563df56ff6662376ace0)
…s stop (#200569) During a Control UI update, the candidate Doctor admits its SQLite capture before stopping the supervised predecessor Gateway. The predecessor's graceful shutdown releases its gateway-owner lease in state/openclaw.sqlite, so the predecessor stop receipt then refused with "source changed after update capture". The whole update was reported as failed even though the new version served. Writes made between capture admission and the receipt owner's exclusive maintenance custody now follow the existing initial-staleness policy: one warning, Doctor continues from current state, and automatic restoration of the stale backup stays permanently disabled. Changes made under custody or after the receipt are still refused. Accepted edge case: a foreign write during the pre-custody stop interval also continues forward, with rollback disabled. Fixes #198072 Fixes #200022 Reported-by: @zzs12345-web, @damzaru, @Lifaguang Co-authored-by: steipete <[email protected]> (cherry picked from commit 3447bee) Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 79efce43c9d1b2e3e4ee0e0781d360238a89a293)
… be removed (#200579) Switching a Git checkout to a package install removes the `openclaw` wrapper the installer wrote for the checkout. When that removal failed and no Gateway restart had been verified (`--no-restart`, or no Gateway service), the update exited 1, rolled the package back and reported that recovery could not prove a runnable installation. With a verified restart the same failure was already a warning. The package install is now kept in both cases, with one warning that names the path. A wrapper owned by a system package still fails the update and rolls the package back, and an update that lost its authority still stops before it removes the wrapper. The warning is not an owed step. Update history has no field for the wrapper path, so no later command could prove the wrapper is gone. Update behavior: this step runs in the updater that started the update, so a switch started by an already installed version behaves as before. The change applies to switches started by a version that contains it. (cherry picked from commit 176f2ff) Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 32f16217a1c4935ed90d5910d56afe9b204ba39a)
…taged package (#200595) Candidate Doctor checked dependency targets imported by the private rehearsal copy of user-installed plugins only against that private copy. On Windows npm-global installs, the private host links resolve into the staged candidate package, so its own nested node_modules/typebox was rejected as "outside the temporary update copy" and every update rolled back. Dependency targets imported from the private copy may now resolve into the canonical staged candidate package as well. Plugin entries and repair writes stay private-only. Candidate-sourced references keep main's unchecked scope. Targets in the serving installation or user directories are still rejected. Fixes #200573 Reported-by: @desksk Co-authored-by: steipete <[email protected]> (cherry picked from commit dab086c) Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 4f2b2ed830c31eb7b6647bfbb3b3f197b52f62ec)
Related: #200331
What Problem This Solves
openclaw updateinstalls the new version, then updates plugins and runs Doctor for them. If the plugin step throws, or the updater fails around that Doctor run, the whole update is rolled back and the command exits 1, even though the new version would have run fine with the plugins it already had. While the cause persists, every later attempt fails the same way.User Impact
User impact: a core update now keeps its result when plugin convergence throws before it changed any plugin record or config, or when the updater fails around a Doctor run that had already started. The update exits 0, reports the step as owed with its reason, and
openclaw update statuskeeps showing it until a lateropenclaw updateoropenclaw update repaircompletes it.What does not change:
openclaw update repairstill fails that command with exit 1. Those paths install plugins one by one with nothing to restore them together, so the updater cannot show that the previous plugin set still stands. An owed plugin convergence step stays owed after such a failure.Why This Change Was Made
Two places turned every exception into a failed update.
Plugin convergence. During a core update the updater keeps the previous plugin set (a "plugin cohort") so it can restore it. When convergence throws, it already restores every package it replaced, and until now it then rethrew, which rolled the core back as well. It now returns a warning instead when all of these hold:
Post-plugin Doctor pass. A Doctor process that fails was already a warning. An exception around it was not. It is now owed when Doctor had started (the updated entrypoint was found and the Gateway was parked) and the error carries no Doctor failure facts. The config validation and readiness checks that follow still run and still block.
When the step counts. Plugin work runs before the restart. The owed row is written only in post-update maintenance, which the update reaches after the Gateway is verified on the new version (or, with
--no-restartand a stopped Gateway, at the point where the update reports success today). An update that fails or rolls back after the plugin step records nothing.Retries. The next
openclaw updateruns convergence again, including on an already-current core, and settles the step when it completes.openclaw update repairruns full Doctor and then convergence, so it settles both steps. An update settles the Doctor step only when it changes plugins and its own Doctor completes; an update that leaves plugins unchanged runs no full Doctor, so the step stays owed and the warning repeats. Gateway startup retries nothing.Owed or rollback, by path
--no-restartor a stopped Gatewayopenclaw update repair, standalone finalizefailedFirst update to a release with this change
The installed updater starts the update; the new version runs plugin convergence in its own process.
v*versions up to 2026.11.5-beta.4: no plugin cohort, runs the Doctor pass itself (since 2026.9.5)plugin-convergence; the installed updater keeps the update and records no owed stepA parent that receives a nonzero exit or a
failedresult from the child still rolls back. The hidden finalize child'sstatusvalues mean what they did; owed steps are reported beside it.Plugin state while a step is owed
With a cohort, every package replaced in the pass is put back by its package-directory transaction, and records and config were never published. A test replaces a managed plugin from 1.0.0 to 2.0.0 through the real package-directory owner, throws, and reads 1.0.0 back from disk with the seeded record and the config file unchanged. If the restore itself fails the update still fails. Without a cohort the same test shows 2.0.0 left under the 1.0.0 record, which is why that shape keeps failing.
Evidence
Before, on unmodified
main. Both failures were reproduced through the realopenclaw updatecommand with private state, a managed Git install, and a running Gateway:rolled-back,OpenClaw update rolled back to 1.0.0: post-update-failed., Gateway restarted on the previous runtime.rolled-backwith reasonpost-update-plugins(that case stays blocking). The regression test places it in a state read after Doctor ran, which also exits 1 onmain.After, on this branch. The same two cases end with exit 0, run
succeeded, one stop and one start with no rollback, and the owed step with its reason in the update's report, inopenclaw update status, and inopenclaw update status --json(owedSteps). A JSON package update shows the same through the advisory step and the ledger row.Retries. An already-current
openclaw updateandopenclaw update repairsettle an owed plugin convergence step when their convergence completes. Repair settles the Doctor step; an already-current update leaves it owed and repeats the warning. A core update whose plugin step throws again takes the step over with the new reason and leaves the earlier run's row as it was.A plugin phase that was deferred because config changed rolled its plugin work back, so it settles no owed plugin step. A second review found that such a phase marked an earlier owed plugin convergence as done; a new
update-command-owed.test.tscase failed on4bd8ddf5545(the step came back settled) and passes with the fix.Still failing, as before.
Red and green. With the production files swapped back to the base version, 12 of the new or changed cases fail: the two managed Git cases, both package update cases, the two already-current and two repair retry cases, the plugin state case, the Doctor pass case, and the two repair-phase cases (those two call a helper that does not exist on the base). All pass on this branch.
Not proven.
scripts/e2e/published-driver-update-docker.shexists but cannot inject a plugin convergence failure, so the first-update table above comes from reading the released code, not from running a released updater.main, and a rollback there does not restore it either.src/infra/update-repair-agent.e2e.test.tsandsrc/cli/update-cli/update-command-node-runtime.live.test.tsare outside the unit configurations and were not run.--no-restartand stopped-Gateway rows of the path table come from reading the finisher. The command-level tests cover a managed Git update with a restart, a JSON package update, an already-current update, and repair.Review. The autoreview helper does not run on this machine. A separate agent that had not seen the design reviewed the diff read-only, twice. The first pass found that convergence without a cohort and convergence carrying channel config were not safe to owe; both now keep failing. The second pass asked for the blocking rows and the docs corrections that the last commit adds. A third read of the production diff found the config-conflict case above; it is fixed in
f1459b6e426with its test and a docs sentence.Commands and counts
Latest head
5c001962f45(main merged in twice after the review fix, not rebased). On the first merge (0213ce932bc, main at6747b1ec5ae, which had changed Git release installs and package recovery reporting in the update CLI):pnpm tsgo:allpass; 11 files, 292 tests passed (update-cli.already-current,update-cli.finalizer,update-cli.git-service,update-cli.test,update-command-owed,update-command-plugins.persistence,update-command-post-update,update-command-verification,update-finalization-lifecycle, and the two script tests); session-identity ratchet pass;check-changed(dead code skipped) pass. The second merge brought in a Doctor-child change to stale database captures (src/infra/update-doctor-result.ts) and nothing undersrc/cli/update-cli; nothing was rerun for it. The earlier runs below are for4bd8ddf5545.Head
4bd8ddf5545, base8b2831e1daa(origin/main).mainmoved three times while this was tested, so the runs are on three bases:b4254cb2f6f.12b710c945eon base8f0d03fe9c4(between 1 and 2,mainchangedsrc/cli/update-cli/status.tsand tests among the update files).96763b979fe, wheremainhad changed the finalization log format, package publication, and this docs page: the 29 command-level update test files (395 passed), the plugin state test (25 passed), the Doctor pass, owed-step and finalization lifecycle tests (3 files, 122 passed), the two script tests (24 passed),pnpm tsgo:all,check-changed,pnpm check:docs, and the three ratchets. All pass.8b2831e1daa: six commits, none under the update CLI,src/infra,src/plugins, Doctor, config, the harness scripts, the update docs, or dependencies. Nothing was rerun for it.Full run (2):
node scripts/run-vitest.mjs run <files>over everyupdate*.test.tsundersrc/cliandsrc/infra(439 files; 437 ran) plustest/scripts/update-restart-module-outcome.test.tsandtest/scripts/eager-import-closure.test.ts: 6023 passed, 16 failed, 124 skipped.src/infra: 218 files, 2869 passed, 11 failed, 101 skipped.src/clitop level anddaemon-cli: 29 files, 395 passed.src/cli/update-cli: 190 files, 2735 passed, 5 failed, 23 skipped. Theclishard does not start after a failingcli-processshard, so its 121 files ran in a second invocation.update-startup.campaign-apply-error(8),update-candidate-state.result(2),update-startup-cached(1),update-command-handoff(3),update-command-rollback(1),update-command-node-engine-preflight(1).pnpm tsgo:all: pass.oxfmt --checkandnode scripts/run-oxlint.mjson the 16 changed files: pass.OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs: pass.pnpm check:docs: pass.scripts/check-session-identity-ratchet.mts --base origin/main --no-merge-base: pass.Test files audited in full:
src/cli/update-cli.git-service.test.ts,src/cli/update-cli.test.ts,src/cli/update-cli.already-current.test.ts,src/cli/update-cli.finalizer.test.ts,src/cli/update-cli/update-command-owed.test.ts,src/cli/update-cli/update-command-plugins.persistence.test.ts,src/cli/update-cli/update-command-fresh-doctor-outcomes.test-support.tswithupdate-command-fresh-doctor.test.ts. Nothing was removed. The managed Git setup shared by three cases moved into one helper, and onenot.toBe("error")assertion becametoBe("skipped"). Each command-level case gets a fresh home and ledger from the harness.