fix(cua-driver): keep macOS daemon stable during permission setup - #3314
Open
injaneity wants to merge 5 commits into
Open
fix(cua-driver): keep macOS daemon stable during permission setup#3314injaneity wants to merge 5 commits into
injaneity wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
execvprestart loopCloses #3300
root cause
AXIsProcessTrustedandCGPreflightScreenCaptureAccesscache negative results per process. The permission gate previously cleared those caches by replacing the whole daemon process. Since #1773, that process already owned the public socket, so each planned refresh destroyed accepted connections and produced an EOF.architecture
The daemon is the stable control plane. It binds once and never performs a negative TCC preflight while gated. A hidden finite entry point runs before normal CLI initialization; the gate starts a fresh signed child for each status poll and for the one prompt request. Those children can observe current TCC state without poisoning the process that later runs desktop tools.
While probes are pending, the daemon remains discoverable but no tool action starts. Calls receive
permissions_pendingwith exit code 75 through the existing response protocol. Once a fresh child confirms both grants, the same daemon generation enables dispatch. If a helper cannot start or return valid status, the daemon fails closed and remains gated.This removes the gate re-exec loop rather than masking its transport failure. The probe implementation remains macOS-specific; it does not add a speculative cross-platform lifecycle framework.
validation
cargo fmt --all -- --checkcargo check -p platform-macos -p cua-driver --testscargo test -p platform-macos permissions::gate::tests --lib— 13 passedcargo test -p cua-driver permission_gate_routing_tests --bin cua-driver— 2 passeddiff scope
The final diff touches five files with 194 insertions and 278 deletions. Most deleted lines are the old re-exec state machine. No daemon protocol or MCP proxy types change.
known gaps
The draft has focused compile, routing, gate, and helper-entry coverage. It remains draft until the destructive TCC-reset reproduction is run in a disposable logged-in macOS environment and the canonical Lume harness certifies the final candidate.