fix(simulator): prefer Device Hub for simulator UI#479
Conversation
Open Device Hub for visible simulator workflows when available, with Simulator.app as the compatibility fallback. Target the selected simulator by UDID and drive keyboard controls through Device Hub's menus.
commit: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a4e7380. Configure here.
There was a problem hiding this comment.
Pull request overview
This PR updates simulator “visibility” workflows to prefer Xcode 27’s Device Hub as the primary simulator frontend (with Simulator.app as a fallback), and adjusts simulator keyboard-control automation to route through the selected frontend while keeping headless behavior unchanged.
Changes:
- Added a new “simulator frontend” selection/opening abstraction (Device Hub first, Simulator.app fallback) and wired it into
open_simandbuild_run_sim. - Updated simulator-management keyboard shortcut automation to use Device Hub when available, with test updates across the simulator-management suite.
- Updated Claude UI benchmark simulator lifecycle + preflight focus commands to open the preferred frontend and added supporting benchmark helper code.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/focus-policy.ts | Adds frontend candidate building + “open frontend” helper with Device Hub preference and headless skip. |
| src/utils/tests/focus-policy.test.ts | Adds coverage for frontend command selection and open/fallback behavior. |
| src/server/server.ts | Updates embedded guidance text to reflect “simulator frontend” terminology. |
| src/mcp/tools/simulator/open_sim.ts | Switches tool implementation from opening Simulator.app to opening the preferred frontend. |
| src/mcp/tools/simulator/build_run_sim.ts | Uses preferred frontend opening (best-effort) after booting the simulator. |
| src/mcp/tools/simulator/tests/open_sim.test.ts | Updates expectations to Device Hub being attempted first. |
| src/mcp/tools/simulator-management/_keyboard_shortcut.ts | Routes keyboard shortcuts through Device Hub when available; retains Simulator.app scripting as fallback. |
| src/mcp/tools/simulator-management/tests/toggle_software_keyboard.test.ts | Updates assertions to validate Device Hub shortcut scripting. |
| src/mcp/tools/simulator-management/tests/toggle_connect_hardware_keyboard.test.ts | Updates assertions to validate Device Hub shortcut scripting. |
| src/mcp/tools/simulator-management/tests/_keyboard_shortcut.test.ts | Updates FIFO expectations for Device Hub attempt/fallback and revised scripting. |
| src/benchmarks/claude-ui/simulator-lifecycle.ts | Replaces direct Simulator.app open logic with benchmark frontend opener. |
| src/benchmarks/claude-ui/simulator-frontend.ts | New benchmark helper to open preferred frontend with retries + logging. |
| src/benchmarks/claude-ui/preflight-commands.ts | Injects frontend focus commands using `open … |
| src/benchmarks/claude-ui/tests/simulator-lifecycle.test.ts | Updates expected open commands/events to Device Hub selection URL. |
| src/benchmarks/claude-ui/tests/simulator-existing-lifecycle.test.ts | Updates expected open commands and adds Device Hub unavailable fallback coverage. |
| src/benchmarks/claude-ui/tests/preflight-commands.test.ts | Updates expected injected focus commands to include Device Hub URL + fallback. |
| manifests/tools/toggle_software_keyboard.yaml | Updates tool description to remove Simulator.app-specific shortcut wording. |
| manifests/tools/toggle_connect_hardware_keyboard.yaml | Updates tool description to remove Simulator.app-specific shortcut wording. |
| manifests/tools/open_sim.yaml | Updates tool description to “simulator frontend” terminology. |
| manifests/tools/build_run_sim.yaml | Updates tool description (but still attempts frontend opening in code). |
| CHANGELOG.md | Adds unreleased fix entry describing Device Hub preference + fallback behavior. |
| .axe-version | Bumps bundled AXe version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Summary
Validation
npm run lint:fixnpm run lint(107 existing warnings, 0 errors)npm run typechecknpm run formatnpm run format:checknpm run buildnpm test(2,893 tests passed)Snapshot and smoke suites were not run locally because repository policy requires explicit approval.
Compatibility note
The Device Hub selection URL
devices:///manage/select?id=<UDID>is private and undocumented. It was verified against Xcode 27 beta 4: Device Hub accepted the URL and requested interaction for the specified simulator. If Device Hub cannot open, XcodeBuildMCP falls back to Simulator.app.