Repository navigation
feat(android): support observe-only snapshots - #4647
Conversation
|
This is not ready yet: the live Android evidence for f8d58eb is missing. This change touches the helper Java, helper session borrowing and daemon routing, so it needs device output. The body describes a live Android 14 run on a506b7f in prose only, and that commit is not in this branch, so it is unclear whether the delta to f8d58eb is help-only. Please attach output from f8d58eb, or a diff that shows a506b7f..f8d58eb is help-only, that covers three routes. First, with an agent session holding the helper, show the helper PID (for example Repo Guards & Compatibility fails at "Check for production-unused exports" because the re-export of captureAndroidSnapshotWithHelper in snapshot-helper.ts:2 is now unused. Moving captureAndroidUiHierarchyFromHelper into snapshot-helper-runtime.ts removed its last production consumer, so this failure comes from this PR. There are no conflicts. Not blocking, and you can take or leave these: the cancellation test at snapshot.test.ts:436 uses a fake helper that never exits on client hang-up, so the Java fix has no automated coverage and the live run should back that claim, and it would help to say which new tests fail on base; the three daemon sites that classify an Android observe read use different predicates (request-execution-scope.ts:505, session-routing.ts and snapshot-runtime-binding.ts), so one typed passive-read check would keep them aligned; Simplicity question: the transient reader mode already means "a reader that does not own the helper" (snapshot.ts:316), so could borrowedSession fold into one helper-ownership policy derived once from observeOnly or transient, which decides install, release, retire-on-content and retire-on-session-failure? On the daemon side, could the passive Android read be classified once on the resolved snapshot route, with an unowned-serial read going sessionless instead of using a synthetic session address? Nothing else needs to change first. To move forward, remove the unused re-export so Repo Guards passes, then attach the f8d58eb live output for the borrow, cancel and standalone routes. |
|
The code at 9706eee looks good, and I have no new findings. The unused re-export in snapshot-helper.ts that failed Repo Guards at f8d58eb is now removed. The live evidence in the PR body covers all three requested routes on a build of this commit and matches the fields the code reports. Raw command or JSON output would be easier to audit, but this is enough. CI is still running on this commit and needs to finish green before merge. There are no conflicts. The earlier non-blocking notes and the simplicity question are still yours to decide. |
|
Thanks again for this. A follow-up pass at 9706eee asked whether each added line is needed for the outcome in #4646. The problem is real. An IDE panel cannot read the screen while an agent holds the snapshot helper, and a second sessionless read stops the agent's helper. Most of that outcome is available with much less code, so I removed the ready-for-human label until the shape is smaller. My estimate is about 45 production lines instead of about 400.
One open question: The live evidence for the outcome (helper PID unchanged, the agent's refs still valid, an empty session list) still applies. Re-running those three checks at the smaller head is enough. |
|
This now conflicts with |
|
ADR 0040 alignment (ADR) Decision: observe-only Android routing: Rebase the daemon slice on #4965 and remove the new raw lookups in |
9706eee to
4afee81
Compare
|
Thanks for the update. The conflict from the earlier review is resolved, and the code at 4afee81 looks ready. Not blocking, and you can take or leave these: a session-attached Only 3 checks ran at this head, and Body rules was cancelled. That check validates the PR body and this diff touches no body-rule code, so the cancellation is likely unrelated. Unit, typecheck and help-size results do not exist at this head. Not verified here: the live Android evidence in the PR body, the new tests, and the reported help-size failures on base. Before merge, CI needs to run green at 4afee81 on the 0.22 base. |
4afee81 to
545c716
Compare
|
Thanks for the rebase. The code at 545c716 looks good, and no code findings remain from the earlier review at 4afee81 (#4647 (comment)). The rebase changed only daemon scheduling, not the device path, so the live Android evidence in the PR body still counts. The Repo Guards check fails because the Fallow audit reports two complexity findings in functions this PR touches in request-execution-scope.ts. The Coverage check also fails. Its log is cut off before the failing step, so the cause is unclear. Could a coverage threshold or CRAP regression on the touched daemon files explain it? Not verified here: the new and rebased tests were not run locally at this head. Before merge, the Fallow audit must pass and the Coverage failure must be explained or fixed. No conflicts were reported. |
|
Rebased onto |
|
Thanks for the update. The changes since the earlier review (545c716) look good at 376fb28: observations stay read-only, the helper stays bounded, and the review found no new problems. The 15 checks at this head all pass, and there are no conflicts. Not verified here: a live Android run at this head, since the run in the PR body is at 4afee81 and the delta is a behavior-preserving refactor by trace. Not verified here: the new tests were not run locally, and the new test that a refused detached observation never reads the public session address was not mutated to confirm it fails without the guard at request-router.ts:365. Nothing else is needed before merge. |
* feat(android): admit detached snapshot observations * fix(android): preserve host-global claims during observation * chore(gates): declare observation error reasons and colocate tests * refactor(android): reuse snapshot observation owners --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
Summary
An IDE panel's Android snapshot can stop the agent's helper. Separate
uiautomator dumpcalls compete for Android's soleUiAutomationconnection.Android ADB
--observe-onlyreturns geometry and preserves the agent's refs, baseline, journal and idle timer. The dispatcher supplies lifetime-scoped authority and exact claim coverage. All captures release only helpers they start.This uses
0.22's ADR 0040 interfaces. #4729 already landed the Java disconnect fix. Fixes #4646.Before / after
Base
58c76a620returnsUNSUPPORTED_OPERATION. Head4afee81b1returns 37 nodes and a 1080×2400 viewport without refs. The standalone read leaves an empty session list and no helper process.Validation
Tested
4afee81b1on Android 16/API 36 with helper0.22.0-dev/API 2.Observation preserved PID
7021, and the original pinned@e11~s758323resolved exactly and opened Network & internet.Cancelling the CLI after the helper request flushed, before any response bytes, preserved that PID. The next agent snapshot returned 29 nodes with
helperSessionReused=true.pnpm check:affected --run --base 58c76a620 --head 4afee81b1is blocked by three help-size failures reproduced on base (22,789 tests passed). All 319 provider tests, smoke and documentation checks pass. CI pending.Selected verification output
[ { "message": "standalone", "nodes": 37, "viewport": { "width": 1080, "height": 2400 }, "sessions": [], "helperPid": null }, { "message": "active", "pidBefore": "7021", "pidAfter": "7021", "pinnedRef": "@e11~s758323", "pressResolution": { "source": "ref", "phase": "pre-action", "kind": "exact" } }, { "message": "cancelled", "responseBytes": 0, "socketClosed": true, "pidBeforeAbort": "7021", "pidAfterAbort": "7021" } ]Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.