Repository navigation
fix: let the next update finish a killed source checkout update - #201009
fuller-stack-dev merged 7 commits into
Conversation
An in-place Git update now records the commit and build it activated before it reserves its plugin recovery. The next openclaw update settles that recovery as it does for package installs, and finishes the installed build as repair does, only while the checkout still holds exactly that build: the same commit, a clean tree, and a build made from that commit with that build ID. Older runs and moved, edited or rebuilt checkouts keep the refusal that names openclaw update repair.
The next update now checks the checkout's build the way the updater does before it restarts a Gateway: build identity, build stamps, entry point and Control UI assets must all match the activated commit. Untracked files count as local changes whatever the local Git configuration says. Tests use host independent Git configuration, distinct build IDs, and cover a mismatched previous build and an edited tracked file.
Keeps the activation schema module-private, as nothing outside it needs 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: blocked before merge. What this changesRecords the build activated by an in-place Git update so a later update can automatically finish its interrupted recovery. Example: A source-checkout update installs build build-candidate for version 2026.12.1 and is killed before verification.
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 automatic recovery for source checkouts, and this maintainer-authored patch addresses that gap through existing recovery owners without a definite introduced defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherCLI update admission reads persisted update history and plugin recovery, checks the installed checkout, and invokes existing settlement and repair finalization before admitting another update. flowchart TD
A[CLI update] --> B[Read interrupted recovery]
B --> C[Check recorded checkout activation]
C --> D[Existing plugin settlement]
D --> E[Existing repair finalization]
E --> F[Continue update]
C --> G[Explain manual repair]
Technical reviewBest possible solution: Keep the activation receipt in the existing run ledger and reuse the existing settlement and finalization owners for an unchanged, verified checkout. Do we have a high-confidence way to reproduce the issue? Current-main source explicitly rejects source-checkout recovery, and the PR reports failing-before/passing-after process cases; this read-only review executed no target code. Is this the best way to solve the issue? The defect is missing checkout identity at recovery admission; the invariant is repair-equivalent settlement only for the activated build, and the receipt plus existing runtime verifier provides a focused fix without another recovery owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e9d11a5476f3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +90, Tests +291, Docs +30. Total +411 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:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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:27 AM ET / 05:27 UTC. |
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.
|
On the data-model compatibility item: the change adds one optional key to
A shipped-CLI trace of a real killed source update is not part of this PR's evidence. The PR body lists it under "Not proven". |
|
Merged via squash.
|
* 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 killed-run process test cases this PR added, run again after merge on this Mac. Head/green uses the merge commit Base/red uses the merge parent Full raw logs are not attached yet because the artifact store rejected uploads; the excerpts below are not the complete record.
pr201009-process-base-red-3c9fb50278d.mp4
pr201009-process-head-green-7e79c830e64.mp4Excerpts from these runsFrom the original run (not a new run)Mutation reds for the two reboot tests quoted in the PR body, with paths redacted. The SHA was not recorded in the logs. 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: a shipped-CLI trace of a real killed source update retried through the published driver, a real machine reboot, and the ledger, execution and |
… heartbeat local - #201009 recorded the commit and build an in-place checkout update activated, so a killed run's plugin cohort could settle. Only the deleted in-place runner wrote it, and Git releases reserve no plugin cohort: they converge plugins after the new release verifies. Remove the writer (the transaction's readGitActivation, its activation input, and the onTransaction record) and its test. The reader and the gitActivation field stay for runs older updaters left. - main removed STARTUP_MIGRATION_HEARTBEAT_INTERVAL_MS as unused; the state upgrade heartbeat is its only user, so it keeps its interval as a local constant.
…claw#201009) * fix: let the next update finish a killed source checkout update An in-place Git update now records the commit and build it activated before it reserves its plugin recovery. The next openclaw update settles that recovery as it does for package installs, and finishes the installed build as repair does, only while the checkout still holds exactly that build: the same commit, a clean tree, and a build made from that commit with that build ID. Older runs and moved, edited or rebuilt checkouts keep the refusal that names openclaw update repair. * fix: refuse a killed checkout update whose build is incomplete The next update now checks the checkout's build the way the updater does before it restarts a Gateway: build identity, build stamps, entry point and Control UI assets must all match the activated commit. Untracked files count as local changes whatever the local Git configuration says. Tests use host independent Git configuration, distinct build IDs, and cover a mismatched previous build and an edited tracked file. * test: fix the checkout activation writer test types and lint Keeps the activation schema module-private, as nothing outside it needs it. * test: build namespaced drivers without spreading in map
… heartbeat local - #201009 recorded the commit and build an in-place checkout update activated, so a killed run's plugin cohort could settle. Only the deleted in-place runner wrote it, and Git releases reserve no plugin cohort: they converge plugins after the new release verifies. Remove the writer (the transaction's readGitActivation, its activation input, and the onTransaction record) and its test. The reader and the gitActivation field stay for runs older updaters left. - main removed STARTUP_MIGRATION_HEARTBEAT_INTERVAL_MS as unused; the state upgrade heartbeat is its only user, so it keeps its interval as a local constant.
) * fix: let the next update finish a killed source checkout update An in-place Git update now records the commit and build it activated before it reserves its plugin recovery. The next openclaw update settles that recovery as it does for package installs, and finishes the installed build as repair does, only while the checkout still holds exactly that build: the same commit, a clean tree, and a build made from that commit with that build ID. Older runs and moved, edited or rebuilt checkouts keep the refusal that names openclaw update repair. * fix: refuse a killed checkout update whose build is incomplete The next update now checks the checkout's build the way the updater does before it restarts a Gateway: build identity, build stamps, entry point and Control UI assets must all match the activated commit. Untracked files count as local changes whatever the local Git configuration says. Tests use host independent Git configuration, distinct build IDs, and cover a mismatched previous build and an edited tracked file. * test: fix the checkout activation writer test types and lint Keeps the activation schema module-private, as nothing outside it needs it. * test: build namespaced drivers without spreading in map (cherry picked from commit 7e79c83) 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
openclaw updateon a source (Git) checkout is killed partway through, every lateropenclaw updaterefuses until you runopenclaw update repair. Package installs stopped needing that step in #200680 and #200866. Checkouts kept it, because the version number of a checkout does not show whether the killed update had already swapped in its new build.User Impact
User impact: after a killed source-checkout update, the next
openclaw updatesettles the leftover recovery itself and continues, as it already does for package installs. When the checkout was changed by hand afterwards, it still stops and namesopenclaw update repair.Why This Change Was Made
An in-place checkout update now records the commit and build it activated, as
origin.gitActivationon its run, just before it reserves its plugin recovery. The next update reads that record and checks the checkout on disk. It must still be at that commit, have no local changes, and hold that exact build, complete and made from that commit. Then the checkout runs the killed update's build, and the update uses the same settlement as the package path:openclaw update repairfinishes it (Doctor, plugin convergence, Gateway restore), using the stage from fix: let the next update finish a killed update that had already installed the new version #200866.Anything else keeps the refusal, now with the specific reason. That covers runs recorded by older updaters (no record), a pulled, edited, or rebuilt checkout, and a missing or incomplete build.
What I checked in source:
src/infra/update-runner-git.ts,activate()thenonTransaction). The command-level rollback settles the cohort before it restores the old runtime (src/cli/update-cli/update-command-rollback.ts,settleUpdatePluginCohortInCandidatebeforepackageTransaction.rollback). So whenever a cohort exists,distis the candidate build.dist/build-info.jsonbyte for byte.relocateRuntimeTreerewrites only.modules.yamland.binlaunchers (src/infra/update-runtime-relocation.ts). A runner test now asserts the live file equals the validated candidate's file.onTransactionto the package exposure swap (src/cli/update-cli/update-command-git.ts), so it never records the fact and keeps refusing. The Git release layout never callsonTransactionand never reserves a cohort, so its behavior is unchanged.openclaw update repairalready runs the same settlement and finalization on a checkout, with none of these gates. A new test compares the update's recorded run with repair's for the same killed state and finds them identical.Update behavior. The installed updater runs first and cannot be patched. On the first update from a published version, nothing changes: published updaters do not record
gitActivation, so a run they leave behind still gets today's refusal. The new path applies only once a run recorded by this code is killed. A downgraded updater's origin schema is a non-strictz.object(src/infra/update-run-schema.ts:234atv2026.11.5), so it drops the key and refuses as today. If an older writer rewrites the row, the record is lost, which is the safe direction.Storage. One additive, optional key in the existing
update_runs.origin_jsoncolumn. No column, table, schema version, or migration. It is kept as an exact receipt besideorigin.driverandorigin.packageRelease, and public history projections omit it. Documented indocs/reference/database-schemas/layout.mdbeside theorigin.driverprecedent.Interaction with #200994
#200994 lets the next update accept a killed run whose lease row vanished in a reboot, when every recorded driver ran in an earlier boot of the same machine. This branch now sits on top of it. The two checks prove different things, and the code requires both. The restart rule (or the lease row) shows the updater's processes are gone. The checkout gates (recorded build matches the cohort, HEAD, clean tree, complete matching build) show what is on disk. The gates run in
inspectHistory, which runs again under the installation claim, so a reboot never skips them.The origin codec keeps
gitActivationin the exact receipt set. When the origin outgrows 16 KiB, it drops driver namespaces first. If the receipts still do not fit, the write fails, so the record is never silently lost.toPublicUpdateRunstrips both the activation and the namespaces.Evidence
Each killed-run case starts from a real child process that checks out the candidate commit in a real temporary Git repository the test owns, installs its build, records the run and cohort, and is then killed with SIGKILL. The next
openclaw updateruns from its command entry.14b9fc3c8d9: the 10 new checkout cases failed with the old "left by an update of a source checkout" refusal.048bb6aab9d(three merge commits; onlyupdate-plugin-cohort-settlement.tsandupdate-run-record.tsconflicted, and both resolutions keep both changes). The killed-run file passes 61/61 on the merged tree.gitActivation. The stored row loses only the namespaces and keeps the activation exact. A codec that also dropped the activation in its fallback fails it.gitActivation(what published updaters write) loads and refuses with "did not record which build it activated". The published reader atv2026.11.5parsesoriginwith a non-strictz.object, which drops the new key.update-command-execution.test.ts). The Git runner's transaction names the validated commit and a distinct build ID.Not proven: a shipped-CLI trace of a real killed source update retried through the published driver, and a real machine reboot (the reboot tests replace the lease store and the boot identity). A killed checkout update that left the Gateway stopped uses the shared stage the package tests cover. The checkout changing between inspection and the claim is handled by rerunning the inspection under the claim, without a dedicated test. Leftover
*.openclaw-update-*.tmpruntime backups are not retired by this path, which matches repair.Commands (merged tree)
node scripts/run-vitest.mjsover the killed-run file, execution, cohort settlement and cohort records/recovery/commit, run ledger, compaction, abandonment and record, allupdate-runner-git*suites,test/scripts/eager-import-closure.test.tsandtest/scripts/update-restart-module-outcome.test.ts: 26 files, all passedpnpm tsgo:all,pnpm check:baseline-ratchets --base d905d8a6857 --no-merge-base,pnpm check:docs,git diff --check: all passedd905d8a6857..048bb6aab9d, which touches no update, cohort, lease or run-ledger file, so the update suites were not rerun for them.tsconfig.core.jsontypecheck and the ledger file were rerun on the final head after a lint fix in the new ledger test.