Repository navigation
fix: keep a package install when the old Git checkout's openclaw wrapper cannot be removed - #200579
Conversation
… be removed 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.
|
🦞👀 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 keeps a completed package installation when removing the previous Git checkout’s CLI wrapper fails, reporting a warning instead of rolling back. Example: A Git-to-package switch with --no-restart encounters EACCES removing /home/alex/.local/bin/openclaw.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a source-confirmed rollback bug with a focused change, and no introduced correctness defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe update CLI finalizer runs maintenance after package activation and optional Gateway verification, then publishes the result, settles package retention, and records update history. flowchart TD
A[Update CLI] --> B[Package activation]
B --> C[Optional Gateway verification]
C --> D[Post update maintenance]
D --> E[Wrapper retirement]
E --> F[Advisory or ownership refusal]
F --> G[Terminal result and history]
Technical reviewBest possible solution: Keep wrapper filesystem failures advisory at the existing maintenance owner while preserving ownership refusals and the normal package-settlement path. Do we have a high-confidence way to reproduce the issue? The pinned base returns wrapper-retirement-failed without verified activation and routes that result through rollback; the PR reports matching failing command regressions, but this review ran no target code. Is this the best way to solve the issue? The change fixes the classification at its existing owner, removes the obsolete downstream exceptions, and adds no parallel cleanup or retry mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eceb208abea1. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -27, Tests +83, Docs +5. Total +61 across 6 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, 7:30 AM ET / 12:30 UTC. |
|
Merged via squash auto-merge.
|
… be removed (#200579) Keep successful Git-to-package switches when optional wrapper removal fails, with a warning naming the remaining wrapper. Preserve system-package ownership and live-authority refusals. Adapt regressions to the existing stable rollback receipt without importing owed-step machinery. (cherry picked from commit 176f2ff) Co-authored-by: RomneyDa <[email protected]>
… be removed (openclaw#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.
…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, #200507
What Problem This Solves
Switching a Git checkout to a package install (
openclaw update --channel betafrom a checkout) removes theopenclawwrapper the installer wrote for the checkout. If that file cannot be removed and no Gateway restart was verified (--no-restart, or no Gateway service), the update exits 1, rolls the package install back, and reports that recovery could not prove a runnable installation. With a verified restart the same failure was already a warning.User Impact
User impact: the package install is now kept in both cases. The update exits 0 with one warning that names the path it could not remove or inspect and says the old wrapper keeps starting the old checkout wherever it comes first on
PATHuntil it is removed.Still failing, as before: a wrapper that a system package owns fails the update and rolls the package install back, and an update that lost its authority stops before it removes the wrapper.
A switch started by an already installed version behaves as before, because this step runs in the updater that started the update.
Why This Change Was Made
A leftover wrapper does not make the new package install unusable, so it should not undo a finished install. The failure is a warning and not an owed step: update history has no field for the wrapper path, so no later command could prove the wrapper is gone. A recheck over
PATHwas tried and rejected in review, because the installer writes the same wrapper template to places the Gateway servicePATHdoes not include and also writes it for package installs.The
wrapper-retirement-failedreason and its two special cases in the finisher are removed; nothing else read them.This came out of an inventory of everything that can still fail or roll back an update after the new version is in place. The other rows either already warn, are already owed steps, or protect update authority, plugin cohort settlement, ledger integrity, or state only this run can restore, and are unchanged.
Evidence
Before, on unmodified
main(ae31ea3be6d). Through the update command with a private state directory, for both--no-restartand no Gateway service: exit 1, runfailed, reasonwrapper-retirement-failed, and apackage rollbackstep.After. The same two cases: run
succeeded, nopackage rollbackstep, the package at the new version, the wrapper untouched, the warning in the report and as awarning:git-wrapper-retirementstep in update history, and no owed step.Negative control. A wrapper owned by a system package: exit 1, run
failed,package rollbackandpackage-backup-retentionsteps, the package back at 1.0.0, the wrapper untouched.Red and green. With the base production files, 2 of the 3 new command-level cases in
src/cli/update-cli.test.tsfail (the control passes) and 2 cases insrc/cli/update-cli/update-command-post-update.test.tsfail. All pass on this branch.Not proven.
retireStandaloneGitWrapperreturns at the firstPATHentry it cannot inspect, before reaching a later real wrapper. That is unchanged frommain.Review. The autoreview helper does not run on this machine. Two fresh read-only agents reviewed the work. The first review's findings are why this is a warning and not an owed step. A further read of the production diff before opening this PR found nothing to change.
Commands and counts
Head
b0215e16fdc, baseeceb208abea(origin/main). The checks below ran on5798ae3bc31(same change on base2a7ca163a57). The two commitsmaingained since then change worker preload resolution, the Doctor child's handling of predecessor writes, anddocs/install/updating.md; none touches the update CLI finisher, the wrapper code, or this PR's files, so nothing was rerun.On
5798ae3bc31:pnpm tsgo:all: pass.node scripts/run-vitest.mjson 6 files, 186 tests passed:src/cli/update-cli.test.ts,src/cli/update-cli/update-command-post-update.test.ts,src/cli/update-cli/update-command-terminal-outcome.test.ts,src/cli/update-cli.git-service.test.ts,test/scripts/update-restart-module-outcome.test.ts,test/scripts/eager-import-closure.test.ts.scripts/check-session-identity-ratchet.mts --base origin/main --no-merge-base: pass.OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs: pass.pnpm check:docs: pass.Red runs used this branch's tests with the production files from
ae31ea3be6d:src/cli/update-cli.test.ts -t "to a package install"2 failed, 1 passed;update-command-post-update.test.ts2 failed, 93 passed.Test files audited in full:
src/cli/update-cli.test.ts,src/cli/update-cli/update-command-post-update.test.ts. One finisher case was removed: "recovers and retains the package before reporting failed wrapper retirement" asserted the behavior this change reverses. The part of it that is still required (failed finalization, rollback, backup settled) is now asserted at command level in the system-package control.