Repository navigation
fix(device-selection): keep host env out of the request device cache key - #4464
Conversation
Android SDK discovery adds ANDROID_HOME, ANDROID_SDK_ROOT and PATH to the host env during the first inventory read. The request-scoped resolution cache keyed on the serialized env, so the open handler missed the selection the request lock had just made and read the whole inventory again: simctl, devicectl, xctrace and adb. The request part of the key already holds every value selection derives from env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…entries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
Apex SentinelVerdict: No findings. 1 finding below Reviewed with this repository's own Sentinel configuration ( Feedback goes in the review comment threads, as a reply under the inline comment of a finding: Reply Useful? Reply Comment |
|
I found no problems in e92c0ce. The change touches only dispatch-resolve.ts and its unit test, and tracing the request device key before and after shows the host env no longer reaches it. All 20 checks pass, and no conflicts are known. I did not run the two new tests myself, and I did not reproduce the exec counts (38 to 19 adb, 6 to 5 xcrun) or the timing table. The PR already calls the timings load-noisy, so a quiet-host re-measure is still worth posting. I also did not check future callers that might pass a different env to the same request scope. Today the daemon passes one env, so that case does not occur on the audited routes. Nothing from review holds this back, so it can merge when you decide. |
Summary
A fresh
openwithout--platformread the device inventory twice per request (simctl, devicectl, xctrace, adb): once for the request lock, once in the handler. Android SDK discovery addsANDROID_HOME/PATHto the host env during the first read, and the request cache key serialized that env, so the second lookup missed. The key now omitsenv; itsrequestpart already holds every env-derived value. 2 files.It hits the first unscoped
openafterprepare 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 e92c0ce; focused
dispatch-resolve.test.ts41/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 --udidwithout--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:
open, no--platformopenafterprepareopen --relaunch, live runnercloseOnly the first row's path changed; the others show load noise. A quiet-host re-measure is pending.
🤖 Generated with Claude Code