[Bug]: Keyboard toggle tools silently do nothing on Xcode 27 — System Events cannot attach to Device Hub
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- macos, typescript
Hướng nghiên cứu
Start by reading buildDeviceHubKeystrokeScript and _keyboard_shortcut.ts, then reproduce the reported osascript behavior with Device Hub visible. Trace the Device Hub branch alongside the Simulator.app window check and buildOpenSimulatorFrontendCommands. Done means the keyboard toggle tools use a supported interaction path or clearly report failure instead of returning success when the action has no effect.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
toggle_connect_hardware_keyboard and toggle_software_keyboard return success but change nothing on Xcode 27.
Both tools drive the simulator frontend through System Events. On Xcode 27 the frontend is Device Hub, and System Events cannot attach to it. The keystroke never arrives. osascript exits 0, so sendKeyboardShortcut reports success.
Root cause: Device Hub has no accessibility tree
Run these in the same shell, with Device Hub on screen showing a booted simulator:
$ osascript -e 'tell application "System Events" to return (count of attributes of application process "Device Hub")'
0
$ osascript -e 'tell application "System Events" to return (count of attributes of application process "Finder")'
20
Device Hub exposes zero accessibility attributes. Finder, as a control, exposes 20. UI elements enabled is true, so this is not a permissions problem.
Window and menu queries return nothing:
$ osascript -e 'tell application "System Events"
set p to first application process whose bundle identifier is "com.apple.dt.Devices"
return "windows: " & (count of windows of p) & ", menu bars: " & (count of menu bars of p)
end tell'
windows: 0, menu bars: 0
That output is from a moment when Device Hub had a visible device window on screen. For the same process, background only is false and visible is true. lsappinfo reports !cgsConnection, bundle path=[ NULL ], Arch=!!none.
In buildDeviceHubKeystrokeScript, this means set frontmost of deviceHubProcess to true has no effect and the following keystroke goes nowhere.
The Device Hub branch does not detect the failure
The Simulator.app path checks for a window first:
if (focusResult.output.trim() === 'NO_WINDOW') {
return {
success: false,
error: `No visible Simulator window found for "${device.name}". ...`,
};
}
The Device Hub path has no equivalent check. It returns { success: true } whenever osascript exits 0.
The shortcut mapping is also stale
_keyboard_shortcut.ts sends the same shortcuts to both frontends:
const modifiers =
shortcut === 'connect-hardware-keyboard' ? '{command down, shift down}' : '{command down}';
#346 describes these as Simulator.app bindings. Device Hub uses a different mapping under Device > Keyboard:
| Menu item | Shortcut |
|---|---|
| Keyboard Capture | ⌘K |
| Simulate Hardware Keyboard | none |
| Toggle Software Keyboard | ⌥⌘K |
⇧⌘K matches no item. ⌘K opens Keyboard Capture, not the software keyboard.
Fixing the mapping alone does not help, because the accessibility path is unavailable either way.
The menu works through synthetic mouse events
To confirm the menu item itself is functional, I drove it with CoreGraphics-level clicks instead of System Events:
- Opened Device > Keyboard. All three items rendered.
Simulate Hardware Keyboardwas checked. - Clicked
Simulate Hardware Keyboard. Reopened the menu. The checkmark was gone. - Tapped a text field in the booted simulator and captured
snapshot_ui.
| Before toggle | After toggle |
|---|---|
| 82 elements, no keyboard | 152 elements, including Q, W, shift, space, return |
The menu item is reachable and effective. Only the accessibility route is blocked.
ConnectHardwareKeyboard is not a fallback
#346 lists defaults write com.apple.iphonesimulator ConnectHardwareKeyboard as an alternative. That domain belongs to Simulator.app, which Xcode 27 does not ship:
$ ls /Applications/Xcode.app/Contents/Applications/
Accessibility Inspector.app Create ML.app DeviceHub.app
FileMerge.app Icon Composer.app Instruments.app
The key does not track the setting. With Simulate Hardware Keyboard checked, it read 0. After toggling the menu item, the key was absent from the domain.
com.apple.dt.Devices holds no keyboard key. No xcrun simctl subcommand exposes the setting; simctl ui covers only appearance, content_size, and increase_contrast.
Notes on reproducing
open_sim does not open a device window. Its schema is z.object({}), so no simulatorId reaches buildOpenSimulatorFrontendCommands and it runs open -a DeviceHub. open "devices:///manage/select?id=<UDID>" did not open one either.
What I did not test
I did not call the MCP tools directly, because simulator-management is not enabled in this project. I reproduced buildDeviceHubKeystrokeScript with osascript and observed no effect on either preference domain.
I cannot tell whether the missing accessibility tree is universal to Device Hub on Xcode 27 or specific to this machine.
Environment
- XcodeBuildMCP 2.7.0
- Xcode 27.0 (27A266a)
- macOS 27.0
- Frontend: Device Hub (
com.apple.dt.Devices)
- Ngôn ngữ chính
- TypeScript
- Star
- 6.4k
- Fork
- 320
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/XcodeBuildMCP
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
getsentry/XcodeBuildMCP#520 ·
-
Warden weekly sweep Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
getsentry/XcodeBuildMCP#495 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
getsentry/XcodeBuildMCP#537 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
getsentry/XcodeBuildMCP#534 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
getsentry/XcodeBuildMCP#533 ·
Tất cả issue của getsentry/XcodeBuildMCP
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/claude-code#96687 ·
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
AOSSIE-Org/DebateAI#582 · 2 bình luận ·