Skip to content

fix(update): a plugin step that throws after a core update rolls the whole update back - #200507

Merged
fuller-stack-dev merged 8 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-owed-plugin-steps
Nov 17, 2026
Merged

fuller-stack-dev merged 8 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-owed-plugin-steps

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Related: #200331

What Problem This Solves

openclaw update installs 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 status keeps showing it until a later openclaw update or openclaw update repair completes it.

What does not change:

  • Required database migrations, refused or invalid config, Doctor refusals (including any that name data at risk), a Gateway that is not ready on the new version, lost update authority, and child processes whose exit cannot be confirmed still fail the update and roll back a replaced core.
  • Plugin convergence that throws on an already-current core or in openclaw update repair still 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.
  • No schema, config key, Gateway protocol, wire schema, step status, or dependency change. The owed-step contract from fix(update): a failed shell completion or service definition refresh is never retried after an update #200331 is unchanged; this adds two step ids and their retries.

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:

  • a cohort exists, so the restore above put back every package and no record was published
  • the failure happened before plugin records and config started to be published
  • the pass was not also carrying channel config that Doctor dropped during this update (only this update can restore it)
  • the error is not a config refusal or conflict, a Doctor error or refusal, a revoked or interrupted requester, pending recovery, or an unconfirmed child process
  • update authority, the plugin lease, and the deadline are still valid

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-restart and 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 update runs convergence again, including on an already-current core, and settles the step when it completes. openclaw update repair runs 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

Path Plugin convergence throws Updater fails around a started Doctor
Package or Git core update, restart Owed after the Gateway is verified Owed after the Gateway is verified
Same with --no-restart or a stopped Gateway Owed when the update reaches maintenance Same
Gateway-started managed update Same finisher as above Same
Already-current core (plugins converge inline or after parking) Fails, exit 1, as before Owed
openclaw update repair, standalone finalize Fails, exit 1, as before Owed
Post-core child that exits nonzero, is killed, or reports failed Rollback, as before n/a

First update to a release with this change

The installed updater starts the update; the new version runs plugin convergence in its own process.

Installed updater Plugin convergence throws Doctor pass
Released v* versions up to 2026.11.5-beta.4: no plugin cohort, runs the Doctor pass itself (since 2026.9.5) The new child has no cohort, fails as before, the installed updater rolls back Installed updater's code: rollback as before
Builds that include the plugin cohort (#188978) but not this change The new child restores the plugin set and reports a warning with reason plugin-convergence; the installed updater keeps the update and records no owed step Installed updater's code: rollback as before
Versions before 2026.9.5 (child completes the Doctor pass) As the first row The new child reports a warning; the installed updater keeps the update and records no owed step
This change (the next update) Owed and recorded Owed and recorded

A parent that receives a nonzero exit or a failed result from the child still rolls back. The hidden finalize child's status values 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 real openclaw update command with private state, a managed Git install, and a running Gateway:

  • Plugin sync throws: exit 1, run rolled-back, OpenClaw update rolled back to 1.0.0: post-update-failed., Gateway restarted on the previous runtime.
  • The updater throws around the Doctor pass: exit 1. With the throw placed in the entrypoint probe, the run ended rolled-back with reason post-update-plugins (that case stays blocking). The regression test places it in a state read after Doctor ran, which also exits 1 on main.
  • A Doctor process that simply fails was already a warning with exit 0. That stays as it was.

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, in openclaw update status, and in openclaw update status --json (owedSteps). A JSON package update shows the same through the advisory step and the ledger row.

Retries. An already-current openclaw update and openclaw update repair settle 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.ts case failed on 4bd8ddf5545 (the step came back settled) and passes with the fix.

Still failing, as before.

  • Through the command: invalid config after plugins (rollback, nothing owed), and an unhealthy Gateway after a convergence failure (the update fails as it does today and owes nothing).
  • At the plugin step, with real cohort, package directory, index and config: a refused config write, a revoked requester, an unsettled child process, a failed package restore, a pass that also restores channel config, and no cohort.
  • At the Doctor pass (existing tests, unchanged and passing): a missing entrypoint, a Gateway that cannot be parked, a migration refusal, and a data-at-risk refusal. New: a state read that fails before Doctor starts.

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.

  • No published-driver run. scripts/e2e/published-driver-update-docker.sh exists 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.
  • No run against a real service manager or a real Gateway. The command-level tests use the repository's update harness: real ledger, real plugin cohort, real config files, simulated service manager and Gateway health.
  • The plugin state test uses the real package-directory owner on a fixture plugin. It does not run a managed npm install under a cohort.
  • Doctor's removal of a stale npm copy that shadows a bundled plugin happens outside the cohort for packages the cohort did not record. It behaves the same on main, and a rollback there does not restore it either.
  • src/infra/update-repair-agent.e2e.test.ts and src/cli/update-cli/update-command-node-runtime.live.test.ts are outside the unit configurations and were not run.
  • The three blocking-class rows added last to the plugin state test were run on this branch only.
  • The --no-restart and 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.
  • The owed Doctor step is shown through the command only for the managed Git core update. On an already-current core and in repair it rests on the Doctor pass and repair-phase tests.

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 f1459b6e426 with 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 at 6747b1ec5ae, which had changed Git release installs and package recovery reporting in the update CLI): pnpm tsgo:all pass; 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 under src/cli/update-cli; nothing was rerun for it. The earlier runs below are for 4bd8ddf5545.

