Repository navigation
fix(macos): prevent launchd ghosting on cache wipe and force install - #180307
avnishkirnalli wants to merge 1 commit into
Conversation
|
🦞👀 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. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Codex review: needs real behavior proof before merge. What this changesThis PR adds label-based LaunchAgent teardown, permits reinstalling loaded services with missing plists, and deletes macOS Application Support directories during state uninstall. Example: gui/501/ai.openclaw.gateway remains loaded after its plist is deleted.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 10 items remain Keep this PR open for the documented recovery problem, but repair its service-loss, lifecycle-guard, profile-isolation, and data-preservation regressions before merging. Priority: P1 Decision needed
Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherThe macOS app invokes the CLI service lifecycle, whose owners coordinate launchd mutations, runtime intent, and rollback; uninstall separately removes explicitly selected local data. flowchart TD
A[macOS app] --> B[Gateway CLI]
B --> C[Service mutation guards]
C --> D[LaunchAgent transaction]
D --> E[launchd]
F[Uninstall command] --> G[Selected data cleanup]
A --> E
Technical reviewBest possible solution: Recover deleted artifacts through the existing guarded lifecycle and an in-app Repair action while preserving rollback, profile isolation, and selected data scopes. Do we have a high-confidence way to reproduce the issue? Source confirms missing-plist install refusal and teardown skipping; the screenshots establish retained-environment failure, while permanent BTM corruption remains unverified. Is this the best way to solve the issue? Label-based teardown belongs in the existing lifecycle owner, but destructive snapshot capture, direct Swift mutation, and global data deletion do not form a safe complete recovery. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8d6cb3d4d4bb. TestingProof path: none. SecurityNeeds attention: The added native bootout bypasses the existing service-operation ownership boundary. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +50. Total +50 across 3 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 October 22, 2026, 1:05 AM ET / 05:05 UTC. |
…nd uninstall (#180390) Fixes #180301. After the launchd plist disappeared (for example a cache clear), the macOS app skipped uninstall and CLI install refused the surviving registration, so the Gateway could not be reinstalled. Recovery now boots out the service by label at the daemon owner and the app delegates there; existing plist and environment backups keep rollback protection. Supersedes #180307, thanks @avnishkirnalli. Co-authored-by: Avnish Kirnalli <[email protected]>
|
Thank you @avnishkirnalli, both for the report and the fix! We re-implemented it in #180390: label-based bootout recovers the ghost registration in both the app and the CLI, and plist backups still protect rollback. It landed with you credited as co-author. Closing this one as superseded. |
…nd uninstall (openclaw#180390) Fixes openclaw#180301. After the launchd plist disappeared (for example a cache clear), the macOS app skipped uninstall and CLI install refused the surviving registration, so the Gateway could not be reinstalled. Recovery now boots out the service by label at the daemon owner and the app delegates there; existing plist and environment backups keep rollback protection. Supersedes openclaw#180307, thanks @avnishkirnalli. Co-authored-by: Avnish Kirnalli <[email protected]>
…nd uninstall (#180390) Fixes #180301. After the launchd plist disappeared (for example a cache clear), the macOS app skipped uninstall and CLI install refused the surviving registration, so the Gateway could not be reinstalled. Recovery now boots out the service by label at the daemon owner and the app delegates there; existing plist and environment backups keep rollback protection. Supersedes #180307, thanks @avnishkirnalli. Co-authored-by: Avnish Kirnalli <[email protected]> Release adaptation: the stable line keeps the standalone getGatewayServiceAutoRefreshMessage helper and inline bootstrap calls, so the missing-definition refresh message and restoreLoaded gate were applied there without main's helper restructuring. Main's launchd tests use fixtures absent on this line; the deleted-plist install/uninstall cases were ported into launchd.test.ts (launchd-missing-plist.test.ts dropped), the real-launchd e2e case was rewritten with the baseline helpers, and only the macOS paragraph was added to docs/install/updating.md. (cherry picked from commit f620293)
Closes #180301
What Problem This Solves
Fixes: the local gateway becoming permanently unrecoverable when a macOS user manually deletes their
~/.openclawor LaunchAgent.plistfiles.User Impact
User impact: macOS users can now successfully recover and reinstall the local gateway after a manual cache wipe without being permanently blocked by hidden OS registry ghosting.
Why This Change Was Made
The app previously assumed a loaded macOS
launchdservice would always have a corresponding.plistfile on disk, which caused--forceinstalls to crash and UI uninstalls to skip thebootoutstep if the cache was wiped. This change decouples the OS-level teardown from the file's existence, forcing alaunchctl bootouton the target label directly so the Background Task Management (BTM) registry is cleanly flushed. It also explicitly clears the~/Library/Application Support/OpenClawdirectories during uninstall to prevent hidden state retention.Evidence
openclaw gateway install --forcesuccessfully flushes a ghostedlaunchdenvironment without throwing a missing-plist error.openclaw uninstallproperly clears all macOS Application Support directories (~/Library/Application Support/OpenClaw).launchctl bootouton the service label during a teardown even when the.plistfile is manually deleted.pnpm vitest run src/commands/uninstall.test.tspasses with the new macOS directory cleanup assertions.