Repository navigation
fix(close): wait for the emulator process to exit on close --shutdown - #4815
Conversation
Plain close confirms that the emulator process its own open launched has exited after the stop it owes. close --shutdown only asked the device to stop and returned, so a caller could not tell whether the emulator host process was gone (#4807). Both stops now go through the same launched-process confirmation. An explicit --shutdown still skips the ownership check: the user commanded the stop, so what the recorded process says cannot gate it. A --shutdown on a session with no recorded launch identity (a prebooted emulator) has no process to confirm, so nothing is asked of the owner and no process probe is added. The result flag is renamed to shutdownStopUnconfirmed to cover both paths, and the existing unconfirmed-exit warning now rides the explicit path too.
Size Report
Startup median (7 runs, lower is better):
|
|
The code at 6f229bb looks right, but this device-facing change has no live run yet, so it is not ready to merge. Explicit The tests use the launched-process owner fixture, so the real owner's confirm path is covered only by |
This comment has been minimized.
This comment has been minimized.
Live run:
|
| Step | Result |
|---|---|
Cold open com.android.settings --platform android --device agent-device-4539-live |
success, 79 s |
| Emulator process | pid 39881, started Fri Nov 20 15:00:18 2026 (qemu-system-aarch64 -avd agent-device-4539-live) |
close --shutdown --json |
exit 0, elapsed 4531 ms |
ps -p 39881 immediately after return |
no process, exit 1 |
warnings |
none (no stop-unconfirmed warning) |
{
"success": true,
"data": {
"session": "live4815",
"shutdown": {
"success": true,
"exitCode": 0,
"stdout": "OK: killing emulator, bye bye\r\nOK\r\n",
"stderr": ""
},
"message": "Closed: live4815"
}
}The process check used ps -p <pid> instead of kill -0 <pid>; it gives the same answer. The isolated daemon was stopped after the run.
The follow-up commit only changes the wording in sessions.md ("waits for, and if needed stops, the process this session's open launched").
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
This PR is ready at 943fa14. The live run on a dedicated AVD shows the changed route: after a cold |
…#4815) * fix(close): wait for the emulator process to exit on close --shutdown Plain close confirms that the emulator process its own open launched has exited after the stop it owes. close --shutdown only asked the device to stop and returned, so a caller could not tell whether the emulator host process was gone (#4807). Both stops now go through the same launched-process confirmation. An explicit --shutdown still skips the ownership check: the user commanded the stop, so what the recorded process says cannot gate it. A --shutdown on a session with no recorded launch identity (a prebooted emulator) has no process to confirm, so nothing is asked of the owner and no process probe is added. The result flag is renamed to shutdownStopUnconfirmed to cover both paths, and the existing unconfirmed-exit warning now rides the explicit path too. * docs(sessions): say close --shutdown stops the launched process when needed
…#4815) * fix(close): wait for the emulator process to exit on close --shutdown Plain close confirms that the emulator process its own open launched has exited after the stop it owes. close --shutdown only asked the device to stop and returned, so a caller could not tell whether the emulator host process was gone (#4807). Both stops now go through the same launched-process confirmation. An explicit --shutdown still skips the ownership check: the user commanded the stop, so what the recorded process says cannot gate it. A --shutdown on a session with no recorded launch identity (a prebooted emulator) has no process to confirm, so nothing is asked of the owner and no process probe is added. The result flag is renamed to shutdownStopUnconfirmed to cover both paths, and the existing unconfirmed-exit warning now rides the explicit path too. * docs(sessions): say close --shutdown stops the launched process when needed
…#4815) * fix(close): wait for the emulator process to exit on close --shutdown Plain close confirms that the emulator process its own open launched has exited after the stop it owes. close --shutdown only asked the device to stop and returned, so a caller could not tell whether the emulator host process was gone (#4807). Both stops now go through the same launched-process confirmation. An explicit --shutdown still skips the ownership check: the user commanded the stop, so what the recorded process says cannot gate it. A --shutdown on a session with no recorded launch identity (a prebooted emulator) has no process to confirm, so nothing is asked of the owner and no process probe is added. The result flag is renamed to shutdownStopUnconfirmed to cover both paths, and the existing unconfirmed-exit warning now rides the explicit path too. * docs(sessions): say close --shutdown stops the launched process when needed
…#4815) * fix(close): wait for the emulator process to exit on close --shutdown Plain close confirms that the emulator process its own open launched has exited after the stop it owes. close --shutdown only asked the device to stop and returned, so a caller could not tell whether the emulator host process was gone (#4807). Both stops now go through the same launched-process confirmation. An explicit --shutdown still skips the ownership check: the user commanded the stop, so what the recorded process says cannot gate it. A --shutdown on a session with no recorded launch identity (a prebooted emulator) has no process to confirm, so nothing is asked of the owner and no process probe is added. The result flag is renamed to shutdownStopUnconfirmed to cover both paths, and the existing unconfirmed-exit warning now rides the explicit path too. * docs(sessions): say close --shutdown stops the launched process when needed
…#4815) * fix(close): wait for the emulator process to exit on close --shutdown Plain close confirms that the emulator process its own open launched has exited after the stop it owes. close --shutdown only asked the device to stop and returned, so a caller could not tell whether the emulator host process was gone (#4807). Both stops now go through the same launched-process confirmation. An explicit --shutdown still skips the ownership check: the user commanded the stop, so what the recorded process says cannot gate it. A --shutdown on a session with no recorded launch identity (a prebooted emulator) has no process to confirm, so nothing is asked of the owner and no process probe is added. The result flag is renamed to shutdownStopUnconfirmed to cover both paths, and the existing unconfirmed-exit warning now rides the explicit path too. * docs(sessions): say close --shutdown stops the launched process when needed
…callstack#4815) * fix(close): wait for the emulator process to exit on close --shutdown Plain close confirms that the emulator process its own open launched has exited after the stop it owes. close --shutdown only asked the device to stop and returned, so a caller could not tell whether the emulator host process was gone (callstack#4807). Both stops now go through the same launched-process confirmation. An explicit --shutdown still skips the ownership check: the user commanded the stop, so what the recorded process says cannot gate it. A --shutdown on a session with no recorded launch identity (a prebooted emulator) has no process to confirm, so nothing is asked of the owner and no process probe is added. The result flag is renamed to shutdownStopUnconfirmed to cover both paths, and the existing unconfirmed-exit warning now rides the explicit path too. * docs(sessions): say close --shutdown stops the launched process when needed
…#4815) * fix(close): wait for the emulator process to exit on close --shutdown Plain close confirms that the emulator process its own open launched has exited after the stop it owes. close --shutdown only asked the device to stop and returned, so a caller could not tell whether the emulator host process was gone (#4807). Both stops now go through the same launched-process confirmation. An explicit --shutdown still skips the ownership check: the user commanded the stop, so what the recorded process says cannot gate it. A --shutdown on a session with no recorded launch identity (a prebooted emulator) has no process to confirm, so nothing is asked of the owner and no process probe is added. The result flag is renamed to shutdownStopUnconfirmed to cover both paths, and the existing unconfirmed-exit warning now rides the explicit path too. * docs(sessions): say close --shutdown stops the launched process when needed
Summary
Closes #4807.
close --shutdownasked the device to stop (adb emu kill) and returned, so a caller could not tellwhether the emulator host process this session launched had exited. Plain
closealready waits forthat exit. Both stops now confirm it through the launched-process owner (
confirmLaunchedProcessStopped)after the stop, and an unconfirmed exit carries the existing "could not confirm that its emulator
process exited" warning.
--shutdownstill never asks the ownership CHECK, so the stop is not gated by what the recordedprocess says.
implicitShutdownStopUnconfirmedis renamed toshutdownStopUnconfirmedto cover bothpaths.
On a session with no recorded launch identity (a prebooted emulator) there is no recorded process to
confirm, so nothing is asked of the owner. No probe by serial is added: the removed
lsofprobe staysremoved. The close orchestration still names no platform.
Touched files: 5 (2 daemon, 1 test, 2 docs). No scope expansion, no changesets.
Validation
Base
c30537bd66, head6f229bb7ef.pnpm check:affected --run --base origin/0.22 --head 6f229bb7ef: passed,exactCommit=true,receipt
.tmp/validation/run-aop6r6/receipt.json. 18 checks selected, no fail-open: 11 runnablepassed; 7 skipped as GitHub-authoritative or parked lanes.
session-close-external-reboot.test.ts13/13;packages/daemon/src/sessions170 files /1289 tests;
src/platform-runtime-device-boot.test.ts7/7.pnpm typecheck,pnpm format,fallow audit --base origin/0.22: clean.--shutdowncases.CI obligations: the skipped lanes above. A live Android run on a dedicated AVD showing the emulator
pid gone when
close --shutdownreturns is still required.