Repository navigation
fix(macos): preserve externally owned Gateways in attach-only mode - #128134
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 3:44 AM ET / 07:44 UTC. ClawSweeper reviewWhat this changesThe PR makes macOS attach-only mode suppress launch-agent installation and removal so an externally managed local Gateway remains outside app lifecycle control. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessThe patch is the correct owner-boundary repair: current main still lets attach-only shutdown reach launchd uninstall, while the branch prevents every mutation. It remains open for maintainer proof judgment because it is maintainer-labeled and the supplied evidence lacks an after-fix real macOS launchd trace. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe macOS app maps startup, pause, shutdown, and connection-mode changes to launchd Gateway commands. Attach-only mode records that the Gateway is externally owned, so the launch-agent manager must avoid install, uninstall, and restart mutations. flowchart LR
A[Mac app lifecycle] --> B[Launch-agent manager]
C[Attach-only ownership marker] --> B
B --> D{App owns Gateway?}
D -->|yes| E[Install remove restart]
D -->|no| F[Skip launchd mutation]
E --> G[Local Gateway service]
Decision needed
Why: The patch is source-correct, but repository policy treats native user-visible lifecycle proof as the stronger pre-merge evidence and the persistent marker changes removal semantics. Before merge
Agent review detailsSecurityNone. PR surfaceOther +10. Total +10 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the manager-level fence after a real macOS attach-only trace confirms shutdown or remote transition leaves the external launch agent intact while unmarked remote cleanup still removes an app-managed agent. Do we have a high-confidence way to reproduce the issue? Yes—current main's marker guard excludes only enabled calls, and shutdown calls the false branch that reaches uninstall; the branch regression would fail before the guard becomes unconditional. Is this the best way to solve the issue? Yes—the launch-agent manager owns every relevant mutation, and the existing remote-mode test confirms the repair does not suppress normal app-managed cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 87d49a3dcaf0. LabelsLabel changes:
Label 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
History |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where operators running the macOS app in documented attach-only mode could have their externally owned Gateway uninstalled when the app paused, stopped, or switched connection modes.
Why This Change Was Made
The launch-agent lifecycle owner honored the persistent attach-only marker for installation and restart, but accidentally allowed its destructive uninstall branch through. Apply the existing ownership fence to every launch-agent mutation so an external Gateway remains outside the app's lifecycle authority.
User Impact
Attach-only mode now preserves externally managed Gateways across app shutdown, pauses, and local-to-remote transitions. Regular app-managed Gateway installation, removal, restart, and profile ownership continue to behave as before.
Evidence
[["uninstall"]]and the regression failed.GatewayLaunchAgentManagerTests,GatewayProcessManagerTests, andGatewayAutostartPolicyTestspass, including remote-mode removal for normally managed Gateways.