Head 4bd8ddf5545, base 8b2831e1daa (origin/main). main moved three times while this was tested, so the runs are on three bases:

  1. Red runs: this branch's tests with the production files from b4254cb2f6f.
  2. Full run: 12b710c945e on base 8f0d03fe9c4 (between 1 and 2, main changed src/cli/update-cli/status.ts and tests among the update files).
  3. Rerun after rebasing onto 96763b979fe, where main had 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.
  4. Final rebase onto 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 every update*.test.ts under src/cli and src/infra (439 files; 437 ran) plus test/scripts/update-restart-module-outcome.test.ts and test/scripts/eager-import-closure.test.ts: 6023 passed, 16 failed, 124 skipped.
    • src/infra: 218 files, 2869 passed, 11 failed, 101 skipped.
    • src/cli top level and daemon-cli: 29 files, 395 passed.
    • src/cli/update-cli: 190 files, 2735 passed, 5 failed, 23 skipped. The cli shard does not start after a failing cli-process shard, so its 121 files ran in a second invocation.
    • Script tests: 2 files, 24 passed.
  • The 16 failures are in 6 files and fail the same way with the base production files swapped in: 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 --check and node scripts/run-oxlint.mjs on the 16 changed files: pass.
  • OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs: pass.
  • pnpm check:docs: pass.
  • Test-lines ratchet: +331 of 400. Mock export ratchet: 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.ts with update-command-fresh-doctor.test.ts. Nothing was removed. The managed Git setup shared by three cases moved into one helper, and one not.toBe("error") assertion became toBe("skipped"). Each command-level case gets a fresh home and ledger from the harness.

…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.
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: L labels Nov 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The 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.

  • Before: The updater restores plugins, rolls core back, and exits 1.
  • After: The updater restores plugins, verifies the new runtime, exits 0, and records plugin-convergence as owed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful direction and substantial harness coverage, with one concrete settlement defect and no qualifying real-runtime or upgrade proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A recoverable plugin exception repeatedly rolls back an otherwise usable core update.
Reason: The maintainer-authored direction follows the existing best-effort update contract and preserves explicit safety refusals.

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
Reviewed head: 4bd8ddf554511ad549d19d59aeec85ede5f6c3b3

