Repository navigation
fix(update): repair cannot settle cancelled update custody on macOS, blocking every later update - #185002
Conversation
Three faults kept a dead updater's cancelled custody from ever settling: - A macOS Gateway LaunchAgent runs with TMPDIR=<state>/tmp while terminals use the OS per-user temp directory, so the Gateway and CLI opened different managed-update-handoffs.sqlite stores and repair "succeeded" against an empty one. The Gateway's managed TMPDIR now maps back to the OS per-user temp root (getconf DARWIN_USER_TEMP_DIR), shared by terminals and every profile; other explicit TMPDIRs are still honored. Repair also settles custody left in an earlier Gateway's store and scans its handoff artifacts. - The repair census reported the inspecting process's own descendants (e.g. its spawn-broker worker) as handoff work. Start-ordered native ancestry through the inspector now exempts them. - The census blocked on every OpenClaw process running from the installation, even ones started days later. A match only on shared installation/service roots or OpenClaw identity is exempt when the process and its live ancestry started after the family's recovery deadline (latest activity plus grace). Run ids, run-specific artifacts and candidate roots still always block. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🦞👀 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 changesThis PR unifies macOS update custody storage and excludes repair-owned or demonstrably newer processes from recovery blockers. Example: An October 16 cancelled updater has exited, while the Gateway was started again on October 26.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR fixes a concrete macOS update-recovery failure, and the previously reported code defects are addressed. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherCLI and Gateway update admission use installation leases in SQLite; explicit repair checks recorded processes, retained artifacts, and recovery history before settling abandoned custody. flowchart TD
A[Terminal update or Gateway request] --> B[Earlier store admission]
B --> C[Shared per-user lease store]
D[Explicit update repair] --> B
D --> C
D --> E[Process census and recovery history]
E --> F[Settlement receipt]
F --> C
Technical reviewBest possible solution: Keep the existing lease owners and focused process exclusions, with verified macOS upgrade and recovery behavior before merge. Do we have a high-confidence way to reproduce the issue? Current main derives lease placement from os.tmpdir(), while macOS services install a state-local TMPDIR; the supplied regressions also identify inspector descendants and newer shared-root processes as false recovery blockers. Is this the best way to solve the issue? The repair uses existing lease admission and settlement owners, preserves run-specific blockers, and limits the storage adjustment to macOS managed TMPDIR placement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d209419bb9ef. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +231, Tests +493, Docs +15, Other +3. Total +742 across 23 files. Added test files: 0. View PR surface stats
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 HistoryReview history (3 earlier review cycles)
Reviewed October 26, 2026, 6:38 PM ET / 22:38 UTC (Revision 4). |
The trusted-anchor PR wrapper extracts only its inventoried runtime files, and the handoff lease now imports the service temp-root and lease temp-root modules. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Moving a macOS Gateway's lease store to the per-user temp root must not let ordinary update admission bypass custody that an earlier Gateway still holds under its state's tmp. Admission now refuses while that store holds live owners, unsettled children, or cancelled (v4) custody, and points to `openclaw update repair`, which settles it there. Stale leases whose owners are proven gone no longer block, because new writers never select that store. Native census fixtures now kill and join every descendant they start, and the repair test no longer asserts the mocked census call shape. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks. Each finding is addressed on head
Data compatibility: the admission test above is the existing-store proof. I haven't run a shipped-CLI macOS upgrade end to end. @clawsweeper re-review 🤖 Addressed by Claude Code |
|
🦞👀 Re-review progress:
|
The admission check for an earlier macOS Gateway's handoff store treated an owner whose identity could not be read as gone, and missed retained v3 custody, original-updater custody and unfinished repair claims. Admission now takes the installation in that store through its own admission rules, which require positive proof of settlement, and holds it until the shared store has admitted or refused this update. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Re-review finding (P1, legacy admission predicate) is addressed on head
CI note: @clawsweeper re-review 🤖 Addressed by Claude Code |
|
🦞👀 Re-review progress:
|
…lper starts A Gateway-initiated update hands off to a sealed helper that acquires the lease directly in the shared store, so the earlier-store fence in ordinary admission did not cover it. The Gateway now applies the same owner-decided fence before spawning the helper and refuses while that store still holds the installation. The helper control request moves beside the active-handoff state it reads, so the oversized handoff module does not grow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The finding on
The @clawsweeper re-review 🤖 Addressed by Claude Code |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…blocking every later update (openclaw#185002) * fix(update): let repair settle cancelled custody on macOS Three faults kept a dead updater's cancelled custody from ever settling: - A macOS Gateway LaunchAgent runs with TMPDIR=<state>/tmp while terminals use the OS per-user temp directory, so the Gateway and CLI opened different managed-update-handoffs.sqlite stores and repair "succeeded" against an empty one. The Gateway's managed TMPDIR now maps back to the OS per-user temp root (getconf DARWIN_USER_TEMP_DIR), shared by terminals and every profile; other explicit TMPDIRs are still honored. Repair also settles custody left in an earlier Gateway's store and scans its handoff artifacts. - The repair census reported the inspecting process's own descendants (e.g. its spawn-broker worker) as handoff work. Start-ordered native ancestry through the inspector now exempts them. - The census blocked on every OpenClaw process running from the installation, even ones started days later. A match only on shared installation/service roots or OpenClaw identity is exempt when the process and its live ancestry started after the family's recovery deadline (latest activity plus grace). Run ids, run-specific artifacts and candidate roots still always block. * fix(update): ship the macOS lease temp-root modules with the PR wrapper The trusted-anchor PR wrapper extracts only its inventoried runtime files, and the handoff lease now imports the service temp-root and lease temp-root modules. * fix(update): keep an earlier Gateway's custody fencing admission Moving a macOS Gateway's lease store to the per-user temp root must not let ordinary update admission bypass custody that an earlier Gateway still holds under its state's tmp. Admission now refuses while that store holds live owners, unsettled children, or cancelled (v4) custody, and points to `openclaw update repair`, which settles it there. Stale leases whose owners are proven gone no longer block, because new writers never select that store. Native census fixtures now kill and join every descendant they start, and the repair test no longer asserts the mocked census call shape. * fix(update): let the earlier Gateway store's owner decide its custody The admission check for an earlier macOS Gateway's handoff store treated an owner whose identity could not be read as gone, and missed retained v3 custody, original-updater custody and unfinished repair claims. Admission now takes the installation in that store through its own admission rules, which require positive proof of settlement, and holds it until the shared store has admitted or refused this update. * fix(update): fence earlier Gateway custody before a Gateway update helper starts A Gateway-initiated update hands off to a sealed helper that acquires the lease directly in the shared store, so the earlier-store fence in ordinary admission did not cover it. The Gateway now applies the same owner-decided fence before spawning the helper and refuses while that store still holds the installation. The helper control request moves beside the active-handoff state it reads, so the oversized handoff module does not grow.
Related: #177932, #182774, #182762
What Problem This Solves
Fixes: cancelled update custody cannot be settled on macOS, so
openclaw updatestays blocked indefinitely. Three separate faults combine:openclaw update repairfrom a terminal opens a different handoff store than the Gateway. It reports success against an empty store and leaves the real custody in place.User Impact
User impact: on macOS,
openclaw update repairsettles a dead updater's cancelled custody without stopping the Gateway, node hosts, or the Mac app, and the next update proceeds. Real survivors of the cancelled update still block repair.Why This Change Was Made
TMPDIR=<state>/tmp, while terminals use the OS per-user temp directory, so the lease path<os.tmpdir()>/openclaw-<uid>/managed-update-handoffs.sqlitesplit between them. When the caller'sTMPDIRis exactly the Gateway's managed one, the lease now resolves undergetconf DARWIN_USER_TEMP_DIRinstead. That is the directory terminals already use, so the Gateway, terminals, and every profile share one store. Any other explicitTMPDIR(including the test runner's private one) is still honored, and Linux and Windows are unchanged. Terminal update admission, and a Gateway update before it spawns its helper, also take the installation in the store an earlier Gateway kept under<state>/tmp, using that store's own admission rules. Terminal admission holds that lease until the shared store admits or refuses the update. Live, unproven, retained, original-updater and cancelled custody there keep blocking;openclaw update repairsettles cancelled custody there. On macOS, repair's handoff-artifact scan also includes the Gateway'sTMPDIR.process.pidand verified updater launchers. It now also exempts processes whose start-ordered native ancestry (readProcessAncestry) runs through the inspecting process.systemd --usermanager) started after the family's recovery deadline: latest recorded activity plus the existing repair grace (45 minutes, or a longer recorded timeout). Matches on the run id, the handoff directory, captures, or candidate/child roots block regardless of start time. Unreadable or incomplete ancestry proves nothing and keeps blocking.Evidence
Red on unmodified
origin/main(d704d3b, new tests only), green on this branch:update-managed-service-handoff-lease-path.test.ts). They now share one, across profiles. An unrelated explicitTMPDIRkeeps its own root.status: "ok"and left every row. Now admission is refused until repair settles the family, and the next update is admitted afterwards. A live owner, or dead original-updater custody, in that store also refuses admission (update-repair-cancellation.test.ts). A Gateway update start is refused before any helper runs (update-managed-service-handoff-busy.test.ts). With the admission check removed, the same test fails withpromise resolved "'admitted'".openclaw-process-census.native.test.ts, macOS).Checks on this head's content:
pnpm tsgo:core,pnpm tsgo:core:test, oxlint and oxfmt are clean. The census, lease-path, repair-cancellation, cleanup-unmanifested and handoff-isolation files pass on macOS (183 tests). A snapshot of the real per-user lease directory taken before and after a full macOS run of the related suites was unchanged, so tests stay in their private stores. Independent Codex review (GPT-6.1 Sol, P0–P2) is scoped-clean on the committed branch. An earlier pass flagged that a first, state-dir-anchored version split custody across profiles, which led to the current design.Not run locally: e2e suites, which refuse this machine's shared pnpm store layout. CI covers them.
🤖 Generated with Claude Code