Android: Attempt emulator recovery before returning DEVICE_NOT_FOUND#1550
Merged
Android: Attempt emulator recovery before returning DEVICE_NOT_FOUND#1550
Conversation
…empt recovery before DEVICE_NOT_FOUND Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add emulator restart attempt before DEVICE_NOT_FOUND
Android: Attempt emulator recovery before returning DEVICE_NOT_FOUND
Mar 6, 2026
This was referenced Mar 6, 2026
kotlarmilos
approved these changes
Mar 10, 2026
Member
|
/ba-g Known issues |
matouskozak
pushed a commit
to matouskozak/xharness
that referenced
this pull request
Mar 11, 2026
…otnet#1550) * Initial plan * Add emulator recovery to AdbRunner and update Android commands to attempt recovery before DEVICE_NOT_FOUND Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com> * Android: Attempt emulator recovery before returning DEVICE_NOT_FOUND Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
kotlarmilos
pushed a commit
to kotlarmilos/xharness
that referenced
this pull request
Mar 16, 2026
…otnet#1550) * Initial plan * Add emulator recovery to AdbRunner and update Android commands to attempt recovery before DEVICE_NOT_FOUND Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com> * Android: Attempt emulator recovery before returning DEVICE_NOT_FOUND Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
kotlarmilos
pushed a commit
to kotlarmilos/xharness
that referenced
this pull request
Mar 16, 2026
…otnet#1550) * Initial plan * Add emulator recovery to AdbRunner and update Android commands to attempt recovery before DEVICE_NOT_FOUND Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com> * Android: Attempt emulator recovery before returning DEVICE_NOT_FOUND Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When XHarness fails to find a suitable Android emulator, it previously returned
DEVICE_NOT_FOUNDimmediately with no recovery attempt. On Helix CI machines with systemd-managed emulators, a crashed x86_64 emulator would cause all 3 retry attempts to fail on the same machine.Changes
AdbRunner— newTryRecoverEmulator()methodMulti-step recovery sequence invoked before giving up:
adb devices -loutput and (on Linux)systemctl status android-emulatorkill-server+start-server; if the device reappears, returns immediatelysystemctl restart android-emulatoron Linux/systemd, falling back toadb emu restartsys.boot_completed == 1AdbRunner— improved diagnostics on architecture mismatchGetAllDevices()now logs which devices were found and their architectures when the required architecture isn't satisfied:Command updates — recovery before failing
AndroidInstallCommand.InvokeHelper— callsTryRecoverEmulator()and retriesGetDevice()before throwingNoDeviceFoundExceptionAndroidHeadlessInstallCommand.InvokeHelper— same patternAndroidRunCommand.InvokeCommand— same pattern viaGetSingleDevice()TimeToWaitForBootCompletionis now set before device discovery so the configured timeout applies during recovery as wellTests
Added two tests covering recovery paths: device reappears after ADB daemon reset, and device reappears only after emulator restart.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
netcorenativeassets.blob.core.windows.net/home/REDACTED/work/xharness/xharness/.dotnet/dotnet /home/REDACTED/work/xharness/xharness/.dotnet/dotnet /home/REDACTED/work/xharness/xharness/.dotnet/sdk/10.0.100/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false(dns block)securitytools.pkgs.visualstudio.com/opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.