Repository navigation
fix: let the next update finish a killed update that had already installed the new version - #200866
Conversation
…alled the new version When a killed openclaw update had replaced the installed version without confirming it, had begun rolling its plugin changes back on it, or had left the Gateway stopped, the next openclaw update refused and named openclaw update repair. It now settles the plugin recovery as before and then runs repair's own finalization (Doctor, plugin convergence, Gateway restoration) as a stage that records its own repair run, prints no result and never exits, then continues. A stopped Gateway is finished only when the update would restart it anyway; --no-restart, other unfinished update history, or a failed finish still refuse and name openclaw update repair. Repair and standalone finalize are unchanged.
|
🦞👀 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 next update finishes eligible killed updates through repair’s finalization before continuing. Example: An update installed OpenClaw 2026.12.1 and was killed before completing finalization.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: current main still refuses these interrupted-update states, and the patch reuses repair’s existing finalization owner without a definite introduced defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherCLI update preparation examines interrupted plugin recovery before selecting its update target; the shared repair finalizer performs Doctor, plugin convergence, and owned Gateway restoration, returning recorded outcomes to the calling update. flowchart TD
A[CLI update] --> B[Inspect interrupted recovery]
B --> C[Settle plugin cohort]
C --> D[Shared repair finalization]
D --> E[Doctor and plugin convergence]
E --> F[Gateway restoration]
F --> G[Record repair and continue update]
Technical reviewBest possible solution: Reuse repair’s finalization before target resolution while preserving its recovery checks and the calling update’s output contract. Do we have a high-confidence way to reproduce the issue? Current-main source explicitly refuses the reported candidate and rollback states, and the PR reports failing-before/passing-after process tests; this review did not execute them. Is this the best way to solve the issue? The defect is that settlement alone cannot finish an interrupted installed candidate; the required invariant is repair-equivalent completion before continuing, and the shared finalization stage is a focused implementation using existing owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2d52a33ef7ac. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +176, Tests +312, Docs +24. Total +512 across 8 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 17, 2026, 7:00 PM ET / November 18, 2026, 00:00 UTC. |
Each installed-recovery cut now kills an updater in its post-activation Doctor, after it installed its candidate, and checks that the next plain openclaw update finishes that run as repair does before updating.
…illed-installed-update
Proof for the two open review items1. Stored update history stays readable both waysA stored run's step name is a free string, not an enum, in published releases and in this branch.
2. A real installed update, killed after installing, finished by the next plain updateI extended the
The public diagnostics receipt now requires this Run on this Mac under Docker Desktop, lane harness at 391dbbd, package built from b73817d (the product source is identical; that commit changes only
The One raw pointer row from anchor-before: The stage's own result is Not shown
After the proof I merged current |
|
Merged via squash auto-merge.
|
…alled the new version (openclaw#200866) * fix: let the next update finish a killed update that had already installed the new version When a killed openclaw update had replaced the installed version without confirming it, had begun rolling its plugin changes back on it, or had left the Gateway stopped, the next openclaw update refused and named openclaw update repair. It now settles the plugin recovery as before and then runs repair's own finalization (Doctor, plugin convergence, Gateway restoration) as a stage that records its own repair run, prints no result and never exits, then continues. A stopped Gateway is finished only when the update would restart it anyway; --no-restart, other unfinished update history, or a failed finish still refuse and name openclaw update repair. Repair and standalone finalize are unchanged. * test(e2e): kill an installed update and let the next update finish it Each installed-recovery cut now kills an updater in its post-activation Doctor, after it installed its candidate, and checks that the next plain openclaw update finishes that run as repair does before updating.
* fix(update): include cold archives in candidate snapshots Co-authored-by: steipete <[email protected]> * fix(update): preserve file archives in rehearsal snapshots Co-authored-by: steipete <[email protected]> * fix(update): preserve source WAL state during archive inventory Classify cold archive SQL under its existing candidate-state subprocess owner. Preserve incomplete WAL source families so header inspection retains private cleanup custody. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]> Release adaptation: the baseline does not contain the #195487 header-cleanup suite. Keep that unrelated suite absent; carry the new incomplete-WAL inventory assertions into the existing inventory suite instead. Add a per-change 214-line allocation for the source regression, chunk fallback, and WAL preservation tests. No schema, updater protocol, authority, or archive-integrity changes. Companion audit at 9e917f0: - #200733 is selected as the next dependency-closure repair: missing archives must warn instead of blocking updates, and Windows copies must not share live read-only inode attributes. Do not qualify this intermediate checkpoint alone. - #200076 and #200930 are independent cold-history performance changes, not prerequisites for this snapshot repair. - #201009, #200994, #200866, #200577, #200805, #200802, and #200732 overlap only adjacent update documentation and independent repair flows; not prerequisites. Proof on base 309067b: - New production-subprocess regression: 4/4 fail before, 4/4 pass after. - Cold archives, chunks, and inventory: 31/31 pass after. - Additional budget/cleanup/import siblings: 46/47 pass. Configured-cache containment fails identically on the unchanged base at budget.test.ts:737; retained as an independent failure, not weakened or repaired here. - Targeted lint and format, documentation links, SQLite worker ratchet, and test-line ratchet pass. SQLite T1 counts remain 170; compatibility 15. - Worker typecheck was blocked at dependency custody, without guard bypass. Parent canonical core typecheck, typed lint (five files), and formatting passed with its owned dependencies. Full installed-upgrade/FRV proof remains pending the assembled candidate, including selected companion #200733. (cherry picked from commit 802e3f7) Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Proof recordings: red on base, green on the mergeTerminal recordings of the reproduction this PR describes, run again after merge on this Mac. Base/red uses the base this PR names for its red run, Full raw logs are not attached yet because the artifact store rejected uploads; the excerpts below are not the complete record. 1. Killed-run process test (real killed updater children, real
|
| Video | Side | SHA | Command | Result | MP4 sha256 |
|---|---|---|---|---|---|
| pr200866-process-base-red-b60b1147460.mp4 | base / red | b60b1147460 + head test file |
node scripts/run-vitest.mjs src/cli/update-cli/update-command-killed-run.process.test.ts |
13 failed / 19 passed, exit 1 | 3dbcb0ac2dc752fd83f434d1326e39f341cdfea44077dfa4c159d0d27ad14e87 |
| pr200866-process-head-green-fdf0c95ad6f.mp4 | head / green | fdf0c95ad6f |
same | 32 passed, exit 0 | a01b65854de402ca5a77359b642929693c08eb7394425b569a9aa7c94ea3150e |
| pr200866-lane-base-red-b60b1147460.mp4 | base / red | candidate b60b1147460, harness fdf0c95ad6f |
lane above with OPENCLAW_CURRENT_PACKAGE_TGZ |
7 of 7 cuts fail at next-update: exit 1, exit 1 |
f29e3bede33e27a3dc7e52d70ee52b425b9db728725b6e2c0e56c43d7edf5ba1 |
| pr200866-lane-head-green-fdf0c95ad6f.mp4 | head / green | fdf0c95ad6f |
lane above | 6 pass; partial-previous harness PASS then access-reader exit 125; lane exit 1 | 585e4af32236866b4c7e5b1832a2832a7fe9afe3019802e5910b69c071611ffc |
Recorded with asciinema 3.2.1 in a 150x50 terminal and rendered with agg 1.9.0 and ffmpeg (idle capped at 1 s, 3x). Sanitizing: runs used a neutral working directory and prompt, and XDG_CACHE_HOME pointed at a neutral copy of the pinned Bun cache so serialized errors do not print a home path; the lane runs used a copy of Node at a neutral path for the same reason. Recorded output was checked for usernames, home paths, host names, emails and tokens; none were found, so no redaction was applied.
Not covered by these recordings: a real Gateway in the installed lane (state 3 runs only in the process test, with a fixture service), state 2 installed, and a Linux host.
…alled the new version (#200866) * fix: let the next update finish a killed update that had already installed the new version When a killed openclaw update had replaced the installed version without confirming it, had begun rolling its plugin changes back on it, or had left the Gateway stopped, the next openclaw update refused and named openclaw update repair. It now settles the plugin recovery as before and then runs repair's own finalization (Doctor, plugin convergence, Gateway restoration) as a stage that records its own repair run, prints no result and never exits, then continues. A stopped Gateway is finished only when the update would restart it anyway; --no-restart, other unfinished update history, or a failed finish still refuse and name openclaw update repair. Repair and standalone finalize are unchanged. * test(e2e): kill an installed update and let the next update finish it Each installed-recovery cut now kills an updater in its post-activation Doctor, after it installed its candidate, and checks that the next plain openclaw update finishes that run as repair does before updating. (cherry picked from commit fdf0c95) Co-authored-by: RomneyDa <[email protected]>
…aw#194058) Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139. Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact. Co-authored-by: TorstenW <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: steipete <[email protected]> (cherry picked from commit 7c702c3) Release adaptation: Capture invoking operator env before candidate admission, forward to interactive triage only; preserve latest target selectors, confirmation and lease cleanup ordering. Exact three authorized production paths plus real lifecycle regression. Follow-up dispositions: ad4863d fix: preserve the running installation when an agent updates its Gateway (openclaw#201570); dc73ec0 fix: let updates finish when another tool briefly reads OpenClaw's databases (openclaw#202541); d07b530 fix: clarify PostgreSQL schema upgrades for Git installs (openclaw#202098); e60ea9f test(update): add a Git release upgrade-survivor scenario (openclaw#201956); 2ef6f7b fix(update): build and serve Git releases outside node_modules (openclaw#201917); dbc1aa0 fix: keep the openclaw command and Gateway working after updating a pnpm install (openclaw#201735); f5e7641 fix: Git checkout updates across a schema change no longer end as post-update-failed after the new release starts (openclaw#201600); 2183caf fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database (openclaw#201463); 47e8649 fix: explain why Doctor cannot restore a scheduled job’s account (openclaw#201550); 8f2cfd4 fix: remove updater-only restrictions from agent maintenance guidance; cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 24cb734 fix: keep carried-over scheduled jobs running after updates (openclaw#200653); d1276e1 feat(doctor): check OpenClaw ID member roles and honor an optional roles default (openclaw#197785); 0a39956 fix: finish updates when another tool reads OpenClaw's databases during the update (openclaw#201330); ea1c9d5 fix(update): settle remounted package publications before admission (openclaw#201336); 66b5212 fix(update): isolate malformed retained-install markers (openclaw#201199); 7e79c83 fix: let the next update finish a killed source checkout update (openclaw#201009); d905d8a fix: let the next update finish a killed update after the machine restarted (openclaw#200994); fdf0c95 fix: let the next update finish a killed update that had already installed the new version (openclaw#200866); 0c19bcd chore(release): close out 2026.11.5 on main (openclaw#200577); a1940e0 fix(matrix): keep explicit recovery available during deferred migration (openclaw#200805); 18b4776 improve: explain package baseline drift during updates (openclaw#200802); 1ad4cad fix(doctor): reclaim macOS updater runtimes blocked by non-updater processes (openclaw#200732); 427c857 fix: keep one missing archived transcript from blocking every update (openclaw#200733); 802e3f7 fix(update): keep valid cold archives from blocking updates (openclaw#200659); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); 3afe212 fix: let Doctor publish unchanged plugin migrations in any order (openclaw#200658); f65e4db fix(doctor): reclaim runtimes blocked by unrelated Linux processes (openclaw#200657); dab086c fix(update): let candidate Doctor read plugin dependencies from the staged package (openclaw#200595); 3447bee fix(update): keep updates going when the predecessor writes during its stop (openclaw#200569); 0ce9c77 fix: let the next update settle a package publication that a killed update left behind (openclaw#200550); ae31ea3 fix(update): repair handoffs in the journal-pinned lease store (openclaw#200532); 74020ea fix: continue updates when initial SQLite capture is stale (openclaw#200328); 6747b1e feat(update): run Git checkout installs from releases behind the release link (openclaw#199706); e3f8a67 fix(state): keep completed retained agent stores out of startup upgrade (openclaw#200284); 3c512c5 fix(gateway): move managed update lease operations off the main thread (openclaw#200169); ea69fcb chore(release): close out 2026.11.4 on main (openclaw#199956); 618bf31 fix(state): bound startup upgrade copies and pruning to owned state (openclaw#199929); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); 5dbf569 fix(update): plugin failures never fail an update or Gateway health; 764761e fix(update): refuse missing host prerequisites in one line and record a cause per attempt; 4c4fef4 fix(ui): update dialog claims installation before progress is confirmed (openclaw#199254); 136e1f6 fix(update): retrying an update from a dev checkout is refused after a killed update (openclaw#198673); 3bd03da fix(update): avoid duplicate database copies while the Gateway is stopped (openclaw#198148); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); e333f7e chore(ci): drop retired test-lines allocation records (3/3) (openclaw#197657); fd6fa47 fix: converge Gateway updates with environment-only service overrides (openclaw#196371); 7cf5e75 fix: clarify split-install updates and blocked Doctor repairs (openclaw#196342); 6ff8c86 fix(update): retain lazy sqlite catalog generation (openclaw#197095); 930e1f7 fix: keep stable updates and recovery free of premature migrations (openclaw#196474); a15f737 fix: preserve external plugin data during update rehearsal (openclaw#196301); 92798ae fix: updates survive interrupted heartbeat runs (openclaw#195656); c1e55e2 fix(update): restore LaunchAgent registration after repair contention (openclaw#195406); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685); 689cfc8 fix(update): reclaim dead closing triage repair leases (openclaw#194503); 86bc89e fix(doctor): keep standing Codex parameter advice out of retirement blockers (openclaw#193650); 691bc8d fix(backup): read the backup engine without copying the live database (openclaw#194234); 000542f fix(backup): backups and updates fail on slow storage when a header probe batch misses its deadline (openclaw#194239); 31a65d5 fix(update): skip --no-lazy-fetch on Git versions without it (openclaw#194198); e45e99d fix(update): preserve dev update sources in tag-only Git clones (openclaw#193109) Validation: Baseline2 intended operator-agent failures/32 controls passed; candidate34/34passed (194058-green.log). Accept launches synthetic operator-only CLI with expected env, decline starts nothing. Isolated updater flow, not live systemd/upgrade qualification. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 6689fd575ada8fe40a9593784deac18ec73041cd) (cherry picked from commit 92e7a9fa223b0dc35801f25f70be90b472d9a6b7)
What Problem This Solves
When an
openclaw updateis killed partway through, the nextopenclaw updatesometimes refuses and tells you to runopenclaw update repairfirst, even though nothing about the leftover state needs a person's judgment. Three common leftovers hit this:User Impact
User impact: in those three cases a plain
openclaw updatenow finishes the killed update the wayopenclaw update repairdoes, then carries on, with no second command needed. When finishing fails, or the case needs a person (for example--no-restartwith a stopped Gateway), it still stops and namesopenclaw update repair.openclaw update repairandopenclaw update finalizebehave exactly as before.Why This Change Was Made
Approval scope: the repository owner approved splitting the finalize step that
openclaw update repairruns (Doctor for the installed version, plugin convergence, Gateway restoration) into a stage thatopenclaw updatecan call for a killed update, with the stage printing nothing itself. The coordinator chose option A: the stage keeps repair's own run record. The change is limited to what is recorded and when. There are no schema, ledger, config, protocol or dependency changes, and no lease, fence, authority or integrity check is relaxed.The stage writes a second run row, and here is why. The stage has to run before the update decides anything about its own version, because its Doctor and plugin convergence rewrite config that the update's target resolution reads. At that point the update's own run does not exist yet: a command-line update creates it only after target resolution. Creating it earlier would mean reordering run admission or changing the ledger, both outside the approval. So the stage records exactly the repair-shaped run that
openclaw update repairrecords for the same state. The update's run then gets aninterrupted-update-finalizationwarning step that names that run.Design:
One owner.
update-command-finalize.tskeeps one finalization implementation.updateFinalizeCommandis the command shell: admission reporting, failure triage, the JSON or text result, exit codes including exit 2, and the post-output exit watch.finishInterruptedUpdateruns the same body in stage mode:attachLedger(repair), exactly as repair);In stage mode it skips admission reporting and triage, writes no result document, skips the exit watch, and never calls
exitCliAfterOutput. Deferred Doctor maintenance (repair's exit 2), a timeout, or any failure is thrown to the caller instead. The lifecycle's timeout JSON is suppressed for a stage.prepareUpdateFinalizationmoved unchanged intoupdate-command-finalize-config.tsto keep the module under the max-lines limit.Caller.
inspectInterruptedUpdateRecoverykeeps every proof from fix: let the next update continue after a killed update when nothing is left to repair #200680 and settles the cohort under the claim it already takes. For states 1 to 3 it no longer refuses. After the claim is released, as in repair, it calls the stage and records two warning steps (settlement and pointer), then the update continues. A stopped Gateway (state 3) is handled only when restart is enabled.Authority re-asserted by the stage:
As in repair, Doctor and plugin convergence run without an installation claim.
Refusals added so the stage never finishes less than repair would:
In each case the update refuses and names repair.
Evidence
Behavior checked, through the real
openclaw updatecommand entry with real killed updater child processes (SIGKILLed after reserving their plugin cohort), and the real stage (finalization, ledger, cohort settlement, executor claims, Gateway restoration):States 1, 2, 3 (restart on): the update settles, finishes and continues. Checked:
Same state, update vs. manual repair: the stage run and repair's run have the same shape (trigger, phase, status, reason, target, after, origin and verification keys, serving flags, step names and statuses). The killed runs match too, and so do the settled config values. Repair printed its one result; the stage printed none.
Failure paths:
In each the update stops before admitted execution, names
openclaw update repair, prints no JSON, and has noExitErrorin its cause chain. The stage run is failed / skipped (doctor-maintenance-pending) / succeeded-with-warning as repair would leave it, and no run is recorded as a successful update.Still refusing, each with the recovery left untouched:
--no-restart;Base reproduction on
origin/main(b60b114, through the update command entry): states 1 to 3 each refused withRun openclaw update repair. State 3 refused identically with restart enabled and with--no-restart, on both the candidate and the previous version.Installed command, real Doctor (Docker lane
package-installed-recovery). After each cut'supdate repair, the lane now updates to a fixture candidate whose post-activation Doctor sends SIGKILL to its updater. The candidate is installed and the run is leftrunning(state 1). A plainopenclaw update --tag file:<next> --yes --no-restart --jsonfollows with no repair. From the real state database and output, the lane checks:status: "ok");failed/abandonedand acknowledged;finalize:repair-continuation,trigger: cli,succeeded) ran the real pre- and post-plugin Doctor;succeeded, has both new steps, and itswarning:interrupted-update-finalizationnames the killed run and the stage run;running, and the next version is installed.All seven cuts on this Mac under Docker Desktop: six pass.
partial-previouspasses its harness and then fails the access-reader check, which cannot pass under Docker Desktop on macOS and failed the same way before this change. Raw results are in this comment.Stored history. Published readers accept the new step names. At
v2026.11.5andv2026.10.10the stored step name isstep: z.string()(src/infra/update-run-schema.ts:188/:186),decodeRunparses with that schema (src/infra/update-run-read.kernel.ts:30), and the Gateway protocol usesstep: text(packages/gateway-protocol/src/schema/update-runs.ts:127). This PR changes no schema, codec or ledger, so older runs decode as before.Simulated in the process tests, as in the existing repair fixtures: the Doctor child processes, post-plugin convergence, plugin installs, Doctor's own service maintenance, failure triage and the completion cache. The Gateway service is a fixture service whose start and health are observed.
Commands and counts
Base reproduction, base
b60b1147460and40cd5c14297(temporary scratch tests, not committed):updaterefused in all;repairsettled where no live or adopted driver.--no-restart× candidate / previous: all four refused with the same text.Red (new tests, base production code):
node scripts/run-vitest.mjs src/cli/update-cli/update-command-killed-run.process.test.ts→ 10 failed / 19 passed (29) at that point in the branch. The three finish cases, three repair comparisons and two failure-path cases failed because base refuses. The stalled-candidate neighbour failed in its final step: after the updater is killed, base still refuses. The
--no-restartcontrol failed on its new wording.Green, head
b73817d8a1b(rebased on0c19bcdf293, then ondbf626f3ddb; the last range touches only ClawHub plugin reinstall internals that these tests mock, diagnostics liveness, sessions and UI, so the proof was not rerun):update-repair-command,update-plugin-cohort-settlement,update-command-finalize-refusal,update-cli.finalizer,update-repair-handoff,update-command-publication-kill.process,update-repair-service,update-repair-cancellation,update-repair-history,update-repair-triage,update-finalization-lifecycle,update-command-legacy-finalize,update-repair-package-activation,test/scripts/update-restart-module-outcome,test/scripts/eager-import-closure: 17 files, 297 passed (shards 23 + 24 + 24 + 190 + 36). No existing assertion in these files changed.pnpm tsgo:all: passpnpm check:baseline-ratchets --base origin/main --no-merge-base: all 10 ok (net test lines +310, under the 400 allowance)OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs: passpnpm check:docs: pass;git diff --check: cleanInstalled lane, harness at
391dbbda29a, package built fromb73817d8a1b(same product source):OPENCLAW_DOCKER_ALL_FAIL_FAST=0 node scripts/test-docker-all.mjs --lanes=package-installed-recovery→ anchor-before, anchor-after, anchor-sync, helper-before, helper-after and helper-sync pass; partial-previous harness PASS, access-reader check fails (Docker Desktop host limit). The same lane before the variant, atb73817d8a1b: the same six pass, partial-previous the same.Merged head
bf5fe92109a(main at3460f617860; the new range touches state-lease release under contention, sessions, agents, UI and cleanup, not the update command, finalization, cohort settlement or the lane, so the Docker proof was not rerun):test/scripts/upgrade-survivor-installed-recovery-diagnostics.test.ts+upgrade-survivor-installed-recovery.test.ts: 47 passed, 1 failed (keeps shared evidence readable through restrictive umask, which also fails onmainon this Mac)pnpm check:baseline-ratchets --base origin/main --no-merge-base: all 10 ok (net test lines +324)Not proven or not run:
--no-restartin states 1 and 2.