Repository navigation
fix(android): require acknowledgements for test IME typing - #4722
Conversation
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 4 new findings on d7045ea. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
|
The code at 3ecac96 looks right to me, but the live Android evidence does not cover it yet. The recorded device run was made at d7045ea, where the receiver ran The next three points are smaller but affect behavior. First, a failed commit never reaches the retry: only a Could the capability probe go? The v2 ordered ack and the code-point chunking look right, but Not blocking: you can take or leave dropping the six new names re-exported from the public The four inline threads from the earlier review round no longer apply at 3ecac96, so they can be resolved: worker thread in the receiver (r4622453697), no-input-connection retry (r4622453724), plain-text byte bound (r4622453728), and already-matching clear read-back (r4622453738); each is fixed at this head. All 17 checks pass at 3ecac96. The unit and provider-scenario suites cover the host route through fakes, but CI does not build or run the native helper on a device. Before merge, we need the head-built Android run above, and a decision on the capability probe. |
|
Review follow-up. Head: 1. A failed dispatch now gets the rebind retry. A 2. 3. Surrogate-pair test. The string now starts with 4. README and receiver. 5. User doc. 6. The capability probe is removed. I removed 7. Optional items. I removed the six new re-exports from 8. Inline threads. r4622453697, r4622453724, r4622453728 and r4622453738 are resolved. Live run: pending. Reason: shared emulator busy. Another session owns emulator-5554. A separate run on a head-built helper and CLI follows on a different emulator. That run will record (a) to (f) at this head. Results from Checks. Focused unit tests pass ( |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 697f7b9. The verdict and the full list are in the summary comment.
Live Android run at 697f7b9This run covers head
(a)(b)The input is 23,999 + 1,002 = 25,001. The read-back shows an exact prefix, but only 5,000 units. On this image, the lab app field keeps at most 5,000 UTF-16 units. The cap is in the field, not in the helper. Control test: I typed 6,000 ASCII characters after (c)(d)I built the helper from Then I removed the old helper and installed the head-built helper again. The same refusal also occurred without a planned test. During the run, a process outside this session set the default IME back to Gboard 3 times (device time 11:46:12, 11:51:58 and 11:56:25). After each reset, the helper service was not bound. (e)I opened the Home tab, which has no text field ( No text appeared on the screen. Thus, on this device, (f)I ran Cleanup: I closed the session, and the default IME is Gboard again. I did not add an adb forward or reverse. The emulator is still running. The raw logs are in the worktree under |
|
Thanks for the update. At 697f7b9, the earlier findings from the 3ecac96 review look fixed in the code: the receiver no longer needs a worker thread, the retry covers the no-input-connection and commit-returned-false cases, the plain input branch rejects text over the size bound, and a mismatching read-back after a clear now retries. One thing remains. This head changes the native receiver ( Not blocking: known-limitations.md:41 names only On the open inline threads: the thread on clear/retry routing and thread on the receiver thread look fixed at this head, as do the threads on the size bound and the clear read-back, so you can resolve them. The thread on failure reason codes in CLI help does not apply: versioned help does not list reason codes for On CI, the Smoke Tests failure looks unrelated. It fails at Before merge, please post the head-built Android run above and make sure Coverage passes. |
Live Android run at f4ad9a5 (new head)This run covers the new head
The fix for (e)On 697f7b9,
The helper now finds the focused editor before each commit or clear. It returns code 3 (
(a)(b)The input is "exact match True" compares the full read-back with the input. (c)(d)I built the helper from Then I closed the session, uninstalled the old helper, and installed the head-built helper again. A check (e)Lab app, Home tab after a focused field ( Settings home, opened with no editor: Control with a real editor (Settings search): Note: for (f)I ran Limitation: I cleared the main log buffer once, before (b). Thus the dump does not hold the first (a) run. I ran (a) again after (b). The dump holds that run and all later steps. Other notes
|
|
This PR is ready at f4ad9a5. The focus check in the native helper fixes what the earlier review at 697f7b9 left open (#4722 (comment)), and the live evidence now covers the routes that matter. Not blocking: the new host test in The focus check ran live only on an API 36 emulator, against a React Native EditText and the Settings search field. WebView, Compose, Flutter and API 23-35 were not exercised. If the app's UI thread stays busy for about 2 s, All five earlier inline threads can be resolved. The receiver thread (#4722 (comment)), the retry conditions (#4722 (comment)), the size bound (#4722 (comment)) and the clear read-back (#4722 (comment)) are fixed at this head. The thread on reason codes in help (#4722 (comment)) does not apply: the behavior is in Smoke Tests (Android, iOS, macOS) are still running. None has failed. The delta touches only the native helper, one host test and one doc line, so iOS and macOS smoke do not reach it. No conflicts. Merge once those checks finish green, or fail on a route outside Android text input. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding and 1 moved to a new line on f4ad9a5. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The retry-gate fix in f265d1f looks right in code. The no-input-connection retry now counts only acknowledged text chunks, so a clear followed by code 3 reaches the rebind, and the new unit cases cover that path. The earlier review at f4ad9a5 (#4722 (comment)) found nothing, and the remaining gap is evidence for the new branch. The branch at text-input.ts:349 retries a device-facing fill after an acknowledged clear and a no-input-connection answer. The PR validation and the linked emulator run cover f4ad9a5, which predates this branch, so no live result covers the changed route. Please run the current head on an Android emulator through the test IME fill route where an acknowledged clear is followed by no-input-connection. Record the source SHA, device, commands, the single recovery attempt, and the final field value in the PR evidence. If the race cannot be triggered on demand, please say so and show the closest route you reached. Of the two open inline threads, the retry-gate one (#4722 (comment)) is fixed at this head and can be resolved. The reason-code one (#4722 (comment)) does not apply: versioned help does not list per-command reason codes, and the behavior is in known-limitations.md and the typed constants in input-validation.ts. It can also be resolved. All 17 test checks pass at this head. There are no conflicts. Before merge, please post the live evidence above. The ready-for-human label is removed until then, because this head changes a device-facing route after the last live run. |
Live Android run at f265d1f: clear acked, then code 3, then one recoveryThis run covers the head
How I triggered the raceThe text is The window between the clear ack and the first text chunk is about 60-150 ms. The TAB landed in that window in every attempt. Result (attempt 20, raw lines, codes and lengths only)The CLI JSON has no retry field. The logcat shows the retry.
Every hit had exactly one rebind and exactly two clears. Thus the fill made one recovery attempt, and no second one. Other notes
|
|
Head Two minor Sentinel findings were handled. One is fixed. One needed no code change. The Only host retry routing changed. There is no native change. The live run at The help-text finding stands as answered. Versioned help lists no per-command reason codes for Three unit tests cover the routing. Two of them fail at |
|
This now conflicts with |
…knowledgement (#4520) The test IME helper previously dropped null-InputConnection input, silently truncated text at 32_000 UTF-16 units and ignored commitText's boolean, while the host checked only the broadcast process exit code — so type could report success over a dropped or truncated payload (reproduced on Pixel_7_CI: CLI "Typed 33000 chars" with the receiver committing 32_000). Helper (android-ime-helper-v2): every known action now answers with an ordered result (goAsync + setResult) that `am broadcast` prints as "Broadcast completed: result=<code>, data=...". Finite non-zero code set (committed / commit-returned-false / no-input-connection / rejected-payload / protocol-mismatch / probe-ok); result data and logs carry codes and lengths only, never user text. The 32_000-unit silent truncation is removed; payloads above the declared 64_000-base64-char (48_000-byte) bound are rejected with a code. Measured on-device (Pixel 7, API 36): delivery+commit verified up to the bound, the adb-shell channel itself breaks between 65_000 and 66_000 chars, and result=0 is exactly what a no-receiver or pre-ack helper prints. Host: probe the running receiver's ack capability per device (artifact metadata cannot prove it — version policy treats a newer-installed helper as current); result=0/unparseable refuses with android_ime_helper_no_ack, never optimistic success and no fallback. Type/fill dispatch text in code-point-safe chunks within the declared byte bound; every chunk must ack committed with a matching attempted UTF-16 length or the command fails truthfully with android_ime_helper_dispatch_rejected plus dispatched-chunk evidence. An ack is attempted dispatch only — fill keeps its single read-back owner. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
commitText returns true even when no view receives the text. The helper now treats the client binding's placeholder connection and a deactivated started connection (getTextBeforeCursor returns null) as no focused editor, so type reports no-input-connection instead of false success.
The rebind retry was gated on dispatchedSteps, which also counts the clear. A text chunk that answers no-input-connection after that clear committed left the field cleared and unfilled. Gate the retry on the attempt's own acked text chunks instead: no acked text means the helper proves nothing of this attempt landed, so the rebind and one retry still apply. Text the helper already acknowledged ends the fill instead of committing twice, and a rejection from the retried attempt still propagates.
The new fill-retry cases pushed text-input-test-ime.test.ts past the 1000-line lint cap. The acknowledgement-driven rebind-and-retry cases move to text-input-test-ime-retry.test.ts, and the broadcast ack, the field it writes, and the packaged helper artifact they share move to a fixtures file beside both files. No production change.
f265d1f to
2f90a08
Compare
|
Rebased onto main at
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 2f90a08. The verdict and the full list are in the summary comment.
|
This PR is ready at de20ed2. The earlier conflict is gone, no conflicts remain, and the Android no-ack case now reports whether no receiver answered or the ack was unreadable, with the reinstall hint only for the first. The new test covers it. Not blocking: in packages/platform-android/src/ime-helper.ts:70, The open inline thread on the no-ack cause is fixed at this head, so it can be resolved: #4722 (comment) Checks are still running at de20ed2 (Smoke Tests, Smoke Tests iOS and macOS, Analyze, Coverage), and none has failed. The Android smoke route covers the test-IME type and fill path this PR changes. The live device evidence comes from the PR. Before merge, the checks must go green at this head. |
Apex Sentinel · ✅ Approve · review of
|
| 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.
* origin/main: (70 commits) refactor(apple-runner): one RUNNER_ERROR_CODES row per runner error code with parity/docs gates (callstack#4774) fix(android): require acknowledgements for test IME typing (callstack#4722) feat(scroll): add scroll refresh for pull-to-refresh (callstack#4770) refactor(host-kit): add request Scope and use it for the wait capture deadline (callstack#4794) fix(android): let permission all change nothing on an app that declares no permissions (callstack#4796) fix(cli): replace the CLI session and generated remote config instead of rewriting them in place (callstack#4797) fix(host-kit): accept a group-writable script directory the user owns (callstack#4799) fix(cli): escape control characters at the CLI's stdout and stderr writes (callstack#4778) fix(audit): do not report rows under a persistent bar that scrolling reveals (callstack#4775) fix(daemon): refuse an unsafe state directory before first use (callstack#4783) refactor: settle remaining single-deadline races through settleWithin (callstack#4788) refactor(host-kit): settle deadline races via settleWithin with R87 race ratchet (callstack#4766) fix(android): authenticate and bound persistent snapshot helper sessions (callstack#4729) fix(daemon): bound upload ingress and finalization (callstack#4721) chore(gates): ratchet wire-published reason literals by value (R89) (callstack#4779) feat(audit): evaluate role-less clickable views on Android (callstack#4780) fix(mutation): keep umask-setting tests out of Stryker's thread pool (callstack#4785) feat(audit): report controls that share one accessible name (callstack#4771) fix(contracts): pair open runtime hints with their apply operation (callstack#4754) refactor(daemon): report startup progress over the launch channel instead of marker files (callstack#4777) ...
* origin/main: feat(gesture): hold before the move with gesture pan --hold-ms (#4767) docs: clarify device verification and security proposals (#4805) fix(daemon-client): say that a hung daemon is stopped before ensureDaemon starts a new one (#4803) test: remove five timing races from CI (#4800) refactor(remote): save a remote script from memory with the local publisher (#4802) refactor(apple-runner): one RUNNER_ERROR_CODES row per runner error code with parity/docs gates (#4774) fix(android): require acknowledgements for test IME typing (#4722) feat(scroll): add scroll refresh for pull-to-refresh (#4770) refactor(host-kit): add request Scope and use it for the wait capture deadline (#4794) fix(android): let permission all change nothing on an app that declares no permissions (#4796) fix(cli): replace the CLI session and generated remote config instead of rewriting them in place (#4797) fix(host-kit): accept a group-writable script directory the user owns (#4799)
Summary
Require an ordered acknowledgement from the Android test IME and split large text on code-point boundaries. The acknowledgement reports attempted UTF-16 length and the editor API result. Fill still verifies the resulting field value through its existing readback.
The v2 receiver returns codes and lengths only. A helper without v2 acknowledgement support refuses typing with a reinstall hint. Bundled helpers upgrade with the CLI. With no focused editor, the helper returns
no-input-connectioninstead of a false success. Refs #4520.Validation
Base
6e18ea3349685f3cf6cec4c2e6d1104980ab2738; tested headf265d1f9a09f7128379d89f24d6e1e031d8d7b2a.pnpm check:affected --run --head f265d1f9a0passed: 42 checks, 25 hosted or parked skips,exactCommit=true. Its first run failed only onvitest-related: two unrelated provider-integration scenarios could not attach to a live daemon, cause unproven. Both pass solo, and one rerun passed. Earlier headf4ad9a57749had the same receipt.f4ad9a5774on emulator Pixel_7_CI (Android 16), CLI and helper built from it: fix(android): require acknowledgements for test IME typing #4722 (comment). Later heads change host retry routing and its tests only, so this run still covers the helper.typereturned ok withcommitText code=1.code=1acks.typeandfillread back the full text exactly in a multiline field.fillread back exactly, also when the field already held the value.android_ime_helper_no_ackand the reinstall hint. The field did not change.typereportsno-input-connection.f265d1f9a0on the same emulator: a test-IMEfillwhose clear was acked and whose first text chunk gotno-input-connectionmade one rebind and one recovery attempt, then read back exactly (19 of 19 forced attempts): fix(android): require acknowledgements for test IME typing #4722 (comment)Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.