fix: clean up Android snapshot helper sessions#862
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
Review: clean up Android snapshot helper sessionsSolid, well-scoped, and well-tested. I verified the lifecycle concerns and they hold up:
Minor follow-ups (non-blocking):
LGTM once the above are acknowledged. 🤖 Automated review via Claude Code |
feb6ed3 to
fee6b76
Compare
|
Addressed the actionable follow-up: added a comment at the Android interactor scope decision explaining why app-backed daemon sessions use persistent helper reuse while standalone snapshots release the helper after capture. Also confirming the other notes:
Re-ran: |
|
Summary
Fixes Android snapshot-helper ownership so standalone snapshot commands stop the persistent helper session after capture, releasing Android's single UiAutomation connection for uiautomator, Espresso, Appium, and other consumers.
App-backed daemon sessions still opt into persistent helper reuse, and close/teardown now stops the Android snapshot helper alongside other session-owned resources.
Closes #851
Touched files: 7.
Validation
Focused unit coverage passed for Android snapshot helper cleanup/reuse and session close teardown:
pnpm exec vitest run src/platforms/android/__tests__/snapshot.test.ts src/platforms/android/__tests__/snapshot-helper-session.test.ts src/daemon/handlers/__tests__/session-close-shutdown.test.ts.Static/build checks passed via direct installed binaries because the pnpm script wrapper hung or failed registry signature verification in this environment:
oxlint . --deny-warnings,tsc -p tsconfig.json,rslib build, andnode --test test/integration/smoke-*.test.ts.Live Android emulator verification passed on
emulator-5554: afternode bin/agent-device.mjs --state-dir /private/tmp/agent-device-851-state snapshot --platform android --serial emulator-5554,adb shell ps -A | rg "snapshothelper|uiautomator|am instrument"returned no helper/instrumentation process, andadb shell uiautomator dump /data/local/tmp/agent-device-851.xmlwrote the XML file successfully. No related #850 PR was found to sequence against.