Repository navigation
fix(daemon): skip unreadable foreign LaunchDaemon plists in ownership scan - #120481
Conversation
|
CI blocker evidence for exact head
The patch remains unchanged. |
|
Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 3:43 AM ET / 07:43 UTC. ClawSweeper reviewWhat this changesThe PR changes macOS gateway ownership scans to skip unreadable foreign LaunchDaemon plist files while continuing to reject loaded or readable same-label system daemons. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessThis PR remains necessary and is correct under the recorded maintainer ruling: it removes a real macOS gateway install/repair blocker while deliberately accepting the narrow unloaded unreadable same-label daemon edge. No actionable review finding remains. Priority: P1 Review scores
Verification
How this fits togetherBefore OpenClaw installs or repairs its user LaunchAgent, it checks whether a system LaunchDaemon already owns the gateway. The scan’s decision either permits the user service lifecycle or prevents two gateway managers from running together. flowchart LR
A[Gateway install or repair] --> B[System daemon ownership scan]
B --> C[Loaded daemon probe]
C --> D[Readable plist scan]
D --> E{Ownership result}
E -->|No conflict| F[Write or restart user LaunchAgent]
E -->|Same-label conflict| G[Refuse duplicate manager]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +15, Tests +17, Generated 0. Total +32 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: 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 focused canonical Node-and-shell ownership change with the documented accepted tradeoff, preserving the existing loaded and readable same-label conflict protections. Do we have a high-confidence way to reproduce the issue? Yes, source reproducible: current main converts a plutil failure plus an existing unreadable plist into an ownership failure, while the exact-head tests exercise the new EACCES and chmod-000 paths. Is this the best way to solve the issue? Yes: under the explicit maintainer ruling, updating the canonical classifier and its shared shell renderer is the narrowest maintainable fix; a separate fallback or lifecycle-specific exemption would duplicate policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bf0aadbc40c2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
… scan inspectSystemLaunchDaemonOwnership raised SystemLaunchDaemonOwnershipError when any /Library/LaunchDaemons plist was unreadable, such as third-party VPN helper plists with mode 600. This broke gateway install/repair and launchd.integration.e2e on affected Macs. Unreadable plists are foreign by contract, while loaded same-label daemons remain caught by the bracketing launchctl probes.
faa612c to
6078d09
Compare
|
Maintainer ruling for #120481: the unreadable-plist skip is the intended product behavior. Loaded same-label daemons are caught by the bracketing The PR body’s Evidence section and both Node/shell skip-site comments now record this accepted tradeoff, following #119091’s precedent of skipping plists that cannot be shown to own the label. Accordingly, the findings and Before-merge moves requesting fail-closed restoration, privileged inspection, or an operator override are intentionally declined under the frozen maintainer decision; no other actionable move remains from this review. |
|
@clawsweeper re-review Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
… scan (openclaw#120481) * fix(daemon): skip unreadable foreign LaunchDaemon plists in ownership scan inspectSystemLaunchDaemonOwnership raised SystemLaunchDaemonOwnershipError when any /Library/LaunchDaemons plist was unreadable, such as third-party VPN helper plists with mode 600. This broke gateway install/repair and launchd.integration.e2e on affected Macs. Unreadable plists are foreign by contract, while loaded same-label daemons remain caught by the bracketing launchctl probes. * fix(ci): regenerate plugin-sdk api baseline after b1707c1 * test(doctor): scope gateway-bind persistence test to its writer seam Culprit: b1707c1. * docs(daemon): document unreadable plist tradeoff
What Problem This Solves
Ownership verification in
src/daemon/launchd-system.tsfailed closed on any unreadable plist in/Library/LaunchDaemons(observed:/Library/LaunchDaemons/com.nordvpn.macos.helper.plist,EACCES). That aborted the whole scan and causedwriteLaunchAgentPlist/installLaunchAgentto throwSystemLaunchDaemonOwnershipError, breaking all 6launchd.integration.e2etests on affected development Macs and realopenclaw gateway install/repairon end-user machines with third-party VPN or security software.The root cause was that
readLaunchDaemonPlistLabelfell back tofs.access(..., F_OK)—existence only—afterplutilfailed, so unreadable files were classified asunverifiable. The rendered shell probe inrenderSystemLaunchDaemonOwnershipShellProbehad the symmetric bug. This behavior was introduced in #97285.Why This Change Was Made
An unreadable plist cannot be actionably ours; a loaded same-label daemon is still caught by the
launchctl print system/<label>probes bracketing the filesystem scan. The Node path now checksR_OK, returns a distinctunreadablestatus, and skips that status infindInstalledSystemLaunchDaemon. The rendered shell probe likewise skips[ ! -r ]entries. Malformed-readable plists and other filesystem errors still fail closed.The sibling ownership check in
inspect.tsalready skips unreadable files throughreadUtf8File.launchd-restart-handoff.tsembeds the canonical renderer, so there is no duplicate implementation to update.User Impact
Gateway service install and repair no longer hard-fail on Macs with locked-down third-party LaunchDaemon plists. Loaded, installed, and malformed-readable conflicts retain their existing behavior.
Evidence
Regression coverage verifies that an unreadable foreign plist resolves to
absentwithout throwing, while an unreadable foreign plist followed by a readable same-label plist still reports the installed conflict. The rendered-probe harness also runs a realchmod 000fixture undersh.node scripts/run-vitest.mjs src/daemon/launchd-system.test.ts— 15/15 passedpnpm plugin-sdk:api:gen— regenerateddocs/.generated/plugin-sdk-api-baseline.sha256after culprit267268f646c(+1/-1)pnpm plugin-sdk:surface:check— passednode scripts/run-vitest.mjs src/commands/doctor-config-flow.gateway-bind-persistence.test.ts— 2/2 passed; Vitest 5.42s, wall 11.40s after scoping thelocalhostcase to the canonical migration/writer seam introduced by culprit267268f646cgit diff --check— cleangpt-5.6-sol, high) — cleanAccepted tradeoff: unreadable plists are treated as foreign. Loaded same-label daemons are caught by the bracketing
launchctl printprobes; an unloaded unreadable same-label plist is an accepted operator-created edge, consistent with #119091's precedent of skipping plists that cannot be shown to own the label.