Repository navigation
fix: remove the updater copies that earlier releases leave behind after an update - #206124
Conversation
…stallation moves Updaters through 2026.11.10 record no owner.json. Cleanup recognized their runtime only by projecting the current package root into its tree, so once a pnpm global update or a Git release folder moved the installation, the runtime (about 0.6 to 3.7 GiB each) was reported as "no recognized runtime marker" on every update and Doctor run and never removed. The runtime's own retained-files.json starts with the package.json it retained. When a directory holds exactly retained-files.json, tree/ and update-native-gate.mjs, and the projection of that path is an OpenClaw package.json reached without symbolic links, it is treated as the updater runtime it is and goes through the unchanged custody checks. Directories that match neither shape are kept with a message that says so and asks for no manual step.
|
🦞👀 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: passed. What this changesRecognizes updater copies left by shipped releases after the installation moves, allowing existing cleanup checks to reclaim them. Example: A 2026.11.10 updater leaves an ownerless runtime whose recorded pnpm installation path no longer exists.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a source-confirmed cleanup gap on current main, with no concrete patch defect found. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherUpdate and Doctor commands send discovered runtime directories to the shared cleanup owner, which checks their identity and process custody before removing eligible copies and reporting outcomes. flowchart TD
A[Update command] --> C[Runtime cleanup owner]
B[Doctor command] --> C
C --> D[Runtime recognition]
D --> E[Identity and custody checks]
E --> F[Remove or retain and report]
Technical reviewBest possible solution: Keep the existing cleanup owner and validate its shipped-format recognition through actual update and Doctor commands. Do we have a high-confidence way to reproduce the issue? Current-main source establishes that an ownerless runtime from a moved installation can fail recognition; the PR reports matching red tests and the linked discussion documents real leftovers, but this review ran no target code. Is this the best way to solve the issue? Reading the shipped runtime's own manifest path is a focused repair at the existing owner, with conservative custody checks preserved. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9239eeb2df37. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +53, Tests +95, Docs +1. Total +149 across 4 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
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 26, 2026, 2:36 PM ET / 19:36 UTC. |
|
Merged via squash.
|
…stallation moves (openclaw#206124) Updaters through 2026.11.10 record no owner.json. Cleanup recognized their runtime only by projecting the current package root into its tree, so once a pnpm global update or a Git release folder moved the installation, the runtime (about 0.6 to 3.7 GiB each) was reported as "no recognized runtime marker" on every update and Doctor run and never removed. The runtime's own retained-files.json starts with the package.json it retained. When a directory holds exactly retained-files.json, tree/ and update-native-gate.mjs, and the projection of that path is an OpenClaw package.json reached without symbolic links, it is treated as the updater runtime it is and goes through the unchanged custody checks. Directories that match neither shape are kept with a message that says so and asks for no manual step.
…stallation moves (#206124) Updaters through 2026.11.10 record no owner.json. Cleanup recognized their runtime only by projecting the current package root into its tree, so once a pnpm global update or a Git release folder moved the installation, the runtime (about 0.6 to 3.7 GiB each) was reported as "no recognized runtime marker" on every update and Doctor run and never removed. The runtime's own retained-files.json starts with the package.json it retained. When a directory holds exactly retained-files.json, tree/ and update-native-gate.mjs, and the projection of that path is an OpenClaw package.json reached without symbolic links, it is treated as the updater runtime it is and goes through the unchanged custody checks. Directories that match neither shape are kept with a message that says so and asks for no manual step. (cherry picked from commit cacd355)
…stallation moves (#206124) Updaters through 2026.11.10 record no owner.json. Cleanup recognized their runtime only by projecting the current package root into its tree, so once a pnpm global update or a Git release folder moved the installation, the runtime (about 0.6 to 3.7 GiB each) was reported as "no recognized runtime marker" on every update and Doctor run and never removed. The runtime's own retained-files.json starts with the package.json it retained. When a directory holds exactly retained-files.json, tree/ and update-native-gate.mjs, and the projection of that path is an OpenClaw package.json reached without symbolic links, it is treated as the updater runtime it is and goes through the unchanged custody checks. Directories that match neither shape are kept with a message that says so and asks for no manual step. (cherry picked from commit cacd355) Release adaptation: keep the stable documentation for the legacy updater and add only moved-runtime recognition. Keep the consolidated Doctor tests instead of restoring the deleted infra test file. Follow-up audit: 8933edd, dfd17d0 and 5c81526 address updater schema guidance, Docker startup and Doctor planning, respectively; none changes the projection recognizer or custody checks. Co-authored-by: RomneyDa <[email protected]>
Related: #204775
What Problem This Solves
Every update run by a published OpenClaw (2026.11.5 through 2026.11.10) leaves a copy of the running updater in an
openclaw-update-runtime-XXXXXXfolder, 0.6 to 3.7 GiB each. Cleanup recognized such a folder only through the path of the installation that is running now. pnpm global installs put every update in a new directory, and Git installs move into release folders, so after the first such update the folder no longer matched. It stayed forever, and every update and everyopenclaw doctor --fixprintedRuntime retained at <path>: no recognized runtime marker; inspect it before manual cleanup. A live macOS instance (Git install) holds two of these, 7.4 GB in total.User Impact
The first update, or the first
openclaw doctor --fix, after this release removes these folders by itself. Nothing to do by hand. A folder with this name that OpenClaw did not create is still left alone, and the message now says why without asking for routine work:it does not match a runtime an OpenClaw updater created, so it is kept.Why This Change Was Made
The fix stays in the existing owner,
maintainRetainedUpdateRuntimesinsrc/infra/temp-artifact-cleanup.ts. The update command's pre-pass, the update's Doctor pass andopenclaw doctor --fixall call it. No new owner, config option, retention period or stored field.Proof of ownership for a folder without
owner.json:retained-files.json, a realtree/directory andupdate-native-gate.mjs;retained-files.jsonis an absolute, normalized.../package.json(the shipped writer lists the retainedpackage.jsonfirst), and its projection undertree/is anopenclawpackage.jsonthat resolves to itself, so no symbolic link anywhere in the chain;creatorExited: false. Any running OpenClaw command that could be an updater keeps the folder; a Gateway or another non-updater process does not.Deletion keeps the existing
fs.rm, which removes a symbolic link without following it, and a symlinkedtree/never passes recognition anyway.git log -S'no recognized runtime marker'shows the refusal was deliberate (#160164, then #203917). #203917 handled the moved installation by reclaiming before the first release update starts, and documented manual removal for anything it missed. That pre-pass cannot help a folder whose installation had already moved, or one an earlier hop left behind. That was every pnpm update in the cells below, and both folders on the live instance. The safety concern behind the refusal, that an older updater could still be loading from the folder, is still handled by the census rule above.Update behavior
retained-files.json,tree/andupdate-native-gate.mjs; none writesowner.json, which exists only onmainsince fix(update): reclaim abandoned updater runtimes on a busy host #202590). 2026.11.4 and earlier leave atree/-only folder; this change does not recognize that shape after a move (see "Not proven").openclaw update(an older updater) is still running. This is the conservative rule above.openclaw update(driven by the fixed release) removes them, or anyopenclaw doctor --fixbefore that. Shown for pnpm in cells UG2 and UG1 below. Git and other prepared-release installs reach the same function through the update command's pre-pass; that path was not run in a cell.Evidence
Cells: a macOS 27.2 arm64 VM, pnpm 12.23.0 global install, a launchd Gateway serving with a 530 MiB agent database under steady writes, readiness polled every 250 ms. Each cell: install published 2026.11.9,
openclaw update --yes --jsonto published 2026.11.10 (driver 2026.11.9), add two decoy folders with the same name prefix,openclaw update --yes --jsonto the candidate (driver 2026.11.10),openclaw gateway restart,openclaw doctor --fix --non-interactive. Candidates are packs under the unpublished version 2026.11.13 (2026.11.14 for the third hop).doctor --fixorigin/main541ebfbbe75no recognized runtime marker25365490c2f(this fix)openclaw updateis still running (PIDs named)25365490c2f, then plainopenclaw updateto the PR head5ea717d987bRemoved abandoned updater runtime: …), decoys keptgateway restart7.5 s in all;doctor --fix36.7 s red and 42.4 s green (it stops the Gateway for maintenance either way). Update wall time: red 214.7 s and 276.8 s, green 222.6 s and 214.9 s.Runtime retainedlines in the Gateway log come from the update and Doctor processes writing to the shared log. Agateway restartadded none on either build.retained-files.json,tree/(only2f) andupdate-native-gate.mjs, noowner.json; the file list starts with the old checkout'spackage.json, and its projection is anopenclawpackage.json. The running Gateway now runs from a Git release folder, so the projection no longer matched the running root.Red recording (UR2,
origin/main541ebfbbe75), live view of the cell's output:red-UR2.mp4
Green recording (UG1,
25365490c2f),doctor --fixremoves both:green-UG1.mp4
Green recording (UG2), the next plain update removes both:
green-UG2.mp4
Repeat: build a pack of each revision under an unpublished version (
node scripts/package-openclaw-for-docker.mjs), serve it as the registry inside a disposable VM, and run the steps above. The listing per folder isdu -sk, its entries, and the size of files with link count 1.Raw log excerpt, cell UR2
Raw log excerpt, cell UG1
Raw log excerpt, cell UG2
Tests
Audited the whole of
src/flows/doctor-retained-runtime.test.tsandsrc/infra/temp-artifact-cleanup.test.ts(cases, fixtures, helpers, mocks, teardown, skips).shippedRuntime()fixture: a folder as 2026.11.5 through 2026.11.10 write it, whose retaining pnpm install directory no longer exists.Doctor and a shipped updater's runtime when …: removed when the installation moved (preview without--fixkeeps it and namesopenclaw doctor --fix); kept, with every entry and the target still readable, when an operator file sits beside it, when its file list names another package, when the file list path leaves the tree, and whentree/is a symbolic link.Doctor with a live …now runs for both runtime kinds against the real census: a live Gateway does not keep a shipped runtime; a title-erased CLI that may be its updater does.origin/main(541ebfbbe75): 9 failed. Two are behavior failures (shipped runtime kept despite only a Gateway running, and kept after the installation moved). Seven fail only on the message text; the folder was kept in those cases on both builds. Green on the fix: 31/31 and 1 passed, 1 skipped (Linux-only case) in the two files.Commands
node scripts/run-vitest.mjs src/flows/doctor-retained-runtime.test.ts src/infra/temp-artifact-cleanup.test.ts: red 9 failed / 22 passed on the original owner; green 31 passed, 1 passed + 1 skipped.node scripts/check-changed.mjs -- <changed files>: typecheck lanes passed; it reported the test's recursivereaddir(fixed), and the dead-export scan named two exports insrc/agentsthat this PR does not touch.node --import ./scripts/tsx.mjs scripts/check-session-identity-ratchet.mts --base origin/main --no-merge-base: OK.Not proven
tree/only, no file list) after a move: still kept, with the new message.no recognized runtime markerfrom these drivers.541ebfbbe75(red) to8e2c8f5b57a(fix commit) to the merge5ea717d987b. The commits in between touch chat, config schemas and Gateway startup custody, not retained-runtime cleanup, its callers or the census.package.json, projectedopenclawpackage).gateway restartadded noRuntime retainedlines on either build. The repeated lines seen in the Gateway log come from update and Doctor runs.