Skip to content

macOS engine: type_text after a key equivalent can answer unconfirmed with the text correct (stale before-snapshot) #386

Closed

Description

@SSFSKIM

Problem

#354's type_text read-back takes its before-snapshot when the request arrives. If the previous key equivalent's effect (Cmd+V, for example) hasn't landed yet, the snapshot is stale. The expected value is then computed from text that no longer stands, and a correct result answers typeUnconfirmed.

Measured in #354's hosted A/B (run 43752829833): of 296 branch unconfirmed answers in the race cells, 65 had the field correct, and all 65 were already correct within 1–5 ms of the answer. So a longer read-back budget doesn't help. In Chrome for Testing's Cmd+V cell, 30 of 40 were this case. In one example the expected length was 59, computed without the paste, while AX already read the correct 81.

These answers are safe (unconfirmed, never a false success), but the agent is told to check text that is in fact right.

Constraint

#354's spike found no fence that survives: effects land arbitrarily late. So a fixed settle wait before the snapshot can lower the rate but not remove it.

Ideas to measure

  • A short settle before the snapshot only when the previous request on that app was a key equivalent, measured for how many false unconfirmeds it removes and what it costs.
  • When the read-back mismatches, check whether it equals the expected text with the previous key's effect applied (the paste's clipboard text inserted), and answer with that distinction.

Check

In the A/B's race cells, the branch's unconfirmed answers whose field was correct fall well below 65/296, with 0 wrong successes kept.

Spawned by #354. Documented as a known cost in #354's docs: "unconfirmed after a key equivalent may mean the text is right: observe".

Activity

  1. added
    enhancement
    status:ready-for-implementer
    priority:P3
    on Nov 15, 2026
  2. SSFSKIM commented on Nov 17, 2026

    @SSFSKIM
    OwnerAuthor

    Closed by #354's settle (PR #396, cua 0.28.4, cde920f; ruling 754). In the race cells, a type right after a key, the false unconfirmed count with the final field correct fell from 30 to 3 in Safari, 95 to 7 in Chrome for Testing, and 162 to 6 in Firefox, of 240 each (run 44031200818, before 3141f17 vs after a7529ee), with 0 wrong successes. Clean cells: 720/720 confirmed. The settle runs only after a key posted to the same pid within 1 s: 1–2 reads, ~50–60 ms p50 added to the snapshot. A no-key call pays nothing. The remaining refusals (12 valueMismatch, 4 Firefox rangeUnreadable) are stated in #354's docs as the known cost: unconfirmed after a key equivalent may mean the text is right, so observe.

  3. added
    status:in-progress
    and removed
    status:ready-for-implementer
    on Nov 17, 2026
  4. SSFSKIM commented on Nov 17, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-progress: Resolved inside #354

  5. added
    status:in-review
    and removed
    status:in-progress
    on Nov 17, 2026
  6. SSFSKIM commented on Nov 17, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-review: Landed in #354's PR

  7. removed
    status:in-review
    on Nov 17, 2026
  8. SSFSKIM commented on Nov 17, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: Resolved by #354's settle (PR #396, 0.28.4)

  9. SSFSKIM commented on Nov 17, 2026

    @SSFSKIM
    OwnerAuthor

    Additional measurement from #359 on main 15acf09 (includes #354/#360/#366), run https://github.com/SSFSKIM/cua/actions/runs/44107967517, kit 6f8c739. Of 2,677 scorable typing answers, 181 were typeUnconfirmed although every final DOM value and all 543 tail samples were exactly NEW359 with caret [6,0]. Plain natural click: 75/437 (65 script-selection,10 Cmd+A); plain no-click:42/480 (all script-selection); instrumented candidates:64, kept separate. Reasons are177 valueMismatch,2 fieldUnreadable,2 fieldChanged; no truncation/cap/settle-cap reason. All177 mismatch errors show correct actual AX text NEW359 (length6), but expect the full29-character seed plus insertion (length35). This is baseline/confirmation disagreement, not a wrong final replacement. The script-only no-click cases are outside this ticket’s key-only settle trigger. Current evidence does not log the actual before-snapshot or prove a new root cause; #359’s separate real select_text/Cmd+A follow-up is being used to distinguish ordinary agent flows from fixture-script-only cache lag. No reopening or product change is claimed by this comment.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:P3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions