Repository navigation
fix(updater): harden launchd replacement timing - #117030
fuller-stack-dev merged 5 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 5:52 PM ET / 21:52 UTC. ClawSweeper reviewWhat this changesThe PR hardens the macOS live updater by deriving Gateway shutdown proof from the LaunchAgent timeout, atomically replacing the plist, restoring the prior deployment after failure, and recording restart milestones. Merge readinessKeep this PR open. Current main still has the fixed 10-second native stopped-proof loop, while this branch adds the needed launchd-aware replacement and rollback transaction; no discrete patch defect was established in direct source review. It is maintainer-labeled and authored by a repository member, so it needs the normal exact-head CI completion and explicit maintainer merge decision rather than automated cleanup. Priority: P1 Review scores
Verification
How this fits togetherThe live updater maintains a macOS LaunchAgent that runs the Gateway. During an update it prepares a replacement, stops the old service, publishes the new plist, bootstraps the Gateway, and verifies readiness before scheduled maintenance continues. flowchart LR
A[Managed Gateway LaunchAgent] --> B[Updater preflight]
B --> C[Stop old launchd service]
C --> D[Publish replacement plist]
D --> E[Bootstrap new Gateway]
E --> F[Readiness and channel checks]
F --> G[Update result and timing log]
Decision needed
Why: The implementation changes the operator-visible recovery envelope for a managed Gateway update. The PR comments record a proposed evidence boundary, but the maintainer label and member authorship require a human merge judgment. Before merge
Agent review detailsSecurityNone. PR surfaceTests +559, Other +738. Total +1297 across 3 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the final exact head after required CI is green, retaining the bounded launchd stop window and the rollback-to-prior-deployment behavior tested by the focused suite and demonstrated by the PR’s native benchmark evidence. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible. Current main’s fixed 100-by-100 ms stopped-proof loop is visible in the updater, and the PR adds a focused slow-teardown regression case; no local execution was performed because this review checkout is read-only. Is this the best way to solve the issue? Yes, provisionally. The PR repairs the updater transaction at its owner boundary—preflight, native stop proof, atomic publication, restart verification, and rollback—rather than masking the failure with a downstream retry; final CI and maintainer acceptance remain the merge gate. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 383363e36233. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Landing evidence decision for the latest ClawSweeper rank-up move:
Maintainer direction is to land with that evidence boundary. The four new |
|
Maintainer landing decision for the July 31, 2026 ClawSweeper review:
This explicitly resolves the two operational merge-risk choices and records why the optional current-main refresh is not being applied. |
…ming-hardening # Conflicts: # .agents/skills/openclaw-live-updater/scripts/update-main.mjs # test/external-script-modules.d.ts # test/scripts/openclaw-live-updater.test.ts
|
Final-head refresh applied. The branch now contains current Exact final head: |
|
Merged via squash.
|
…odels-20260729 * origin/main: fix(tui): canonical terminal outcomes, cancellation, and error privacy (#117044) fix(cron): avoid phantom message tool guidance (#116908) fix(test): avoid macOS release gate deadlocks (#116972) fix(openai): canonical Chat cache-hit and billing accounting (#117043) fix(memory-wiki): salvage human Notes before pruning imported source pages (#102294) fix(memory): suggest reindex, not --fix, for a missing qmd index (#116958) chore(msteams): add private Gateway QA adapter fix(ui): make session controls and failures accessible (#117019) docs: fix tilde paths in CLI output examples (#114595) fix(plugins): canonical discovery diagnostics and deterministic lifecycles (#117025) fix(ui): honor Gateway readiness abort and subscription ownership (#117048) fix(updater): harden launchd replacement timing (#117030) fix(gateway): preserve static asset HEAD representation metadata (#117049) fix(gateway): abort embeddings when clients disconnect (#116146) fix(googlechat): retain fallback thread continuity (#117053)
* fix(updater): harden launchd replacement timing * fix(updater): recover failed launchd replacement
Summary
ExitTimeOut, with a bounded teardown margin and lower-frequency pollingbootout, then atomically publish it only after native process/listener stopped proofbootoutOPENCLAW_GATEWAY_STARTUP_TRACE=1for only the replacement bootstrap without leaving permanent launchd environment stateRoot cause
Wilfred's July 31 update had a managed plist with
ExitTimeOut=20, while the updater allowed only100 x 100ms(10 seconds) for native stopped proof. The Gateway closed its listener and logged clean shutdown in about 210ms, but launchd/process teardown exceeded 8-10 seconds, so the updater failed before launchd's own stop ceiling.The old updater also crossed the downtime boundary before all replacement validation was complete and did not restore the original plist/deployment after a post-
bootoutfailure. The canonical owner is the updater's launchd replacement transaction: preflight all fallible local work, prove the old native service stopped, atomically publish, and recover the previous deployment on failure.Behavior
ExitTimeOutvalues use the canonical 20-second defaultExitTimeOut=0and values above 300 seconds fail preflight rather than creating an unbounded maintenance waitbootoutfailure stops a partial replacement, restores the original plist, bootstraps the prior deployment, and proves/readyzbefore returning the primary errorNative before/after benchmark
This benchmark used disposable, uniquely labeled macOS LaunchAgents with
ExitTimeOut=20, reallaunchctl bootstrap/bootout/print, real TCP listeners, andlsofobservation. The synthetic Gateway closed its listener about 202-203 ms afterSIGTERM; process teardown was configured independently. Every profile ran both normally and undernice -n 15.Slow teardown: 15 seconds
The baseline failed all 10 trials at its fixed proof ceiling after about 12.89 seconds and never started the replacement. The repaired flow completed all 10 trials, observing process exit at about 15.0 seconds. This is a reliability improvement, not a claim that launchd itself shuts down faster; proof polling work fell by about 45%.
Fast teardown: 250 ms
The fast-path control stayed successful in all 12 trials. The repaired proof used two polling attempts instead of three; observed overhead remained small relative to the correctness window.
Raw evidence:
ai.openclaw.gatewayPID, listener, and plist SHA-256 were identical before and after the runced944926dbddc6ef5adfd24408e98967955f46b28b3fc7e31e28716505a1963508062e323aee08847bfab10f22e87db25a8cdd0a45323ca98e3732093cd111912f17d3a441956f2d79c4ec594172062d61a3fba3d6fc6f4c43d8b044802b926Validation
Exact proposed head:
eac016a572cc37619d6fd7f0d17336f10bd39c93tbx_01kyx1wthf8jxmgkw6nttvtsjjtbx_01kywyt7b02m4dr0m196b4tebv$autoreview: clean on the conflict-resolved updater delta, no actionable findingsgit diff --check, script syntax, and targeted formatting passedThe computational remote proof ran through Blacksmith Testbox. The native launchd benchmark ran on an isolated local macOS host because the direct brokered AWS macOS Crabbox route lacked an active Crabbox broker access login. It is native macOS
launchdproof, not a simulated process-only test.Duplicate search
Live GitHub PR and issue searches immediately before this update found no open work directly covering
update-main.mjslaunchd stopped-proof timing, reversible plist publication, or post-bootoutrecovery.Notes