fix(computer-use): never expose the host process as a root - #337
Merged
Merged
Conversation
In-process accessibility queries run tcode's own accessibility callbacks on the calling tokio thread, which panics inside the extern "C" boundary and aborts the app (observed as SIGABRT when observe_ui targeted tcode's own window). Exclude the host pid from root enumeration and reject an explicit pid filter for it with a clear message.
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
computer_useobserving tcode's own window crashed the app with SIGABRT: AppKit serves in-processAXUIElementCopyAttributeValueon the calling tokio thread, which invokes gpui's accessibility callbacks off the main thread; the resulting panic crosses anextern "C"boundary and aborts.list_roots(the single source of every root ref, including the frontmost fallback and--cu-smoke), skip own windows on macOS before any AX query, and return a clear error whenfind_rootsis called with the host pid.Test plan
cargo fmt --all --checkcargo clippy -p computer-use-mcp --all-targets --locked -- -D warningscargo test -p computer-use-mcp --locked(42 passed)