You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Investigate implicit shutdown after an external emulator restart #4585
Follow up on PR #4539, r4572557061. Plain close should not stop a new emulator boot that another actor started after the session’s original boot. This is separate from the Android cold-open acceptance runs still required by #4162.
Current evidence
At 0e19c8dfaf2a549bd6cfd49d3b1c50d56ee83dcd, the source permits this sequence:
A session opens a stopped local Android emulator and records bootedByOpen: true.
Another actor stops and starts the emulator, retaining its serial and the daemon’s claim file.
The session reopens its app. Claim renewal verifies token/process identity and stamps updatedAtMs; it does not observe the device’s current boot. Android session refresh returns the stored device. updateOpenDevice retains boot ownership for the same device identity.
Plain close can renew that claim and request shutdown of the current emulator boot.
This is a source trace, not a runtime reproduction. No live external-reboot case has run. The earlier Darwin iOS stale-snapshot rejection does not settle this scenario. The existing boot-observation service already distinguishes device boots for claim acquisition; claim currency and ownership of a particular boot answer different questions.
Required behavior and completion
First reproduce the sequence through the routed open/close lifecycle with real claim handling. Record whether the second open actually boots anything and whether close asks for shutdown.
If reproduced, tie implicit-stop authority to the boot this session caused at the owning lifecycle/claim boundary. Reuse existing boot observation where appropriate. Specify behavior when boot observation is unavailable before implementation.
Preserve actual cold-reopen ownership, same-boot reopens, explicit close --shutdown, policy-denied warnings, provider/physical exclusions, and claim takeover behavior. A blanket selection.source === 'local' condition would drop legitimate cold reopens.
Add a regression that fails on the observed wrong shutdown and passes after the fix. Verify both a same-boot reopen and an external restart. Cover close without an intervening reopen if the reproduction exposes the same gap.
Run the affected exact-head checks and supported live-device verification before claiming the device behavior fixed.
No speculative guard, new flag, release workaround, or change to #4162’s pending acceptance evidence is included in this follow-up.
The issue identifies a concrete existing behavior that is wrong: after an external emulator restart, a session's plain close can still request shutdown of the current boot, and it points to source locations plus required reproduction and tests.
Current state: reproduced against #4539 head bcb9196 with real claim files through routed open and close. The controlled platform fixture cold-boots an emulator, changes the observed boot while retaining its serial and claim, then reopens without booting it. Plain close incorrectly asks the platform to stop the externally rebooted emulator. The reproducer records one failure and two passing controls. No real device was used.
The session refreshes the claim on reopen, so the renewal timestamp no longer distinguishes the two boots. The next implementation checks the original claim timestamp against the current boot observation for the affected Android emulator path. A confirmed later boot should retain the emulator and report a distinct warning. Same-boot close, explicit shutdown, and denied or lost-claim behavior remain separate. Live verification still requires a supported cold-AVD route.
Resolved in #4539 (0.22, c30537b): close stops only the emulator process this session's open launched, read once right before the stop, so an externally restarted emulator on the same serial is kept with a warning. Verified by live Android runs on a dedicated AVD.
Activity
apex-sentinel-staging commentedon Nov 16, 2026
Apex Sentinel · Issue review
Suggested label:
bugThe issue identifies a concrete existing behavior that is wrong: after an external emulator restart, a session's plain close can still request shutdown of the current boot, and it points to source locations plus required reproduction and tests.
Required sections
thymikee commentedon Nov 18, 2026
Current state: reproduced against #4539 head
bcb9196with real claim files through routed open and close. The controlled platform fixture cold-boots an emulator, changes the observed boot while retaining its serial and claim, then reopens without booting it. Plain close incorrectly asks the platform to stop the externally rebooted emulator. The reproducer records one failure and two passing controls. No real device was used.The session refreshes the claim on reopen, so the renewal timestamp no longer distinguishes the two boots. The next implementation checks the original claim timestamp against the current boot observation for the affected Android emulator path. A confirmed later boot should retain the emulator and report a distinct warning. Same-boot close, explicit shutdown, and denied or lost-claim behavior remain separate. Live verification still requires a supported cold-AVD route.
test(close): reproduce implicit shutdown after an external emulator r…
fix(close): owe the implicit stop to the boot the session caused (#4585)
test(close): reproduce implicit shutdown after an external emulator r…
fix(close): owe the implicit stop to the boot the session caused (#4585)
thymikee commentedon Nov 20, 2026
Resolved in #4539 (0.22, c30537b): close stops only the emulator process this session's open launched, read once right before the stop, so an externally restarted emulator on the same serial is kept with a warning. Verified by live Android runs on a dedicated AVD.