fix(android): wait for killed processes to exit before the close fence
Merged
OK
1h ago+341+341+012345678901234567890123456789-54-54-01234567890123456789
Summary
Android close and open --relaunch failed with android-app-close-timeout (phase process) on loaded CI emulators while the force-stopped app was still exiting. Logcat from 15 CI runs of the e2e mobile benchmark shows every Killing <pid> followed by Zygote: Process <pid> exited due to signal 9 with no restart in between after up to ~700 ms (7 ms on an idle Mac). The 2 s fence counted that exit time, so a busier runner failed it (2 of ~20 runs today).
closereads the package's pids befoream force-stop, then waits up to 10 s for those pids to exit (new phaseexit; the bound only catches a wedged device). The 2 sprocessfence then still refuses a new process.- A
pidofthat errors, prints no pid list, or times out (bounded by the fence) fails withandroid-process-probe-unavailable, askillAppdoes. - 7 files. Help text, docs and changeset updated.
Known gap: a process started between the pidof read and force-stop is not in the killed set, so a slow exit of that one still hits the 2 s fence.
Validation
pnpm check:affected --run --head 42e84d915: all runnable checks passed.- New test "waits past the process fence for a killed process that exits slowly" fails on 3537dc549 with
process remained running after closeand passes on 42e84d915. - Live at 42e84d915, Pixel Tablet API 37 emulator:
open --relaunch3x gave a fresh pid each time,closeleft no process. At fc6d6373c, Pixel 9 API 37: e2e mobile benchmark on this build: Android deterministic flows-lists + login-form 10/10, agentic Login Form / Infinite Scroll / Modal Flow 2/2.