Before merge

  • Preserve owed convergence after deferred config publication (P2) - If an earlier successful run owes plugin-convergence and the next update or repair encounters a config publication conflict, the existing plugin owner rolls back and returns status: "warning" with reason plugin-config-conflict. The retained persistence test's conflict case demonstrates this with the install index unchanged. Here converged becomes true, but owedNow contains no plugin-convergence entry, so the retry returns undefined and marks the earlier row completed. Status then loses the outstanding convergence warning even though publication was deferred. Preserve the owed row for this existing outcome and add a regression covering an earlier owed step followed by the conflict.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Preserve owed convergence after deferred config publication — src/cli/update-cli/update-command-owed.ts:131-136

Tests

  • Missing end-to-end proof: Supply redacted real CLI/Gateway evidence for the recoverable failure and retry, plus a latest-stable upgrade preserving config, plugin records, and existing update history.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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:

  • [P2] Preserve owed convergence after deferred config publication — src/cli/update-cli/update-command-owed.ts:131-136
    If an earlier successful run owes plugin-convergence and the next update or repair encounters a config publication conflict, the existing plugin owner rolls back and returns status: "warning" with reason plugin-config-conflict. The retained persistence test's conflict case demonstrates this with the install index unchanged. Here converged becomes true, but owedNow contains no plugin-convergence entry, so the retry returns undefined and marks the earlier row completed. Status then loses the outstanding convergence warning even though publication was deferred. Preserve the owed row for this existing outcome and add a regression covering an earlier owed step followed by the conflict.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4c61c20fb1a7.

Provenance checked

  • Plugin transaction rollback and config-conflict warnings keeps the original intent (6fd646e: Restore compatible plugin artifacts when core rolls back; subsequent fix(update): preserve config edits during plugin finalization #189819 intentionally deferred conflicting config publication without failing core recovery.)
  • Exceptions around post-plugin Doctor changes intended behavior with a stated reason (ee44876: The outcome-helper refactor preserved existing failure classification; this PR explicitly explains why unclassified exceptions after Doctor preparation may become owed while config and readiness remain blocking.)
  • Owed-step persistence and settlement keeps the original intent (89924a8: Keep successful updates successful while recording optional unfinished work in existing ledger rows for later retry.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/cli/update-cli/update-command-owed.test.ts src/cli/update-cli/update-command-plugins.persistence.test.ts src/cli/update-cli.already-current.test.ts src/cli/update-cli.finalizer.test.ts
  • git diff --check

What I checked:

Likely related people:

  • Jason (Json): Raw commit 89924a8 adds src/infra/update-run-owed-step.ts:11 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 89924a893846; files: src/infra/update-run-owed-step.ts)
  • Peter Steinberger: Raw commit ee44876 adds src/cli/update-cli/update-command-fresh-doctor.ts:522 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ee4487643a79; files: src/cli/update-cli/update-command-fresh-doctor.ts)
  • RoboClaw: Raw commit 6fd646e adds src/cli/update-cli/update-command-plugins.ts:136 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6fd646e86cd7; files: src/cli/update-cli/update-command-plugins.ts)

PR surface

Source +152, Tests +331, Docs +50. Total +533 across 16 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 183 31 +152
Tests 7 395 64 +331
Docs 2 64 14 +50
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 642 109 +533

Preflight source

Source 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

Metric Value Why it matters
Production versus regression coverage Production +183/-31 LOC; tests and support +395/-64 LOC. Growth primarily covers distinct rollback, publication, readiness, retry, and command-output boundaries while reusing existing persistence.

Labels

Label changes:

  • add P2: Recoverable plugin failures can repeatedly prevent core updates; this is a focused CLI reliability repair without evidence of an urgent released regression.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Recoverable plugin failures can repeatedly prevent core updates; this is a focused CLI reliability repair without evidence of an urgent released regression.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 17, 2026, 3:56 AM ET / 08:56 UTC.

@fuller-stack-dev
fuller-stack-dev enabled auto-merge (squash) November 17, 2026 09:36
@fuller-stack-dev
fuller-stack-dev merged commit c48b829 into openclaw:main Nov 17, 2026
139 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/update-owed-plugin-steps branch November 17, 2026 10:00
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
…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
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…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)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…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)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
`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)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…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)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…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)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
… 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)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant