Repository navigation
fix: an update with nothing to do no longer copies your databases - #201978
Merged
fuller-stack-dev merged 19 commits intoNov 22, 2026
Merged
fuller-stack-dev merged 19 commits into
fuller-stack-dev merged 19 commits into
Conversation
…a fresh post-core process
Contributor
|
🦞👀 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. |
Contributor
|
Codex review: stale review; fresh review needed. Summary Next step Review history (1 earlier review cycle)
|
…-no-capture # Conflicts: # src/infra/update-runner-git-release.test.ts
…eadline, and only once a handoff is certain
…el write and a fresh post-core launch, outside every update clock
…-no-capture # Conflicts: # src/cli/update-cli.fresh-doctor.test.ts # src/cli/update-cli.post-core-handoff.test.ts # src/cli/update-cli/update-cli-failure-recovery.test-support.ts # src/cli/update-cli/update-command-execution.test.ts # src/infra/update-runner-git-release.test.ts
Member
Author
|
Merged via squash.
|
obviyus
added a commit
that referenced
this pull request
Nov 22, 2026
- #201978 added two Git cases that drive the in-place Git executor, which Git installs no longer take. The release path copies nothing when current and never changes the running checkout; the package cases stay.
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 23, 2026
…enclaw#201978) * fix(update): copy original state only at the first state change * docs(update): say when the original-state capture is taken * fix(update): copy before a Gateway handoff, legacy config repair, or a fresh post-core process * test(update): expect the copy before a fresh post-core process * test(update): prove real Git and release updates copy at their mutation hook * fix(update): copy after the last pre-stop refusal and before writing a changed channel * test(update): a refused update copies nothing; sort run ids with a comparator * fix(update): copy before plugin records publish, outside the update deadline, and only once a handoff is certain * fix(update): copy before the combined plugin index write, every channel write and a fresh post-core launch, outside every update clock * fix(update): let the lazy capture follow this run's prepared package publication * test(update): drive the Git no-op capture case through the release runner * style(test): sort merged imports
tideclaw-bot
pushed a commit
that referenced
this pull request
Nov 24, 2026
…ate acts on it (#201668) * fix(update): verify recorded data-at-risk marks before repair acts on them * fix(update): verify any unverified data-at-risk mark and honor receipts in handoff recovery * fix(update): recognize a Git release-mode service as its checkout's own * fix(update): check a recorded data-at-risk mark before the next update, including already-current runs * fix(update): lead data-at-risk refusals with triage and record them on the refused run * fix(update): keep data-at-risk refusals within the recorded warning limit * test(e2e): finish the seeded data-at-risk run with a terminal phase * fix(update): name the agent route in killed-update recovery refusals * fix(update): drop an unused import * test(update): expect the agent route in killed-update refusals * fix(update): verify the newest mark before restoration without comparing run ids * fix(update): address review: keep the Gateway down on any inconsistent mark, resolve all marks, harden release ownership * fix(update): break the admission-root import cycle and type the e2e schema read * fix(update): address rating findings: agent rollback leftovers, helper restart, blocking findings first, shared Git metadata * test(e2e): prove the next plain update resolves a mark with the Gateway running * fix(update): address rating round 2: refuse marks before Doctor, registry-based rollback check, handoff fallback, async history read * test(update): pick the repair run, not a settlement row, in the data-at-risk cell * fix(update): resolve live-writer marks after Doctor holds the state * fix(doctor): say a skipped stale-Gateway stop left the PID running * fix(update): address rating round 3: leftovers before deferrals, retained rollback files, refusal after Doctor fails finalization * docs(update): note retained rollback files and refusals after Doctor * fix(doctor): say a stale Gateway stop could not be confirmed when nothing shows it running * fix(update): address landing review: revert release-mode ownership, check leftovers first, handoff entry guard, durable rollback evidence * test(update): follow main's Git release link layout in the launcher refusal test * fix(update): treat uninspectable leftovers and unreadable databases as unchecked; true wording after Doctor Release adaptation: Retain the stable installed-recovery harness. Do not add main's installed Docker service cell, later retired by #203808, or Git release-launcher wording/test because stable uses the in-place Git updater. Keep the state-verification, next-update, repair and interrupted-handoff paths and their compatible regressions. Companion audit: #203486 is present-equivalent at 3081077 (preserved). #201978 is selected next in this lane. #203808 and #203966 involve the inapplicable installed service-cell layout; #203497 and #203194 change main's package/Git activation layout and are not applicable; #204017 depends on that release-install layout. #204077, #204043, #203555 and #203520 are independent authority, cleanup, helper-fixture and config-validation changes. #204151, #203917, #203849 and #203406 are separate guidance, cleanup or status changes, not required by the data-risk verifier. #203569 fixes a separate cron receipt fixture in the same Doctor suite; the touched stale-stop cases do not depend on it. (cherry picked from commit a28f211) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit f8d4bc138ed2512c413cf96f66fe0eefb3b28d65)
tideclaw-bot
pushed a commit
that referenced
this pull request
Nov 24, 2026
…01978) * fix(update): copy original state only at the first state change * docs(update): say when the original-state capture is taken * fix(update): copy before a Gateway handoff, legacy config repair, or a fresh post-core process * test(update): expect the copy before a fresh post-core process * test(update): prove real Git and release updates copy at their mutation hook * fix(update): copy after the last pre-stop refusal and before writing a changed channel * test(update): a refused update copies nothing; sort run ids with a comparator * fix(update): copy before plugin records publish, outside the update deadline, and only once a handoff is certain * fix(update): copy before the combined plugin index write, every channel write and a fresh post-core launch, outside every update clock * fix(update): let the lazy capture follow this run's prepared package publication * test(update): drive the Git no-op capture case through the release runner * style(test): sort merged imports Release adaptation: Keep stable’s in-place Git runner and its existing service and rollback paths. Route the Git no-op fixture through updateGitCheckout and retain the before-mutation capture assertions. Omit the prepared Git release branch and its release-link-only tests. Merge the Doctor and fresh-handoff timing checks alongside the stable-only handoff coverage. Stable arms the executor clock before already-current package maintenance; keep both its timer and its synchronous fence/SQLite deadline checks paused during separately bounded capture. Exercise a live fence assertion after the original activation deadline elapses inside excluded work. Companion audit: #203578 is present-equivalent at e396e3f; its stable state-ownership guard is preserved. #203194, #203497 and #203926 apply to main’s newer release staging/activation flow and are not applicable here. #204127 changes when plugins are installed after activation, #203917 concerns retained-runtime cleanup, #202934 adds a separate macOS Git prereq, and #204151 is independent handoff repair guidance. None is required for lazy original-state capture. (cherry picked from commit a577911) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 1a2e6a7bec75074a150a684848990710c3fddc48)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Every direct
openclaw updatecopied the whole state (config and every database) into<state-dir>.update-captures/<run-id>before it knew whether it would change anything. An update that turned out to be already current, or that was refused, still copied. On a 20 GiB instance that is minutes of disk I/O and 20 GiB of temporary space for an update that does nothing, and on shipped versions the copy stayed behind.User Impact
An already-current
openclaw update, and an update refused before it changes anything, no longer copy the databases. A real update still keeps exactly one original-state capture, taken just before it starts changing state. Nothing new to configure.Why This Change Was Made
Owner rule: "if snapshots aren't needed, don't do them"; a version check never copies.
update-command-initialization-run.ts) before admission, for every direct CLI run. Whether the run is already current is decided later: for package installs at target selection (known, but not consulted), for Git installs inside the release runner after the build. Nothing reads the capture before those decisions; it is manual-recovery evidence and is handed to Doctor and finalization later.captureOriginal()(runs at most once; never serialized; no new stored field, store, or config). The run calls it at its first state change:beforeActivateinupdate-command-execution.ts), after its last pre-stop refusal check and before the service stop, so the Gateway still serves while the copy runs: package activation and Git release activation. In release mode this is after the built-equals-running check and immediately before activation; a build alone changes no state;handoffUpdateFromGateway, once it has decided to hand off), because the handed-off update changes state in another process that cannot capture. One place covers both callers, candidate admission and execution;update-command-noop.ts,update-command-convergence.ts). Those are the points where the run knows beforehand that state-changing work follows. The plugin cohort's per-step checkpoints are not used, since they fire even when nothing changes.Update behavior for published updaters
On an already-current run there is no candidate: the installed CLI does everything. Shipped drivers up to and including 2026.11.6 (published to
latesttoday without this change) keep copying on no-op runs. The copying stops from the first release that contains this change. The leftovers those drivers leave are removed by the cleanup from #201711, which is already on main: a run recorded as already current has its capture retired at the next cleanup point. A real update driven by a published updater keeps that updater's capture behavior; the candidate does not take a second one.Evidence
Checklist for landing:
original-state-capturestep and warnings. The real-update cases assert the step. The failed-capture warning keeps its full text, run step, JSON and stderr. The capacity-warning cases are unchanged and pass.docs/cli/update/repair-and-recovery.md,docs/cli/update.md). No user-facing message text changed.Owner tests through the real
openclaw updatecommand path (src/cli/update-cli.capture-space.test.ts, process-isolated lane, real capture code):original-state-capturestep. RED on base: one capture directory.NO ORIGINAL-STATE SNAPSHOT ... unavailablewarning on the run, in JSON and on stderr. This case moved here fromupdate-command-fresh-preview.test.ts, where it used an already-current run that no longer copies.The other state-change points, each proven to need its hook (each test fails with only that fix reverted):
update-cli.service-authority.test.ts, package on Linux and macOS, and Git): the handed-off update leaves exactly one sealed capture. Without the fix, the package and Git cases leave none.update-cli.config-convergence.test.ts): the capture exists when the repair runs. Without the fix: none.update-cli.post-core-handoff.test.ts): with a launch, copy then spawn; with a missing entry point, no copy.update-cli.fresh-doctor.test.ts): exactly one sealed capture exists when the post-plugin Doctor starts. Without the convergence hook: none.update-command-convergence-authority.test.ts): capture, then convergence. The same run without a channel change copies nothing. Without the fix: convergence only.update-runner-git-release.test.ts, real Git repositories): a rebuilt release reaches the mutation hook exactly once before activation; a release that equals the running one never reaches it.update-cli.capture-space.test.ts): one sealed capture, recorded on the run.update-cli.capture-space.test.ts): one sealed capture, and the update succeeds. RED at0b539bc72bf:update-recovery-pending, the failure the first green cell hit.#161044 contract, rewritten (
update-command-fresh-preview.test-support.ts): a fresh profile still records the database's absence before history (unchanged, passes on base and head); an existing profile copies only at its first state change, after its own history row (RED on base: copied before execution); a refused update now copies nothing (RED on base: a recovery set existed). "Doctor sees an already-current update's completed history" keeps its Doctor and history checks and now asserts that no capture step exists (RED on base).update-command-run-service-ownership.test.ts: its refused--tag mainupdate asserted that the refusal copied the service profile's state with the selected service env. A refused update now copies nothing. The case now asserts no capture and no capture reference, and keeps its admission, env-selection, ledger and output checks. The fixture rows that only fed the old copy-content check were removed; the earlier run stays because it gives the service profile its state database.Changed expectations, and why removal is safe: the foreground-failure case in
update-cli-failure-recovery.test-support.tswas removed by #200578 with the in-place runner it used. The already-current plugin-exception case (update-cli.plugin-convergence.test.ts) no longer expects a cleanup step: that run copied nothing, so nothing is cleaned. That is the behavior this PR adds.Recordings of the owner tests (the same
update-cli.capture-space.test.tscases). RED, with the six product files at basec25f49d92f4and tests from this head, shows 3 failed (package no-op, Git no-op and refusal each copy) and 3 passed (the controls). GREEN on this head shows 6 passed.unit-base-red.mp4
unit-head-green.mp4
Checks on this head: the touched and affected suites (capture, already-current, fresh Doctor, plugin and config convergence, service authority, convergence authority, fresh preview and terminal, status recovery, capture cleanup, automatic cleanup and its policy, upgrade-survivor no-op, update-restart module outcome, eager-import closure) pass under umask 022; three cases that timed out at 120 s while a package build ran in parallel pass when run alone.
pnpm tsgo:coreandpnpm tsgo:core:testpass; oxlint clean on touched files;pnpm check:baseline-ratchets --base cd2ae19272a --no-merge-basepasses, with test lines at +178 of 400;pnpm check:docspasses;git diff --checkclean.autoreviewdoes not run on this machine.Independent review (fresh read-only reviewer with the diff and the contract, not my conclusions) found one P0 and two P1 gaps, all real and all fixed above with failing-first tests:
Its P2 notes are addressed as follows:
Rating round 1 (ClawSweeper, head
bf0d7312785): overall F, proof F, patch D. Each finding was checked against the code first.openclaw update --channel betaon an already-current core with no plugin change wroteupdate.channelbefore any copy. The copy now happens first whenever a changed channel will be written (update-command-convergence.ts). Test: fails with only that fix reverted, and the same run without a channel change copies nothing.src/infra/update-recovery-baseline-capture.ts). It has never held the install layout. The first release is built from the commit that serves now (update-runner-git-release.ts, the conversion step), so publishing it changes no captured state. Activation of the target release still goes through the mutation hook, where the copy is taken.--no-restartand a running owned Gateway is refused by the before-stop publication check, which ran after the copy. The copy now comes after that check and still before the service stop (update-command-execution.ts). Test: the refused cases copy nothing and the allowed ones copy once; both refused cases fail with only that fix reverted.Rating round 2 (head
4983faf2f3b): overall F, proof F, patch D.beforeCommit, used by both its records-only path and its config path. The run now copies there first (beforeRecordPublication, passed by post-core convergence). This also covers already-current Git release installs, where no Doctor hook runs. The plugin cohort'sbeforePersistentEffectcheckpoint was tried and rejected: the test showed it fires many times even when nothing changes, so it would have copied on every no-op run with plugins. Test (update-command-plugins.persistence.test.ts): a plugin change gives exactly copy, then commit, with the new records published; no change never copies.--timeoutdeadline gets one owner method,exclude(operation): it stops the deadline during the copy and moves it by the copy's duration. The copy keeps its own step bound, as on main, where it ran before the deadline existed. An expired budget stays expired. Test (restart-health-deadline.test.ts): five seconds of excluded work leave a 1 s budget at 600 ms remaining, the budget then expires on time, and excluding after expiry is refused without running the work.update-command-report-handoff.test.ts): the missing-updater refusal copies nothing.docs/cli/update.md).Rating round 3 (head
264a73477b2, the last allowed round): overall F, proof F, patch D. All four findings were real and are fixed; no further round was run.beforeCommit. Round 2 had removed the copy from that index commit as redundant; that was wrong. Publication hooks now come from one factory (createPluginRecordPublicationHooksinupdate-command-plugin-records.ts): the index commit and bothbeforeCommitpaths run the copy first. Test: records-only, records-and-config (a real config delta) and unchanged. In each changed case the copy sees the index still empty; with no change, no copy happens.--no-restartchannel write (P1). The channel check now runs before the early Git-release branch, so every path that writes a changed channel copies first. Test: copy, then the channel write.excludeas the--timeoutdeadline, and the run's copy runs outside both. Test (update-command-executor-deadline.test.ts, real executor): five seconds of excluded work inside a 1 s activation budget leave the fence current, which then expires on the remaining budget.continuePostCoreUpdateInFreshProcess, after the entry-point and capability checks and before its tentative plugin-index write. Test: with a launch, copy then spawn; with a missing entry point, no copy.What held the rating at F: the patch tier cited these four timing and ordering gaps, all fixed above. The proof tier said the after-fix installed cells were still pending; their results are in the table below.
End to end (installed-package Docker cells, local OrbStack, update-matrix harness with the per-directory disk sampler). Each cell installs the packed build relabeled as 2026.11.5, with a managed Gateway service, about 2 GiB of agent database and a busy writer (1 MiB/s). It then runs a real
openclaw update --yes --jsonto the same build stamped 2026.11.6, a plain repeat (already current), andopenclaw update --tag 9999.0.0 --yes --json, which the registry cannot resolve. Bytes are allocated bytes of~/.openclaw.update-captures, sampled every 5 s, relative to the start of each step.cd2ae19272a2b00acc18a2ok, capture step recorded, captures peak +2,119 MiB, 283.9 sok, capture step recorded, captures peak +2,119 MiB, 242 sskipped/already-current, capture step recorded, captures peak +2,119 MiB, 37.1 sskipped/already-current, no capture step, captures +0 MiB, 9 starget-metadata-preflight)The disk figures come from the per-directory sampler; the VM-wide free-space delta is not used.
The first green attempt, at
0b539bc72bf, failed the real update withupdate-recovery-pending("Package publication is incomplete"). The lazy copy ran the package-admission check, which refuses any unfinished package publication, including the one this run had just prepared. The copy now proves ownership with the run's held executor fence instead (update-command-initialization-run.ts). Test (update-cli.capture-space.test.ts): a delegated-post-core candidate prepares its publication journal before activation; the update copies once and succeeds, and it fails with that fix reverted. The green column is the rerun after the fix. The final headbc47162ff2adiffers from2b00acc18a2by merges of threemaincommits and an import sort. Two of those commits touch only UI tests and chat reads. The third, #201894, changes post-restart verification (update-command-verification.ts,update-command-post-update.ts). It touches no capture point and no file this PR changes, so the cell was not rerun.Not proven
mainhas no in-place Git runner, so that shape no longer exists.cd2ae19272a, not on today'smain.mainstill captures eagerly at admission, so the red behavior is unchanged.Steps left to a person
None. An already-current or refused update does nothing that needs a person. Copies left by drivers up to 2026.11.6 are removed by the existing automatic cleanup on the next update.
Follow-ups (recorded, not built)
preserveSourceArtifacts: true(src/infra/update-recovery-baseline-capture.ts:360), which takesprepareSqliteReadOnlyCopyInProcess(src/infra/sqlite-snapshot.ts:557). That copies the live family withclone: "never"(src/infra/sqlite-readonly-location.ts:452), on purpose; the synchronous variant at:188-190states why: reflinks would lock the source inode and add shared extents to live databases. Only publishing the private staged image into the capture directory (src/infra/sqlite-snapshot.ts:285, viacopySqliteFilewithclone = "auto"atsrc/infra/sqlite-file-copy.ts:17) can useclonefile/FICLONE, and only when staging and capture share a volume. So a capture costs at least one full byte copy of every database, plus one clone or second copy.