Skip to content

fix(android): dispatch helper taps and keys without the global animation wait - #4609

Open
thymikee wants to merge 16 commits into
mainfrom
t3/android-press-timeout
Open

thymikee wants to merge 16 commits into
mainfrom
t3/android-press-timeout

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Android press x y and helper keys took up to 10 s while a window animation was pending: the public UiAutomation.injectInputEvent(event, sync) waits for animations before DOWN and after UP, up to 5 s each. Taps and keys now skip that wait, like touch plans (#1356).

  • PressSequence: every refused start is released (touch ACTION_CANCEL, key canceled ACTION_UP), then retried once after the framework's animation sync, only if the host deadline has room.
  • Host: input waits 45 s or until the request deadline; helper gets budgetMs, the wait less a 5 s margin. Under 2 s left (one attempt), the press is refused unsent (android-input-budget-exhausted).
  • Shared TouchEvents builder; API < 34 unchanged.

11 files. Refs #4590.

Validation

Head 218e157, main a30accf, emulator-5556 API 35, helper 0.21.39-dev, installed SHA-256 verified per block. ABAB, 15 per arm, 0 failures, 0 inconsistent-input logs, load 11-35:

route main p50/p95 head p50/p95
press after transition 10.47/10.72 s 5.93/6.83 s
press during RN Modal slide-in 4.11/4.28 s 0.40/0.56 s
idle press 0.30/0.40 s 0.32/0.43 s
helper back key 0.93/2.02 s 0.38/0.50 s

Mid-slide, head taps the in-flight sheet; main waits, then hits the button. Forced retry: refused DOWN, retry landed, no inconsistent logcat; live fill entered text.

CI owns check:affected: green. Risk: a hung app can block one end 30 s.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.33 MB 6.33 MB +4.6 kB
Package (unpacked) 6.33 MB 6.33 MB +4.6 kB
Package (download) 1.92 MB 1.92 MB +1.7 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 42.7 ms 43.2 ms +0.5 ms
CLI --help 78.5 ms 80.3 ms +1.9 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

You’re at about 97% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised

No open findings. 1 withdrawn by a re-check since this review.

Reviewed with this repository's own Sentinel configuration (a30accf38081).

💬 Talking to Sentinel

In a finding's thread, reply with:

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.

Earlier reviews

Review of 818a200b · 16.11.2026 22:46 UTC

Apex Sentinel · ✅ Approve

Since the last review: 1 new · 0 still open · 4 no longer raised (3 marked fixed)

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AutomationCommandHandler.java:236 🆕 Fill's focus tap inherits the whole command budget, starving text entry it never reserves for

1 finding below minor hidden (user_settings.min_severity).

1 new finding away from what changed since b2765da not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of b2765daa · 16.11.2026 22:25 UTC

Apex Sentinel · ✅ Approve

Since the last review: 4 new · 0 still open · 1 no longer raised (1 marked fixed)

4 finding(s): 3 minor, 1 nit.

🟡 Minor (3)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/PressSequence.java:50 🆕 PressSequence reserves nothing for the first start, so a press can answer after the host's 45 s wait
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AutomationCommandHandler.java:194 🆕 fill gives its whole deadline to the focus tap and does no deadline check of its own
packages/platform-android/src/automation-helper.ts:86 🆕 Budget refusal escapes runAndroidAutomationHelper, skipping the adb input fallback
🔵 Nit (1)
Where Finding
packages/platform-android/src/automation-helper.ts:42 🆕 The 45 s input cap comment adds up to 65 s, contradicting the value it documents

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of f728193a · 16.11.2026 22:06 UTC

Apex Sentinel · ✅ Approve

Since the last review: 1 new · 0 still open · 2 no longer raised (1 marked fixed)

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/platform-android/src/automation-helper.ts:141 🆕 A near-deadline request still sends a press the host stops waiting for, killing the shared session

2 findings below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of 53dd31c3 · 16.11.2026 21:53 UTC

Apex Sentinel · ✅ Approve

Since the last review: 2 new · 0 still open · 3 no longer raised (3 marked fixed)

2 finding(s): 2 minor.

🟡 Minor (2)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/PressSequence.java:12 🆕 Retry-room constant counts one injection, so a retried press can run 65 s past the host's 45 s timeout
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AutomationCommandHandler.java:60 🆕 Every input command now fails outright when the payload has no budgetMs

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of 98e41b19 · 16.11.2026 21:34 UTC

Apex Sentinel · ✅ Approve

Since the last review: 3 new · 0 still open · 2 no longer raised

3 finding(s): 3 minor.

🟡 Minor (3)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AutomationCommandHandler.java:217 🆕 fill can overrun the host's 45 s input budget: its tap alone may spend the whole 40 s press budget
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/PressSequence.java:99 🆕 Async end injection is reported as DISPATCHED, so a dropped UP reads as a successful tap
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/PressSequence.java:126 🆕 A timed-out retried start is classified from downTime, so a real timeout can report "refused"

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of 20c2fa72 · 16.11.2026 21:16 UTC

Apex Sentinel · ✅ Approve

Since the last review: 2 new · 0 still open · 0 no longer raised

2 finding(s): 2 minor.

🟡 Minor (2)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/PressSequence.java:103 🆕 Timed-out press reports "it was cancelled" without checking the cancel landed
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/PressSequence.java:59 🆕 A press that hits the injection deadline overruns the host's 30 s input budget

1 new finding away from what changed since 915ed6c not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (b13b016e9bc1).

Review of 915ed6c0 · 16.11.2026 19:12 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (ea414582b7fa).

Review of 6361e39b · 16.11.2026 19:00 UTC

Apex Sentinel · ✅ Approve

Since the last review: 1 new · 0 still open · 1 no longer raised (1 deferred)

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AutomationCommandHandler.java:185 🆕 A cancelled key press is reported as success because the cancel event is never recycled

4 findings below minor hidden (user_settings.min_severity).

1 new finding away from what changed since 72f625d not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (ea414582b7fa).

Review of 72f625d4 · 16.11.2026 18:47 UTC

Apex Sentinel · ✅ Approve

Since the last review: 1 new · 0 still open · 1 no longer raised

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AutomationCommandHandler.java:169 🆕 Refused key DOWN is retried with a second DOWN and no cancel for the first

2 findings below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (ea414582b7fa).

Review of c9836fba · 16.11.2026 18:37 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 1 still open · 2 no longer raised (2 marked fixed)

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/PressSequence.java:63 Refused touch UP after an accepted DOWN leaves the target holding a stuck pointer

Reviewed with this repository's own Sentinel configuration (ea414582b7fa).

Review of 4729eb11 · 16.11.2026 18:19 UTC

Apex Sentinel · ✅ Approve

3 finding(s): 3 minor.

🟡 Minor (3)

Where Finding
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AutomationCommandHandler.java:80 Refused UP after an accepted DOWN leaves the pointer stuck down for the rest of the session
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AutomationCommandHandler.java:79 Refused UP injection is never cancelled, leaving the pointer recorded as down
android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/UiAutomationInputDispatcher.java:50 injectStart returns -1 for "cannot wait" as well as "refused"

Reviewed with this repository's own Sentinel configuration (83a8e530997f).

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 3 new findings on 4729eb1. The verdict and the full list are in the summary comment.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 72f625d. The verdict and the full list are in the summary comment.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 6361e39. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

The change has no live device run at the head, so it needs one before merge. The only live benchmark ran at 4f4140a, and the press path was rewritten afterwards (PressSequence and Injections in c9836fb, the timed-out start release in 6361e39; +436/-73 since that run). The spot check names no SHA, and the merge-ready rule needs live evidence at head for a device-facing change. So the retry and cancel sequence that ships in PressSequence.java is unproven on a device. Please re-run on an API 34+ emulator with the helper built from 915ed6c (backend android-helper) and record the SHA. Four routes should be shown: (1) press x y right after an activity transition must show the drop, cancel, sync, retry path (about 5-6 s) with ok=true, the target activated, and no 'Inconsistent event' in logcat; (2) press x y while an RN Modal slides in should take about 0.4 s, and the output should show which element received the tap, not only that the command succeeded; (3) an idle press should be unchanged; (4) a helper key press (press back or keyboard enter) should return ok=true with no animation wait. Please give main-vs-head p50/p95 for routes (1)-(3).

Not blocking, and fine to take or leave: on API < 34 a refused DOWN now runs an extra ACTION_CANCEL through the public overload before ALREADY_WAITED returns, while main threw immediately and the PR body says older runtimes keep the previous path (check ALREADY_WAITED before discarding, or fix the body); cancelDown in UiAutomationInputDispatcher.java hand-builds a single-pointer touch event that nearly duplicates TouchPlanInjector.motionEvent, so one shared builder would be simpler; cancelStart and discardDroppedStart ignore the inject result, so a throwing cancel replaces the TIMED_OUT/DROPPED outcome, and catching RuntimeException as TouchPlanInjector.injectCancel does would keep the typed result; and the PR body lists 3 files where the diff has 6, validates at 4f4140a instead of the head, and has no check:affected receipt or CI obligations per docs/agents/pull-requests.md.

CI shows 19 checks with none failing at 915ed6c. Does a CI job compile and run SnapshotHelperTestSuite? PressSequenceTest checks call order on a fake, so it does not prove the framework's drop and timeout behavior. There are no conflicts. Before merge, the live run at 915ed6c or later must be recorded.

On the other threads: the recursive source walk, the separate unavailable-sync outcome and the timed-out start release are fixed at head, so the author can resolve them. These do not apply and can be resolved: r4589560011 (KeyEvents are built with new, and recycle is not in the SDK stub); r4589685676 and r4589685723 (the refused end is already cancelled by the dispatcher, and a CANCEL after a recorded UP is itself inconsistent, per PressSequence.java:80-84); r4589879957 and r4590133292 (withdrawn).

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on 20c2fa7. The verdict and the full list are in the summary comment.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 3 new findings on 98e41b1. The verdict and the full list are in the summary comment.

thymikee and others added 9 commits November 16, 2026 22:42
…ion wait

The helper's input-tap and key actions injected through the public
UiAutomation.injectInputEvent(event, sync) overload, which syncs window
animations before DOWN and after UP for up to five seconds each. While a
window animation or transition stays pending, every plain press paid up to
ten seconds even though dispatch itself was immediate (#4590). Touch plans
already avoided this since #1356.

Taps and keys now inject through UiAutomationInputDispatcher without the
animation wait. A DOWN the framework refuses reached no window, so it is
cancelled and injected once more with a fresh down time after the
framework's animation sync.

Refs #4590

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ection

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed press

Tap and key presses now share PressSequence, an Android-free policy that the
helper's JVM suite tests with a fake injector. A refused start is discarded
and retried once after the animation sync. When the runtime skips the
animation wait but cannot sync separately, the press fails with its own
outcome and error type instead of reporting a refusal. A refused end is not
cancelled, because the injection verifier has already recorded it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Synchronous injection reports a dispatch timeout and a drop alike as false,
but the dispatcher starts its 30 s deadline when the call enters it, so only
a refusal at least that long after the call can be a timeout. A timed-out
start was enqueued and reaches the receiver, so it is now released (touch:
ACTION_CANCEL, key: ACTION_UP with FLAG_CANCELED) and reported as its own
outcome instead of being followed by a second start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thout an end

The outcome-to-exception mapping moves from AutomationCommandHandler into
PressSequence, next to the outcome it maps, so the JVM suite covers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… outcomes

- Taps and touch plans build their finger events through TouchEvents.
- A dropped start on a runtime that injects through the public overload
  fails at once, without a discard, as it did before this change.
- A discard or cancel that throws no longer replaces the press outcome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ancel

A synchronous injection can block until the framework's 30 s deadline, so a
press that waited it out answered after the host's 30 s input timeout and
lost its typed result. The helper now bounds each press by a 40 s budget:
the retry of a dropped start runs only when the animation sync and its own
deadline fit, and an end that does not fit is injected without waiting for
dispatch. The host waits 45 s for helper input; a repo guard keeps that above
the press budget.

A timed-out start whose cancel is refused now says so in its timeout
instead of claiming it was cancelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…try by the host budget

Replaces the timing-based timeout classification, the cancel-result
outcomes, the async end injection and the helper's fixed press budget with
one rule. Every refused start is released (touch: ACTION_CANCEL, key: a
canceled ACTION_UP), which covers both a dropped start and one that timed
out after delivery. The start is retried at most once, only when the host's
remaining budget, now sent with each input command, still fits the
animation sync and the retry's injection deadline. Fill's tap uses the same
command deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the t3/android-press-timeout branch from d494475 to 53dd31c Compare November 16, 2026 21:43

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 53dd31c. The verdict and the full list are in the summary comment.

…ning deadline

The host now waits for an input command until the earlier of its input cap
and the request's own deadline, and sends the helper that wait less its
answer margin, instead of a fixed budget. A request near its deadline sends
a small budget, so the helper skips a retry it could not finish in time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Thanks for the update. At 53dd31c the code fixes the earlier concerns: refusals now throw "injection was refused", the host input timeout is 45 s, fill shares the single command deadline, the async end path is gone, and no outcome depends on elapsed time around an injection. The one thing still missing is live evidence at this head.

The only device run is at 4f4140a. It predates PressSequence, TouchEvents, the release of every refused start, and budgetMs. So the retry and release path (no stuck touch after a refused DOWN) has unit coverage only, and the latency gain is unmeasured at this head. This change is device-facing, so it needs a live run at 53dd31c. On an API 34+ emulator, please post ABAB main-vs-head p50/p95 for press x y right after an activity transition, while an RN Modal slides in, and idle, plus one press after a key that reaches the key path. Please also include one run that forces the refused-DOWN retry (transition at animator scale 50), with logcat showing no "Inconsistent event" or stuck-pointer warnings and a follow-up press that lands. Name the SHA and the helper version, and update the PR body Validation section.

The Coverage job failed at 53dd31c. Please check whether the new TS test or the automation-helper.ts change causes it. The other checks are still running.

These five inline threads are fixed at this head, so they can be resolved: cancelled message gone, 45 s host timeout, fill shares one deadline, async end path deleted, timing-based classification removed.

Not blocking, take or leave: the comment at AutomationCommandHandler.java:61 says every press answers by the deadline, but the deadline is checked only before the retry, and the synchronous end() can still block up to 30 s after a slow accepted start, so rewording it to "every retry decision is bounded by this deadline" would be accurate; the android.view.InputDevice import in TouchPlanInjector.java is now unused; and the PR body still says "3 files" and cites 4f4140a, without mentioning budgetMs, the 45 s input timeout, or the release of every refused start.

Before merge, please post the live run at the current head and clear the Coverage failure. This review covers 53dd31c; 604873e (press budget from the remaining request deadline) landed after it and will be reviewed next.

A provider-supplied helper can be newer than its host, which then sends no
budgetMs; that press is no longer refused with a JSONException but runs
without a retry. Also states why the retry reserves the sync and the
retried start but not the end, and drops an unused import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on f728193. The verdict and the full list are in the summary comment.

thymikee and others added 2 commits November 16, 2026 23:09
The host now admits helper input at one point: when the request's remaining
time, less the answer margin, cannot cover one synchronous injection's 30 s
framework deadline, the press is refused with the typed reason
android-input-budget-exhausted before anything reaches the helper, so the
host can never stop waiting mid-injection and tear the shared session down.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on b2765da. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

Live evidence at head, replying to #4609 (comment).

Build under test

  • Head: b23aeaa700 (the current head b2765daa6f only renames a catch parameter in a TS test). Main: merge base a30accf380.
  • Device: emulator-5556, Android 15 (API 35). Both helpers are 0.21.39-dev (versionCode 21039), built with pnpm build && pnpm build:android (head) and scripts/package-android-helper.sh in a detached main worktree (main).
  • How I confirmed the head build was installed: in every block the script read back the installed APK's SHA-256 with adb shell sha256sum $(pm path …). Head blocks showed d2c94706…f235eb, matching the head dist checksum; main blocks showed 64463ad0…26d0. snapshot -i --json reported backend android-helper, helperVersion 0.21.39-dev.

ABAB main vs head: 3 blocks × 5 per arm, so 15 per arm per route. The daemon is the same in both arms; only the helper APK differs. 0 failures, Inconsistent event = 0 and pointers already down = 0 in every block. Host load average was 8–15.

route target and activation check main p50 / p95 head p50 / p95 activated (main / head)
1. press 219 1270 right after the Settings → Battery transition (window/transition scale 50) Battery Saver row, page shows "Use Battery Saver" 10.34 / 10.43 s 5.52 / 5.68 s 15/15 / 15/15
2. press 540 444 while the RN Modal slides in (scale 50) close-button position, sheet closed? 4.12 / 4.17 s 0.28 / 0.31 s close button hit 15/15 / 0/15 (tap hit the in-flight sheet)
3. idle press 540 920 on static text still on Battery 0.27 / 0.29 s 0.28 / 0.31 s 15/15 / 15/15
4. helper key back from Battery Settings home shown 0.82 / 0.91 s 0.30 / 0.35 s 15/15 / 15/15

Route 2 shows the behaviour change in the PR body. Main waits up to 5 s for the slide to finish and then taps the settled close button. Head taps whatever is under the point at that moment, which is the sheet still moving in. That matches touch plans and the adb fallback.

In route 1, head blocks logged 5 no touchable window drops per block. Those are the refused DOWNs taking the release-then-retry path, and every one landed.

Forced refused-DOWN retry (window, transition and animator scale 50; head helper SHA verified as above):

press 219 1270 during the Battery transition -> success, rc=0, 5.54 s; page shows "Use Battery Saver" (landed)
follow-up press 73 205 (Navigate up)         -> success; Battery page shows "Battery usage" (landed)
logcat:
I InputDispatcher: Dropping event because there is no touchable window at (219.0, 1270.0) on display 0.
W InputManager: Input event injection from pid 1316 failed.          <- refused DOWN
W InputDispatcher: Asynchronous input event injection failed.        <- its released CANCEL, dropped (no touch held)
I InputDispatcher: Dropping event because there is no touchable window at (73.0, 205.0) on display 0.
W InputManager: Input event injection from pid 1638 failed.
W InputDispatcher: Asynchronous input event injection failed.
inconsistent_event=0 pointers_already_down=0
scales restored: window/transition/animator = 1

The follow-up press also hit one refused DOWN, because the scale-50 window animation was still settling, and it landed after its retry. No verifier or stuck-pointer warnings appeared.

CI: Coverage passes at the head. The earlier failure was the touch-helper-session test missing the new budgetMs field, fixed in 604873ef4c. Lint, Typecheck & Package, Integration, Smoke and Repo Guards pass.

Your non-blocking notes:

  • The comment at AutomationCommandHandler.input now says the deadline bounds every retry decision.
  • The unused InputDevice import in TouchPlanInjector is gone.
  • The PR body now lists the files, budgetMs, the 45 s input timeout, the release of refused starts, and this run.

Since your review at 53dd31c:

  • budgetMs comes from the request's remaining deadline.
  • A payload without a budget runs as a no-retry press, because a provider-supplied helper can be newer than its host.
  • The host refuses a press, before sending it, when the request has no room for one injection.

thymikee and others added 2 commits November 16, 2026 23:27
…efusal skips the fallback

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… before typing

The host refused any press whose request had under 35 s left, because its
admission minimum was a full 30 s injection plus the answer margin. It now
admits a press when the remaining wait covers one attempt (2 s) and sends
the helper the wait less the margin, down to zero, which only rules out the
retry. Fill checks once after its focus tap that the accessibility
interaction timeout still fits before entering text, and a helper whose host
sends no budget assumes the older host's 30 s wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Live evidence at the current head, replying to #4609 (comment). This replaces my b23aeaa run: 818a200 changes the helper's fill and host admission, so I reran everything.

Build under test

  • Head: 818a200b42. Main: merge base a30accf380.
  • Device: emulator-5556, Android 15 (API 35). Both helpers are 0.21.39-dev (versionCode 21039). Head was built with pnpm build && pnpm build:android; main with scripts/package-android-helper.sh in a detached main worktree.
  • How I confirmed the head build was installed: every block read back the installed APK's SHA-256 (adb shell sha256sum $(pm path …)). Head blocks showed 6f9378a9…292700, equal to the head dist checksum; main blocks showed 64463ad0…26d0. snapshot -i --json reported backend android-helper, helperVersion 0.21.39-dev.

ABAB main vs head: 3 blocks × 5 per arm, so 15 per arm per route. The daemon is the same in both arms; only the helper APK differs. 0 failures. Inconsistent event = 0 and pointers already down = 0 in every block. Host load average was 8–19.

route target and activation check main p50 / p95 head p50 / p95 activated (main / head)
1. press 219 1270 right after the Settings → Battery transition (scale 50) Battery Saver row, page shows "Use Battery Saver" 10.41 / 10.55 s 5.52 / 5.81 s 15/15 / 15/15
2. press 540 444 while the RN Modal slides in (scale 50) close-button position, sheet closed? 4.15 / 4.24 s 0.33 / 0.37 s button hit 15/15 / 0/15 (tap hit the in-flight sheet)
3. idle press 540 920 on static text still on Battery 0.27 / 0.30 s 0.30 / 0.34 s 15/15 / 15/15
4. helper key back from Battery Settings home shown 0.82 / 0.88 s 0.34 / 0.46 s 15/15 / 15/15

Route 2 is the documented behaviour change. Main waits up to 5 s and then taps the settled button. Head taps what is under the point now, which is the sheet still moving in, the same as touch plans and the adb fallback.

In route 1, head logged 5 no touchable window drops per block. Those are refused DOWNs that took the release-then-retry path, and all of them landed.

Forced refused-DOWN retry (window, transition and animator scale 50; installed helper SHA equal to the head dist):

press 219 1270 during the Battery transition -> success, rc=0, 5.59 s; page shows "Use Battery Saver" (landed)
follow-up press 73 205 (Navigate up)         -> success; Battery page shows "Battery usage" (landed)
logcat:
I InputDispatcher: Dropping event because there is no touchable window at (219.0, 1270.0) on display 0.
W InputManager: Input event injection from pid 17966 failed.     <- refused DOWN
W InputDispatcher: Asynchronous input event injection failed.   <- its released CANCEL, dropped (no touch held)
inconsistent_event=0 pointers_already_down=0
scales restored: window/transition/animator = 1

CI at 818a200: Coverage, Lint, Typecheck & Package, Integration, Smoke and Repo Guards pass; the last check (Apex Sentinel) is still running.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 818a200. The verdict and the full list are in the summary comment.

Moves fill's post-tap budget check into requireTextEntryTime, unchanged, so
the helper's JVM suite covers both sides of its 5 s boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

I found no code problems at 218e157. The fixes from my earlier review (#4609 (comment)) are in place, and the live-run evidence it asked for is now provided.

The open inline threads no longer apply. These are fixed at the head: #4609 (comment) (cancel message), #4609 (comment) (fill deadline), #4609 (comment) (async end path), #4609 (comment) (timeout classification), #4609 (comment) (missing budget), #4609 (comment) (press admission), #4609 (comment) (admission minimum) and #4609 (comment) (input budget comment). These were withdrawn as not a problem: #4609 (comment) (recycled key event; the timeout path is deleted), #4609 (comment) (65 s reservation; it cannot fit the press budget), #4609 (comment) (first start and blocking end; host admission bounds the start) and #4609 (comment) (fill budget; it ends in a typed InputBudgetExhausted). Please resolve these threads.

The live run was done at 818a200, not at the head. The only production change since then is the extraction into requireTextEntryTime, so no rerun is needed. The live evidence covers one API level (35, emulator). The API < 34 path was not run live. The fill InputBudgetExhausted path, the host android-input-budget-exhausted refusal and a forced key-press retry were also not run live. Unit tests cover them.

CI is still running on the head. Smoke, Coverage, Repo Guards, Numeric Ranges, Analyze and Apex Sentinel are in progress, and none has failed. Smoke, Coverage and Repo Guards cover the changed code. The author reports they passed at 818a200, and the change since then is a Java extraction plus a JVM test. There are no conflicts. Before merge, those checks need to finish green at 218e157.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 16, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Live evidence at the current head, replying to #4609 (comment). This supersedes the 818a200 run: 218e157 moved fill's post-tap budget check into a tested method, so I reran on the exact head.

Build under test

  • Head: 218e157c4f. Main: merge base a30accf380.
  • Device: emulator-5556, Android 15 (API 35). Both helpers are 0.21.39-dev (versionCode 21039). Head was built with pnpm build && pnpm build:android; main with scripts/package-android-helper.sh in a detached main worktree.
  • How I confirmed the head build was installed: every block read back the installed APK's SHA-256 with adb shell sha256sum $(pm path …). Head blocks showed 8e2ab2c9…7b7d19, equal to the head dist checksum; main blocks showed 64463ad0…26d0. snapshot -i --json reported backend android-helper, helperVersion 0.21.39-dev.

ABAB main vs head: 3 blocks × 5 per arm, so 15 per arm per route. The daemon is the same in both arms; only the helper APK differs. 0 failures. Inconsistent event = 0 and pointers already down = 0 in every block. Host load average was 11–35: other work started on the machine mid-run, which widened some p95s.

route target and activation check main p50 / p95 head p50 / p95 activated (main / head)
1. press 219 1270 right after the Settings → Battery transition (scale 50) Battery Saver row, page shows "Use Battery Saver" 10.47 / 10.72 s 5.93 / 6.83 s 15/15 / 15/15
2. press 540 444 while the RN Modal slides in (scale 50) close-button position, sheet closed? 4.11 / 4.28 s 0.40 / 0.56 s button hit 15/15 / 0/15 (tap hit the in-flight sheet)
3. idle press 540 920 on static text still on Battery 0.30 / 0.40 s 0.32 / 0.43 s 15/15 / 15/15
4. helper key back from Battery Settings home shown 0.93 / 2.02 s 0.38 / 0.50 s 15/15 / 15/15

Route 2 is the documented behaviour change: main waits up to 5 s and taps the settled button, while head taps what is under the point now.

In route 1, head logged 5 no touchable window drops per block. Those are refused DOWNs that were released and retried, and every one landed.

Forced refused-DOWN retry (window, transition and animator scale 50; installed helper SHA equal to the head dist):

press 219 1270 during the Battery transition -> success, rc=0, 5.58 s; page shows "Use Battery Saver" (landed)
follow-up press 73 205 (Navigate up)         -> success; Battery page shows "Battery usage" (landed)
logcat:
I InputDispatcher: Dropping event because there is no touchable window at (219.0, 1270.0) on display 0.
W InputManager: Input event injection from pid 2645 failed.     <- refused DOWN
W InputDispatcher: Asynchronous input event injection failed.   <- its released CANCEL, dropped (no touch held)
inconsistent_event=0 pointers_already_down=0
scales restored: window/transition/animator = 1

Live fill through the head helper: fill id=field-name "Ada Lovelace" on the Agent Device Tester Form tab returned success ("Filled 12 chars"), and the snapshot shows the field with "Ada Lovelace".

CI: green at 218e157c4f (18 pass, 2 skipped). No review threads are open.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant