Skip to content

fix(emulator): wait for the requested AVD during Android boot - #35536

Merged
OrcaWin merged 2 commits into
mainfrom
audit/android-avd-boot-identity
Oct 29, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
audit/android-avd-boot-identity

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

LoC: +100/-3

Wait for the named Android AVD after launching it. The boot poll previously accepted the first newly booted emulator,so another concurrent AVD could become this workspace's device even if the requested AVD never appeared. Reuse the existing name lookup before checking boot completion;keep serial reuse,launch flags and timeout behavior.

Validation:26 configured tests/3 suites,3 expected baseline identity regressions with3 controls,strict focused TypeScript and all5 normal hook tasks pass. Real Node26.8.1 production execFile/spawn against owned SDK fixtures:12groups per arm at1/10 boots;33wrong serial returns become0. Delayed target,both-ready,unrelated-only timeout,existing-name/serial and unknown-name controls pass. All616fixture command processes and profiles cleaned. Seven exact modules,no module stubs;fixtures provide ADB inventory/name/boot flags and an immediate sleep,not physical devices or real-time boot measurements.

Identity checks add AVD-name queries22->132 and total fixture commands231->385 across66calls per arm;boot queries remain33. This fixes correctness,not measured performance. No Android SDK/emulator,nativeElectronUI,macOS/Windows,CPU/RSS/latency test. Preserve #9950 SDK/network guards on rebase;they do not address this postlaunch match. Nine source/caller blobs equal main9babef286.

Required aggregate queued after #35531;no aggregate pass or Claude takeover claimed. Initial premature test launch and test-lint failure preserved,then corrected without installs or hook bypass. Frozen head 8b7d1731bab0fda358defe6fa0619ff937a54dbd,base 79dbada2c873bef3584a0c53b23ae98f2a84e536. Evidence /home/neil/.local/state/orca-electron-audit/android-avd-boot-identity/report.md;47-payload seal 4c180cd360237e5123b9ce166d46b3a1a160d22e8109f8887d8f742edd649d89.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: acc9a641-e5e6-485e-ac4a-2f25db063191
Commits

Reviewing files that changed from the base of the PR and between c351825 and 8189909.

Files selected for processing: 3
  • src/main/emulator/android/android-avd-boot-identity.test.ts
  • src/main/emulator/android/android-avd-boot.ts
  • src/main/emulator/backends/android-emulator-backend.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previously reported startup delay remaining non-blocking.

Findings

  1. P2 Another emulator delays startup ▶

Summary

The boot poll now checks the requested AVD's name before accepting its serial.

  • Android boot waits for the requested AVD before returning a serial.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Launch requested AVD] --> B[List newly seen emulators]
  B --> C[Find requested AVD by name]
  C --> D{Matching serial found?}
  D -->|Yes| E{Boot complete?}
  E -->|Yes| F[Return matching serial]
  D -->|No| G[Sleep and retry until timeout]
  E -->|No| G
  G --> B
Loading

Reviews (4) · Last reviewed commit: "test(emulator): trim AVD boot identity t..." · Reviewed by Greptile

)
for (const device of fresh) {
const booted = await runner(sdk.adb, bootCompletedArgs(device.serial))
const serial = await findRunningAvdSerial(runner, sdk, avdName, fresh)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Another emulator delays startup

findRunningAvdSerial waits for every fresh emulator's name query before returning a match. If the requested AVD is ready but another newly seen emulator's console does not answer, its query can delay the target's boot check by 60 seconds. Previously, a booted target listed first could return immediately.

Let a confirmed match proceed without waiting for unrelated name queries, or give those queries a shorter timeout.

@OrcaWin
OrcaWin force-pushed the audit/android-avd-boot-identity branch 2 times, most recently from fa59c23 to 6ff6799 Compare October 29, 2026 21:18
@OrcaWin
OrcaWin force-pushed the audit/android-avd-boot-identity branch from 6ff6799 to 8189909 Compare October 29, 2026 21:44
@OrcaWin
OrcaWin merged commit b0e2bf6 into main Oct 29, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant