Repository navigation
fix: let the next update finish a killed update after the machine restarted - #200994
Conversation
…arts The next openclaw update settled a killed update's plugin recovery only while the temporary update lease store still held the dead updater's lease. A restart clears that store, so the update refused and named repair even though every process of the earlier boot was gone. Adoption now records each driver's boot namespace on the run (additive origin JSON). When the lease row is gone, the update settles the recovery only if every recorded driver ran on this same identified Linux or macOS host in an earlier boot, outside containers, then claims the installation as before.
… lease store path A clone that shares the host name, machine identity and state directory boots on its own, so the restart rule also requires the run's last write to predate the current boot. The claim after a restart must land in the same lease store path, an unrecognized captured namespace records as unknown instead of failing adoption, and the codec comment states what yields first.
|
🦞👀 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. |
…ndles toPublicUpdateRun runs in the Control UI, so the plain-identity projection lives in the zod-free update run record module instead of beside the driver schema.
|
Codex review: blocked before merge. What this changesThis PR records updater boot identities so the next update can settle interrupted recovery after a Linux or macOS host restart. Example: A Linux package updater is killed after reserving plugin recovery, then the host restarts and clears the temporary lease store.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep this maintainer-authored PR open: it addresses a remaining recovery case on main, but introduces a confirmed failure in an existing CLI-output test. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe update CLI combines persisted run history, host process identity, and installation leases to decide whether existing plugin recovery can safely finish before another update starts. flowchart TD
A[Update CLI] --> B[Interrupted recovery inspection]
C[Persisted update run] --> B
D[Host boot identity] --> B
B --> E[Installation lease claim]
E --> F[Existing recovery settlement]
F --> G[Continue update]
Technical reviewBest possible solution: Keep boot evidence in the existing run ledger and reuse existing recovery settlement, with public driver identities unchanged. Do we have a high-confidence way to reproduce the issue? Current main explicitly refuses when the recorded lease is absent; the author reports matching red/green process tests, which this read-only review did not execute. Is this the best way to solve the issue? The fix uses the existing boot-identity producer, ledger, lease claim, and settlement owner; its bounded private metadata and public projection serve the stated recovery case without a competing recovery implementation. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 34d6c288fe1c. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +183, Tests +193, Docs +21. Total +397 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. 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 18, 2026, 12:08 AM ET / 05:08 UTC. |
|
Landing review on ClawSweeper's two items:
Extra local check: with Not proven: a real host restart. Boot identity and uptime are injected at their readers. |
|
Merged via squash.
|
Keep both openclaw#200994's restart rule and this branch's checkout gates in inspectInterruptedUpdateRecovery, and strip gitActivation beside the driver namespaces in toPublicUpdateRun. A killed checkout update after a reboot settles only when both proofs hold; tests cover it and the origin codec keeping gitActivation exact when namespaces yield.
* 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: base and mergeTerminal recordings of the killed-run process test this PR added, run again after merge on this Mac. Base 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.
pr200994-process-base-red-d4195774b99.mp4
pr200994-process-head-green-d905d8a6857.mp4Excerpts from these runsFrom the original run (not a new run)Log kept from the proof run quoted in the PR body, with paths redacted. The SHA was not recorded in the log. Manifest
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: neutral working directory and prompt, and Not covered by these recordings: the base refusal text itself (see above), a real machine reboot (the test replaces the lease store and the recorded boot), and the ledger and abandonment unit tests named in the PR body. |
…tarted (openclaw#200994) * fix(update): settle a killed update's recovery after the machine restarts The next openclaw update settled a killed update's plugin recovery only while the temporary update lease store still held the dead updater's lease. A restart clears that store, so the update refused and named repair even though every process of the earlier boot was gone. Adoption now records each driver's boot namespace on the run (additive origin JSON). When the lease row is gone, the update settles the recovery only if every recorded driver ran on this same identified Linux or macOS host in an earlier boot, outside containers, then claims the installation as before. * fix(update): require the killed run to predate this boot and keep its lease store path A clone that shares the host name, machine identity and state directory boots on its own, so the restart rule also requires the run's last write to predate the current boot. The claim after a restart must land in the same lease store path, an unrecognized captured namespace records as unknown instead of failing adoption, and the codec comment states what yields first. * fix(update): keep the driver identity projection out of Control UI bundles toPublicUpdateRun runs in the Control UI, so the plain-identity projection lives in the zod-free update run record module instead of beside the driver schema. * test(update): expect the printed run without the driver's boot namespace
…tarted (#200994) * fix(update): settle a killed update's recovery after the machine restarts The next openclaw update settled a killed update's plugin recovery only while the temporary update lease store still held the dead updater's lease. A restart clears that store, so the update refused and named repair even though every process of the earlier boot was gone. Adoption now records each driver's boot namespace on the run (additive origin JSON). When the lease row is gone, the update settles the recovery only if every recorded driver ran on this same identified Linux or macOS host in an earlier boot, outside containers, then claims the installation as before. * fix(update): require the killed run to predate this boot and keep its lease store path A clone that shares the host name, machine identity and state directory boots on its own, so the restart rule also requires the run's last write to predate the current boot. The claim after a restart must land in the same lease store path, an unrecognized captured namespace records as unknown instead of failing adoption, and the codec comment states what yields first. * fix(update): keep the driver identity projection out of Control UI bundles toPublicUpdateRun runs in the Control UI, so the plain-identity projection lives in the zod-free update run record module instead of beside the driver schema. * test(update): expect the printed run without the driver's boot namespace (cherry picked from commit d905d8a) 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
If
openclaw updateis killed and the machine then restarts, the nextopenclaw updaterefuses and tells you to runopenclaw update repair. That happens even though the restart ended every process the killed update had started. The refusal exists because the proof the update relied on, a lease row in a temporary file, is gone after a restart.User Impact
On Linux and macOS hosts, an update killed by a crash or power loss before a reboot no longer needs a manual repair. The next
openclaw updatesettles what the killed update left and continues. Windows, containers, and updates that were killed while running an older version keep today's refusal.Why This Change Was Made
When an update adopts its run, it now also records the boot it runs in: platform, kernel boot ID, Linux PID namespace, and a digest of the machine identity. That is the existing
captureNamespacedStateLeaseProcessOwner().namespacevalue. It is stored as an optionalnamespacekey onorigin.driverand on eachorigin.previousDriversentry. When the next update finds the lease row gone, it settles the killed run only if all of the following hold:driver:identity-unavailablestep and no managed handoff;The installation is still claimed the normal way, the claim must land in the same lease store path, and the drivers are checked again under the claim. Every other #200680/#200866 condition is unchanged, including the recorded-exit check and the store identity comparison on the lease path.
Storage: this is additive JSON in
update_runs.origin_json. There is no table, column, schema version, or migration change. The maintainer approved this field before implementation, asdocs/reference/database-schemas/storage-changes.md(review checkpoint) asks; it follows the additive driver-metadata precedent indocs/reference/database-schemas/layout.md(theorigin.driverparagraph, now extended).src/infra/update-run-driver-schema.ts:3(z.object) andsrc/infra/update-run-schema.ts:225/:234atv2026.11.5, and the same onmain.src/infra/update-managed-service-handoff-schema.ts:11processIdentitySchemaand:137currentPayloadSchema, same atv2026.11.5). The namespace never reaches them:recordedUpdateRunDriversnow returns plain process identities for every lease, recovery, interruption and backup caller, and the managed-handoff helper entry stays plain.driver(packages/gateway-protocol/src/schema/update-runs.ts:27), sotoPublicUpdateRunstrips the key.Update behavior: the installed updater runs first and cannot be patched. On the first update from a published version, the killed run was recorded by old code without a namespace, so nothing changes: it still refuses after a restart until a run recorded by this code is killed. A downgraded or older reader drops the key when parsing, and if it rewrites the run the namespaces are lost, so that run falls back to the refusal. A downgrade never reads the namespace as authority.
Not covered: a reboot in the middle of package publication still refuses through package settlement's own lease-store rule, which this PR does not change. Git-checkout behavior is untouched.
Evidence
The killed-run process test now starts each restart case from a real child updater killed with SIGKILL. It removes the lease store the way a restart clears the temporary directory, then rewrites the run's recorded driver boot to an earlier one. The current process's namespace and uptime are injected at their readers. The decision code is not mocked. The test also asserts that the killed child recorded its own real boot namespace.
d4195774b99: both new positive cases (Linux and macOS) refused with "The update lease store no longer holds that update's lease" (3 failed | 40 passed; the third failure was a control whose expected refusal I then corrected).nullnamespace;driver:identity-unavailablestep;update-run-abandonment.test.ts: adoption records the namespace, keeps earlier drivers' namespaces, keeps them out ofrecordedUpdateRunDrivers, and strips them from the public record (checked against the wire schema).update-run-ledger.test.ts: with eight maximal drivers carrying maximal namespaces, admission identities and routing are kept and the namespaces are dropped.Commands
node scripts/run-vitest.mjs src/cli/update-cli/update-command-killed-run.process.test.tsone4b80179501: 47 passednode scripts/run-vitest.mjs src/infra/update-run-abandonment.test.ts src/infra/update-run-ledger.test.ts src/infra/update-run-capture-receipts.test.ts src/infra/update-run-ledger.compaction.test.ts: 73 passednode scripts/run-vitest.mjs test/scripts/update-restart-module-outcome.test.ts test/scripts/eager-import-closure.test.ts: 24 passedpnpm tsgo:all,pnpm check:baseline-ratchets --base d4195774b99 --no-merge-base(all ok, including session-identity and test-lines),pnpm check:docs,git diff --checkupdate-command-migrated,update-repair-command,update-finalization-lifecycle,doctor-update-schema-guard,update-statusand others), plusupdate-command-install-layout.test.ts: 437 passed, 1 skipped512cdd5d11e: all checks passnode scripts/check-changed.mjs: all lanes ok except the dead-export scan, which reports exports insrc/plugins/plugin-metrics.ts,src/auto-reply/reply/session-event-delivery.tsandsrc/sessions/session-controller-model.test-support.tsthat this PR does not touchReview: one independent reviewer read the diff without my conclusions. It found no critical or high defects. I applied its findings: the cloned-machine case is now refused by the last-activity check, the claim on the restart path must use the same store path, an unrecognized captured namespace records as unknown instead of failing adoption, the codec comment was corrected, and controls were added. CI then caught that the plain-identity helper pulled zod into Control UI boot bundles; it now lives in the zod-free run record module. CI also showed that
update-command-install-layout.test.tsbuilt its expected printed run from the stored origin; it now expects the driver without its namespace and asserts that the printed JSON carries none. Theautoreviewhelper does not run on this machine, so it was not used.