fix(device-selection): keep host env out of the request device cache key
Summary
A fresh open without --platform read the device inventory twice per request (simctl, devicectl, xctrace, adb): once for the request lock, once in the handler. Android SDK discovery adds ANDROID_HOME/PATH to the host env during the first read, and the request cache key serialized that env, so the second lookup missed. The key now omits env; its request part already holds every env-derived value. 2 files.
It hits the first unscoped open after prepare ios-runner --platform ios; in recorded agent runs those took 4.4–4.8 s for a ~0.9 s launch.
Validation
validation: CI. Head e92c0ce373; focused dispatch-resolve.test.ts 41/41. The new positive test fails on main (second resolution re-reads inventory); the new negative test fails if the allowlist leaves the key.
Simulator exec trace, warm open --udid without --platform, CLI and MCP alike: main 2 inventory reads (38 adb, 6 xcrun); fix 1 read plus a cache hit (19 adb, 5 xcrun).
Interleaved main/fix ratio (fix ÷ main, median of 3 pairs), measured under host load ~250–950 on 12 cores:
| Scenario | CLI | MCP |
|---|---|---|
warm open, no --platform | 0.74–0.80 | 0.94–1.02 |
warm open after prepare | 0.83 | 0.80 |
| cold first tap | 0.70 | 1.17 |
open --relaunch, live runner | 0.98 | 1.10 |
2nd session after close | 1.41 | 0.75 |
Only the first row's path changed; the others show load noise. A quiet-host re-measure is pending.
🤖 Generated with Claude Code