fix(devices): keep the device list when AVD enumeration fails - #11649
thelonewander3r wants to merge 1 commit into
Conversation
`fetchDevices` turned any non-zero exit from `emulator -list-avds` into a `DeviceOperationError`, discarding the simulators and emulators the hub had already returned and marking the whole host failed. The hub reports its own per-backend problems through `detail` while still returning what it found, so one platform's toolchain being broken should not be the exception. Collect the failure into the same `detail` channel instead. The host stays ready, the platforms that do work keep listing, and the message names Android as the part that failed rather than leaving the user with an exit code. Exit 127 is ProcessRunner's code for a spawn that never happened, so it is reported as the emulator command not starting rather than as an exit status. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This narrowly scoped device-discovery fix preserves working device results when AVD enumeration fails and surfaces an actionable diagnostic instead of failing the entire host. The behavior is isolated to existing error handling and is covered by focused tests. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
ChangesAVD failure handling
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to AVD enumeration failures now leave other discovered devices available and provide actionable status details. No actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
What Changed
fetchDevicesno longer returns aDeviceOperationErrorwhenemulator -list-avdsexits non-zero. The failure is collected into the samedetailchannel the hub's own errors already use, and the devices gathered before it are returned.Why
The hub reports per-backend problems through
list.errorswhile still returning whatever it found, andrefreshforwards those intohostStatuses[hostId].detailwith the host stillready. The AVD call was the one place that escalated instead:That throws before
publishever runs, so a broken Android toolchain takes down the entire list — the iOS simulators already fetched are discarded, the host is markedfailed, and the UI keeps showing stale devices with no indication which platform actually broke. The user-visible result is "Device list failed: The device command failed (exit code 127)" and nothing else.Degrading keeps the working platforms listing and names Android as the part that failed.
Exit 127 gets its own message: that code comes from
ProcessRunnerwhen the spawn never happened, so there is no exit status worth showing and the stderr behind it is an internal error type. Other codes came from the emulator itself, where the first line of stderr is usually the whole explanation.Tests
Two cases in
DeviceService.test.ts: a spawn failure (127) and a real emulator failure (exit 2 with stderr). Both assert the host staysreadyand the detail carries the right text. Restoring the error return makes both fail withexpected 'failed' to be 'ready'.The fixture gained one optional parameter to stub the host command result.
Related
Stands alone, but shares a symptom with #11647, which fixes the stale SDK resolution that produced the 127 in the first place. This one limits the blast radius of any such failure; that one removes this cause.
🤖 Generated with Claude Code
Summary by CodeRabbit
ANDROID_HOME.