fix(android): back off a timed-out snapshot helper session and bound content re-captures
Merged
OK
2mo ago+299+299+012345678901234567890123456789-64-64-01234567890123456789
Summary
From e2e feedback: Android snapshots on a hung app could run for about 91s and time out, and a helper failure was sometimes reported as "output could not be parsed".
- Any failed persistent helper session capture (timeout, dead socket, protocol or helper error) tears the session down, and that helper build stays one-shot for the fallback budget plus start backoff (at least 40s). It is no longer respawned to fail again on every attempt and command.
- Content re-captures do not start after a 10s window, checked after the re-capture delay too. Worst case once the helper is installed is about 70s. A first-run helper install (30s budget, inside the same request, cached per device after) can take that one attempt to about 87s, near the 90s request envelope; it already closes the window, so no re-capture follows.
- When
am instrumentexits 0 but the helper reports a failure, that failure and its typed reason are kept instead of the parse error.
8 files touched, all in platform-android.
Validation
Tested commit: 12757c432 (on upstream/main 9a245d0ef).
- Targeted:
snapshot*.test.tsin platform-android: 155 passed. New window test fails without the delay recheck. pnpm check:affected --run --base upstream/main: all runnable checks passed (385 files / 2641 tests).- Live, Pixel_9_API_37 emulator (pre-rebase head) with Settings SIGSTOPped: after the failed session capture, the next command skipped the session instead of respawning it. After SIGCONT, snapshots took 0.2-0.9s.
Risks: the original 91s timeout and the exit-0 helper failure were not reproduced live; those paths rest on unit tests. First-run install worst case sits near the envelope.