Repository navigation
fix: let Doctor reclaim updater runtimes on Macs running node hosts or the app - #200732
Conversation
…ocesses The retained-runtime census treated every OpenClaw-looking process without an artifact reference as a possible creating updater. On macOS that kept every copy behind node-host services and their title-erased CLI children, the macOS app and its node worker, and helpers that inherit the Gateway service marker. Classify the node command, node-host launcher children, the node worker title, and the app bundle executable as non-updaters, and report the Darwin service marker only for JS runtimes, as on Linux. Artifact references and title-erased CLIs of any other parent still retain the runtime.
|
🦞👀 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: needs maintainer review before merge. What this changesThis PR stops node hosts, the macOS app, its worker, and marked non-JavaScript helpers from falsely retaining abandoned updater runtimes. Example: A Mac runs openclaw node run while Doctor inspects /tmp/openclaw-update-runtime-Ab1234.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a current runtime-cleanup defect through the existing census owner; no concrete introduced code bug was found, and maintainer-authored work must remain open. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor and update maintenance pass retained-runtime paths to the shared process census, which combines process commands, working directories, executable paths, and identity evidence to return blocking PIDs before deletion. flowchart TD
A[Doctor or update maintenance] --> B[Retained runtime cleanup]
B --> C[Shared process census]
D[Native process commands and directories] --> C
C --> E[Runtime custody classification]
E --> F[Retain or remove abandoned runtime]
Technical reviewBest possible solution: Keep the targeted exclusions in the existing custody classifier while preserving explicit runtime references and uncertainty about possible updaters. Do we have a high-confidence way to reproduce the issue? Current-main classification and the supplied native before/after trace establish the false-holder path; this read-only review did not execute target code. Is this the best way to solve the issue? The patch repairs the shared classification boundary, reuses existing command parsing, and adds distinct custody controls without unnecessary production machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5484e18dab2b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +62, Tests +124, Docs +8. Total +194 across 6 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:
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, 1:19 PM ET / 18:19 UTC. |
|
Merged via squash.
|
…ocesses (openclaw#200732) The retained-runtime census treated every OpenClaw-looking process without an artifact reference as a possible creating updater. On macOS that kept every copy behind node-host services and their title-erased CLI children, the macOS app and its node worker, and helpers that inherit the Gateway service marker. Classify the node command, node-host launcher children, the node worker title, and the app bundle executable as non-updaters, and report the Darwin service marker only for JS runtimes, as on Linux. Artifact references and title-erased CLIs of any other parent still retain the runtime.
* 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]>
…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
Each OpenClaw update keeps a private copy of the running runtime (about 3.7 GB here) and relies on later updates or
openclaw doctor --fixto delete copies nothing uses. On a Mac that runs node-host services or the macOS app, that cleanup never deletes anything. Every copy is refused with "other OpenClaw processes are still running", so one copy accumulates per update. On the reporting Mac, nine had built up since 2026-10-30.User Impact
On macOS, updates and
openclaw doctor --fixcan now reclaim abandoned updater runtimes while node hosts, the macOS app, its node worker, and helper programs the Gateway started are running. A process that references the copy still keeps it, and so does a CLI process whose command cannot be identified. The Doctor or updater doing the cleanup must contain this fix. It also reclaims copies left by older updaters.Why This Change Was Made
Without a path reference, the census counted every OpenClaw-looking process as a possible holder of every copy, because an updater creates its copy in-process before anything references it. Only the Gateway family was exempt. On the reporting Mac, the census (run read-only against a dummy path) named these as holders. All had readable working directories, and none were reported as "unknown":
node openclaw.mjs … node runlaunchers, plus the CLI child each starts, whose process title erases its argv toopenclaw. The node command never runs the updater.OpenClaw.app/Contents/MacOS/OpenClawmatched the CLI-name rule case-insensitively. The native app starts every CLI command,updateincluded, as a separate child.openclaw-node-worker.op daemon,keyboxdandadbinheritedOPENCLAW_SERVICE_MARKERfrom the Gateway service environment. The Darwin reader passed the marker for every executable. Linux reads it only for JS runtimes.The fix stays inside the census owner and the Darwin command reader:
node, alongsidegateway, counts as a command that never updates.openclaw-node-workertitle and the macOS app bundle's native executable count as non-updaters.openclawchild counts as a non-updater only when its live parent's intact argv names a non-updating command. Respawn and node-host launchers keep their argv for exactly this purpose.What still retains a copy:
update.runspawns one.updateanddoctorlaunchers.Platform scope: the command and launcher rules also apply on Linux and Windows, where the same processes exist. The app and marker rules apply only on macOS. The handoff branch is unchanged.
Evidence
Behavior checked. The repro uses a private temp dir as the projection root, a fixture package root with the real retained-runtime marker, the real
maintainRetainedUpdateRuntimescleanup as Doctor calls it, and processes the test spawned. The host's other processes stay visible, so the cleanup still refuses because of unrelated live update work on the host. The table shows which of the test's own PIDs the refusal names.Base
d0a5dbb9c13, unmodified census and reader (red):This branch (green):
Tests. Each new or changed case fails on base and passes here:
helperandOpenClaw.app/Contents/MacOS/OpenClaw. The Darwin reader reports a symlink exec's own path as the executable. No signed binary is copied or re-signed, because relocated copies fail code-signature validation and Gatekeeper rejects them.argv0. An app-shaped argv alone does not exempt a JS runtime.openclaw-node-worker.updatelauncher, a title-erased child of a titled Gateway, and anupdatelauncher.op daemonwith an inherited marker no longer reports it. JS runtimes still do.Results.
oxlint --type-awareis clean on the touched files.packages/ai/src/transports/openai-responses-websocket.ts.check-changedpasses every lane except the type-check and lint wrappers, which refuse this checkout's shared pnpm virtual store ("Declaration input escapes checkout"). I ran the linter and type checker directly instead.Known gaps.
service-child-relay,service-child-group-anchor, the OpenClaw ID tunnel child,tailscale-route-owner, and spawn-brokersqlite-readonly-locationworkers. With a Gateway running, they can still block reclamation. Exempting them needs per-entrypoint proof that they never reach the updater in-process, so I left that for a follow-up.Related: #200657 (Linux equivalent, merged) and #195162 (foreign-account unreadable cwd on Linux, a different rule; no overlap).