Skip to content

open: stop an Android emulator whose boot fails before it is ready #4847

Closed

Description

@thymikee

Purpose

#4842 stops the emulator a cold open launched when the open fails after the boot completes. A failure inside the boot is outside that rule. In packages/platform-android/src/readiness/runtime.ts (ensureEmulatorReady), the launched process is terminated only when the request is canceled. When the boot throws for another reason (for example bindLaunchedEmulator fails, or a boot probe fails for a reason other than the deadline), the emulator stays running with no session to own it.

Required behavior

Decide, per boot failure reason, whether the launched emulator is stopped:

  • A boot that ran out its --timeout keeps booting. This is documented and tested; keep it.
  • A boot that fails for a non-deadline reason after launch returned a pid: stop the launched process, or state why it is kept.

Fix it at the readiness owner, which holds the launched pid. Do not add a second stop path in open orchestration.

Completion conditions

  • A unit test in packages/platform-android/src/readiness/runtime.test.ts for each decided reason (terminated or kept).
  • website/docs/docs/commands.md states the final rule; today it says a boot that failed before the emulator was ready leaves the emulator as it is.

Found by Sentinel on #4842: #4842 (comment)

Activity

  1. added this to the 0.22 - lean core milestone on Nov 20, 2026
  2. apex-sentinel-staging commented on Nov 20, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: bug

    The issue describes a concrete existing behavior: after a non-deadline Android emulator boot failure, ensureEmulatorReady leaves the launched emulator running. It points to the relevant module and specifies expected cleanup behavior, tests, and documentation updates.

    Required sections

    • Steps to reproduce (missing)
    • Expected and actual behavior (missing)
    • Version or environment (missing)
  3. thymikee commented on Nov 20, 2026

    @thymikee
    MemberAuthor

    Design correction from the review of #4863: the stop does not belong in the readiness code, which this issue's body asks for. A stop there bypasses the daemon's device-shutdown policy denial and the ownership and claim-lock checks that #4842 added. The PR is being reworked so the one existing stop path (withFailedOpenLaunchCleanup in the daemon) also covers the boot: readiness reports the launch as soon as it has the pid, and a boot that fails for a non-deadline reason goes through that path with all its gates. A spent startup budget keeps the emulator booting and reports kept_running with boot-timeout.

  4. thymikee commented on Nov 21, 2026

    @thymikee
    MemberAuthor

    Fixed by #4863, merged into 0.22. A cold boot that fails for a reason other than a spent startup budget stops the emulator it launched; a timed-out boot keeps booting. The stop passes the device-shutdown policy gate. Live runs (control, timeout, injected failure, policy denied) are on the PR. The ownership check before the stop is tracked in #4867.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions