Skip to content

Engine: a coordinate click whose screenshot target has moved, gone or been replaced is refused, nothing posted or pressed, on every route including #282's element route (#296) - #300

Merged
SSFSKIM merged 13 commits into
mainfrom
fix/296-stale-point
Nov 6, 2026

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

A coordinate click or drag start whose screenshot target has moved, gone or been replaced is now refused, with nothing posted or pressed. Before this, cua posted at the screenshot point blindly and answered success, so a model clicking from a screenshot the app had since re-laid out hit whatever was there now. #294 found the case: Chrome for Testing's toolbar re-layout moved Reload, and the click landed on Forward. The hosted A/B also showed main pressing Delete for Save, the wrong row of a scrolled list, a later feed item, and a link that replaced a button.

The vendor posts blindly here. This refusal is cua's own, and the limits below state it.

Closes #296

The rule

The design session's rulings are 1ea561bc ee29283e, 0c0b70f0, ca82a6f4, 0a14b51f and 2db3ba75. The full text is in the spec's #296 Decision Log entry.

  • Recording. At every observation that returns a screenshot, the engine records each tree node's frame, title and description, plus the window's origin.
  • The check. At a coordinate click (any button and count, every route, both modes) or a drag's start, it takes the deepest recorded node at the point, in the screenshot's space, so a moved window is compensated. That node counts as found when either:
    • its live handle has a re-read frame that still holds the posted point; or
    • a re-created handle is found among the hit, its ancestors and its first 300 descendants, with the same role, a frame within 2 pt, and the same title or description where both are readable.
  • The empty-hit retry. An empty or unreadable hit while the handle is dead is hit-tested again up to 3 × 50 ms. This is the re-render gap the A/B found.
  • Refusal. The click is refused when the node is gone, its frame has moved off the point, or a different interactive element now answers there. A non-interactive hit inside the node passes. The error, screenChangedSinceScreenshot, names what the screenshot showed and what is there now, and asks for a new screenshot.
  • macOS engine: a left click into a background Chrome page is swallowed as the window's activating click, and cua reports success #282's element route (background Chrome pages, shared desktop) is guarded too:
  • The meta, cua/stalePoint {verdict kept|refused, reason, identity, recordedRole, hitRole, rechecked, afterActivation, ms}, says which reading applied, including unrecordedDescendant and unrecorded where nothing could be checked. Observations carry stalePointRecordMs.
  • Plugin 0.26.0. The first-call document names the refusal.

Limits

  • (i) A control re-created with a changed label is refused. For example, a re-render of 'Like (12)' as 'Like (13)'. This is the safe direction, and the error asks for a new screenshot.
  • (ii) A surviving handle relabelled in place passes, and a live container relabelled in place keeps its interior. For example, Save becoming Delete on the same element. Refusing that would refuse every control whose own label ticks. This is Engine: a control relabelled in place (same handle, Save to Delete) passes the stale-point guard #298.
  • (iii) A hit in another window over the point reads as no hit, and passes while the node is in place.
  • (iv) cua refuses where the vendor would post.
  • (v) The guarantee does not cover a point the observation could not record. Inside a subtree cut by the budget, width, depth or deadline, only the container is checked (unrecordedDescendant). A point in no recorded node is not checked (unrecorded). How often real pages hit this is Spike: how often real pages truncate the observation, leaving clicks the stale-point guard can't check #299.

Live proof (GitHub-hosted macOS runners, 2 reps, branch against main d482bcc)

Evidence: docs/evidence/2026-11-06-stale-point/ (four runs; the final section is the head's).

Before the build: the false-positive spike. https://github.com/SSFSKIM/cua/actions/runs/42179036967 and https://github.com/SSFSKIM/cua/actions/runs/42180641939 emulated the rule over 240 cells. As ruled it gave 0 false positives and 24 false negatives (same-role swaps). With the title amendment it gave 0 and 0.

The A/B on the first build: https://github.com/SSFSKIM/cua/actions/runs/42184616121 (134 branch cells), with record costs in https://github.com/SSFSKIM/cua/actions/runs/42185576996. It found:

The re-run on 7f79ca3: https://github.com/SSFSKIM/cua/actions/runs/42187363305. The rebuilt button at 20 s was kept 6 of 6, and the background Chrome cells were refused.

The final A/B on 2fdb9c9: https://github.com/SSFSKIM/cua/actions/runs/42189536608, with 72 branch cells across Chrome for Testing, Safari and a native window.

Case Branch Main
#294: Chrome toolbar Reload after the re-layout, shared and dedicated refused, frameMoved posted, no reload
Reload before the re-layout kept, reloaded reloaded
Background Chrome page (shared): feed prepend, link swap, Save swapped for Delete refused, nothing pressed AXPress on the wrong element
Background Chrome page: a fresh point kept, element-routed, rechecked, one click one click
Safari: feed, swap / ticking label at 20 s refused / kept wrong element / –
Native (shared and dedicated): swap, moved button, Like (12)→(13), removed button refused wrong element or nothing
Rebuilt button at 1 s and 20 s kept (recreated), delivered –
Limit (ii): relabelled in place kept, lands on "Delete" the same

Cost per click, stalePoint.ms, p95 in the final A/B:

  • Chrome: 6 ms for a single check. The cells that check twice around a focus hold reach 15–29 ms.
  • Safari: 6.5 ms.
  • Native: 8.6 ms.

The p95 comes from the re-created search; a live handle checks in under 1 ms.

Record cost per observation, p95: Chrome 0.9 ms, Safari 0.3 ms. Native is 0.2 ms, apart from a single 9.5 ms outlier.

Tests and review

Sminos-Session: cursor235#b93055dd (cua on macbook)

…he screenshot showed is refused, nothing posted (refs #296)

Every observation with a screenshot now records, with it, each window node's handle, role, title,
description and frame (cut by its clipping ancestors), and whether its children were all recorded.
A coordinate click (every button, count and route) and a drag's start take the deepest recorded
node at the point and check it: its own handle while its frame reads, else a handle re-created in
place among the hit, its parents (300 levels) and its first 300 descendants (same role, frame
within 2 pt, same title or description when both readable). Refused as
screenChangedSinceScreenshot when the node is gone, its frame no longer holds the point (#294:
Chrome's hit-test still answers the moved Reload), or another interactive element is hit; a
non-interactive hit inside a node in place passes. Where #282 element-routes the click the
guard is skipped; every path that would post there is refused before subtype 1 instead
(PointerHold.refusedIfPosted). The meta carries stalePoint {verdict, reason, identity?,
recordedRole?, hitRole?, ms}. Scroll is not guarded.

Sminos-Session: cursor235#b93055dd (cua on macbook)
… screenChangedSinceScreenshot reaches the model as an input error (refs #296)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…-point refusal (Table 3 addition, refs #296)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…cendant bound, the limits, the vendor divergence, the 240-cell table) and its Interfaces lines; 0.26.0 (refs #296)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ace, carries incompleteness through frameless nodes, and compares labels as the walk cuts them (refs #296)

The review of d482bcc..a7a43b0, three P2s:
- A coordinate is posted at the window's current origin, the record's frames are where the window
  lay at the capture. The record now keeps that origin; the node is chosen at the posted point less
  the window's shift, its frame read now is checked against the posted point, and a re-created
  handle is matched against the recorded frame moved by the shift.
- A frameless node is never chosen, so its unrecorded children now count against its nearest framed
  ancestor's subtreeRecorded (window, frameless group, unreached button: unrecordedDescendant).
- The record's labels are ElementData's, cut at 10,000 UTF-16 units; the label read now is cut the
  same way (and read from an attributed string too), so a long label re-created matches.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ss and the like-for-like label cut (refs #296)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…resses only the observed node or its control and checks again after its wait; an empty hit mid-replacement is re-hit (refs #296)

The design session's ruling 1ea561bc ca82a6f4 on the hosted A/B (run 42184616121): the skipped
guard read stale while the element route pressed what lay there now (item-11 for item-9, the
link Remove). Now:
- deliverPointer throws a refused point's error first, on every path, the element route
  included; the hold's refusedIfPosted and PointerPostRefused are gone, and so is the meta's
  skipped verdict.
- A kept point's route (#282's press, #283's focus) acts only on the node as found now or an
  ancestor of it (an incompletely recorded node's inside, or an unrecorded point, also pass);
  anything else is refused as pressedOther.
- After the route waited (#282's action re-read; #283's focus settle and boxes' re-read), the
  guard runs again with a fresh hit-test just before the press (StalePointGate, meta rechecked).
  #283's waits follow its focus write, so a change there places no caret
  (CaretNotPlaced.screenChanged) rather than refusing.
- The A/B's one false positive (a button replaced every 500 ms, refused nodeGone with no hit):
  with the handle gone and no real hit, the point is hit-tested again up to 3 times, 50 ms apart.
- The sentence names nothing there when the hit's role cannot be read (no "element is there now").

Sminos-Session: cursor235#b93055dd (cua on macbook)
…d path, the second check, the pressed-element rule, the re-hit bound and the A/B's two corrections (refs #296)

Sminos-Session: cursor235#b93055dd (cua on macbook)
… checked last at the perform; a truncated container passes only while it passes the guard itself (refs #296)

The re-review of c8f37a9..7f79ca3, two P2s:
- The route and its view are read from the hit the guard judged (stalePointRouteHit): a re-hit
  that recovered a re-created button now gets the web area's route and presses it, where the
  empty first hit had left a possible web area with no route.
- The final check runs just before the action is performed, after the route's focus hold
  (pressAfterFinalCheck), whose activation guard polls; after a hold the guard runs again with a
  fresh hit-test. A refusal there presses nothing; the meta says afterActivation and the sentence
  says the app was activated but nothing was pressed. The hold is left as other refusals leave it.

The design session's ruling 0a14b51f: inside a node the record holds incompletely, a post or a
press goes through (any hit role) only while that container passes the guard itself, its own
handle's label agreeing where both read (else relabelled, refused); the reason then names
unrecordedDescendant, on both paths.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…nal check at the perform, the truncated-container condition and the unrecorded limits (#299) (refs #296)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ry early exit, and its interior is unrecordedDescendant; relabelled is gone (refs #296)

The re-review of 7f79ca3..4630b68 (one P2) under the design session's ruling 2db3ba75: the
incomplete-container condition ran only for a hit strictly inside, so a container-level hit
(sameElement) or an empty hit (noHit) skipped it. The condition is now the guard's own (a live
handle whose re-read frame holds the point, no label compared; or a re-created handle by role,
frame and label), applied before those exits, and anything the point reaches inside such a
container, itself or nothing included, is reported unrecordedDescendant. The live-handle title
compare and the relabelled reason are removed (a web area whose title gains a count no longer
refuses).

Sminos-Session: cursor235#b93055dd (cua on macbook)
…sses as every node does, before every exit; a live one relabelled in place passes) and drops relabelled from the wire (refs #296)

Sminos-Session: cursor235#b93055dd (cua on macbook)
… and the Decision Log's Proven live line (refs #296)

Sminos-Session: cursor235#b93055dd (cua on macbook)
@SSFSKIM
SSFSKIM marked this pull request as ready for review November 6, 2026 09:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T09:49:36.272603Z 697ebd2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit c4057c3 into main Nov 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Engine: refuse a coordinate click whose screenshot target has moved or been replaced (stale-point guard)

1 participant