Repository navigation
macOS engine: AX text actions wait for a foreground click to land, and type_text never confirms over a selection a late click undid (#359) - #402
Merged
Conversation
…osted click to land, and type_text after select_text types only over its selection (refs #359) Ruling 1ea561bc:785 on the #359 spike: in a foreground browser a coordinate click answers once posted, but the browser can take it in up to ~0.4 s later, after a select_text, set_value or type_text's starting point. - A posted pointer press arms a per-process window (ClickOrdering.swift): within 1 s, select_text, set_value, a text field's action click, the background focus routes and type_text's snapshot first wait for a stable range (50 ms dwell, 10 ms samples, 300 ms cap). Posted keys never wait; #282/#341's accessibility route posts nothing and arms nothing. - type_text within 1 s of select_text waits for the range select_text wrote; still another at the cap, nothing is typed and it answers typeUnconfirmed (selectionChanged). - set_value inside the window watches the field after its write: another value, or a caret off its end, is valueUnconfirmed. - agent-cursor.md and its copies, PROVENANCE, the surface inventory and the native engine spec's Decision Log say so. Sminos-Session: cursor235#b93055dd (cua on macbook)
…e change (refs #359) Mutation checks found the constants' changes survived (the tests derive from them) and a value check by length alone survived the changed-value test. Sminos-Session: cursor235#b93055dd (cua on macbook)
…ing point, and set_value's watch takes only a cut prefix at the cap and stops at a field turned secure (refs #359) The review of ef998db (reviewer-high), three findings: - P1: the selection was checked on the wait's read, while the snapshot's own range read and #354's settle could adopt a click landing after it. The final starting point must now be select_text's range, else nothing is typed (selectionChanged). - P2: a value at Chromium's cap counted as written whatever it held; now only a strict prefix of the written value does, else valueChanged. - P2: the watch now re-classifies the field before every read and, once it turned secure or cannot be classified, reads nothing more and answers valueUnconfirmed (fieldClosed). Sminos-Session: cursor235#b93055dd (cua on macbook)
Brings #367 (0.28.8). Conflicts: docs-oracle.mjs (main's #367 truncation sentences and #359's two sentences both kept, byte-identical to agent-cursor.md), PROVENANCE.md (both sides' sources listed), the native engine spec's Decision Log (#367's ruling 782 entry first, then #359's two, oldest-first). Sminos-Session: cursor235#b93055dd (cua on macbook)
…posted click to land, and type_text after select_text types only over its selection (refs #359) Sminos-Session: cursor235#b93055dd (cua on macbook)
… 785, and its limits (refs #359) Sminos-Session: cursor235#b93055dd (cua on macbook)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
On macOS, a click into a field of a foreground browser could set its caret after the agent's next action, so the agent's selection was undone and text went in the wrong place. In the worst case type_text still answered success: main's Safari click → set_value → type_text gave
NEWNEW359359, confirmed.Cause (measured, not #341):
The fix (ruling 1ea561bc:785,
native/engine/Sources/Engine/ClickOrdering.swift):typeUnconfirmed(selectionChanged) and types nothing. Any other input to the app clears the record.valueUnconfirmed(valueChanged/caretMoved), never ok. At Chromium's 10k cap only a cut prefix is accepted. A field that turns secure or can't be classified stops the watch without reading (fieldClosed).agent-cursor.md (and its two copies) says what the wait is, when type_text types nothing, and that a click can still land after the wait, in which case type_text answers unconfirmed rather than claiming the text.
Evidence
The tables are in docs/evidence/2026-11-17-click-ordering/README.md. Every cell is judged against the fixture page's own DOM value and caret, never against AX.
Limits
typeUnconfirmed/valueMismatch over the wrong text. None of them answeredselectionChangedwith nothing typed, because with the click held, select_text's range was still intact at the baseline. No public signal tells when an app has consumed a posted event (CGEventPostToPid returns nothing, and AX notifications aren't per-action acknowledgements), so no wait can promise a click has landed.screenChangedSinceScreenshotrefusal on each head. It wasn't retried, so the literal 20/20 isn't shown for that cell.Verification
swift test(native/engine), on the merged head: 1,292 tests, 0 failures, 1 skipped (pre-existing).services-engine-*test, 220 tests: 219 pass, 0 fail. The one skip istest/services-engine-real.test.mjs"the untrusted engine: …", which runs only on GitHub-hosted runners.Plugin 0.28.9.
Closes #359
Sminos-Session: cursor235#b93055dd (cua on macbook)