Skip to content

#188 (part 1): the matrix's prepares stop inheriting a selection; the click's route and the focus in the meta - #255

Merged
SSFSKIM merged 4 commits into
mainfrom
fix/188-electron-field-focus
Nov 1, 2026
Merged

SSFSKIM merged 4 commits into
mainfrom
fix/188-electron-field-focus

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Hold 3 recorded four cua rows as "the field could not be given the focus" while the vendor passed them. The rows: Electron background typeText, pressKey Tab and paste @finder, plus electron/frontmost/paste.replace. That sentence is the native-matrix harness's own prepare check, not an engine error, so the keyboard actions never ran.

The check read focus only from the observation's trailer line "The focused UI element is N", which the renderer prints only when nothing is selected. Earlier rows left a selection in the same Electron field (frontmost drag.select, selectText), so a focused field read as unfocused. Hold 10's natural arm shows exactly this: AXFocused true, the app's focused element the text area, a selection present, and no focus line.

This PR makes the rows independent and the focus check unmaskable, and records the element click's route. Refs #188: acceptance is the four rows on the MacBook, judged live.

What changes

Harness (scripts/native-matrix/plan.mjs, probe-plan.mjs, steps.mjs, matrix-text.mjs):

  • A masked trailer is its own reason: "the focus could not be read: a selection masks the trailer". "The field could not be given the focus" stays for a trailer that names another element or none.
  • Clearing is a stated preparation step: prepared: ["field emptied to clear a selection"]. It runs only when a selection still masks the trailer after the click, and only where the prepare writes its own value afterwards. emptyField records prepared: ["field emptied"].
  • Focus is read from an unmaskable signal when there is one: the observation meta's focusedIndex, which is the app's AXFocusedUIElement, the same read the trailer prints. Otherwise it falls back to the trailer; the vendor sends no meta. Rows record prepared and focusReadBy (observation or trailer).

Engine and service (value-free: indexes and roles only):

  • cua/elementClick on an element click:
    • plan: action (with action AXPress/AXPick) or synthesized;
    • reason: advertised, descendant, noAction, notPlainLeft or forced;
    • hit: element, descendant, ancestor, other or noAnswer;
    • hitTest: application.
  • cua/observation now carries focusedIndex and focusedRole on every observation, and focusRead is whitelisted.

Plugin 0.20.6 (its own commit).

Limits

  • Whether cua's element click keeps an earlier selection, and whether an AXPress can place a caret at the click's point. This product question is deliberately not answered here. The stated clear doesn't hide it: it gets its own recorded cell, on cua and the vendor with a frontmost Electron field, in the next attended MacBook slot (Fix Chrome background paste clipboard-read timeouts in composing@textedit rows #187's). F says the vendor also takes AXPick/AXPress for non-Catalyst apps, so the two may behave the same.
  • The verdict reads focus at the prepare's last observation (after selectText), i.e. readiness for the measured action. It doesn't show that the earlier click itself focused the field. Rows that pass today could turn invalid if an app's focus is elsewhere at that moment; watch for that at the next matrix sitting.
  • Response meta is the cell's last call, so the prepare's own click record is overwritten by later calls. It is read only where the click is the cell's last call.
  • The focus read fails with AXError -25212 once no activation is held (hold 10's forced arms). No row depends on it. To be ticketed at merge.
  • Nothing ran live. Hold 10's matrix also had the whole Electron background regime dead on both engines; this PR doesn't address that.

Tests

  • Engine: full suite 691/691, including ElementClickRecordTests. The desktop gate is closed.
  • JS: native-matrix and service tests 396/396. They cover:
    • the masked reason;
    • a stated clear letting a focused field pass;
    • the unmaskable signal preferred when present;
    • rows independent of a previous row's selection;
    • focusedIndex/focusedRole in the observation meta.
  • Review (reviewer-high): correct, no material findings.
  • CI: ci-gate on 5735c98 GREEN: engine-swift, plugin, sandbox-live and test (run 41328230152); the PR's own checks are green (run 41328217830).

Docs

Native-engine design spec: a Decision Log entry (#188, 2026-11-01) for the click record, the focus in the observation's meta, the stated clear and the -25212 limit, plus elementClick in the Interfaces input-meta list and a line in "Observation (skyshot)".

Refs #188

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

…observation's meta names the focus

The engine's element click now carries elementClick in its result meta: the plan
(the element's own action or a synthesized click), why the ladder chose it
(advertised, descendant, noAction, notPlainLeft, forced) and the hit-test's
answer against the owner's application element when one was taken. The service
passes it on as cua/elementClick and whitelists the engine's focusRead; beside
it, cua/observation names the focused element by index and role on every
observation, the focus the trailer's selected text masks. Value-free.

Refs #188

Sminos-Session: cursor235#b93055dd (cua on macbook)
…row's selection

A prepare that needs its field focused read the focus off the trailer's focus
line, which the renderer drops whenever text is selected, so a focused field
holding an earlier row's selection read as "could not be given the focus"
(four cua rows invalid since hold 2a). Now:

- after the click, a selection still masking the trailer is cleared as a
  stated step (the field emptied, named in the row's prepared);
- a trailer still masked is its own reason, "the focus could not be read: a
  selection masks the trailer";
- the row judges the focus by cua's cua/observation focusedIndex of the
  prepare's last observation when it is there, else by the trailer
  (focusReadBy), and keeps the click's cua/elementClick in its engine meta;
- emptyField names its emptying and the masked reason alike.

Refs #188

Sminos-Session: cursor235#b93055dd (cua on macbook)
…e observation's meta and the stated clear

Refs #188

Sminos-Session: cursor235#b93055dd (cua on macbook)
…d element in the meta (refs #188)

Sminos-Session: cursor235#b93055dd (cua on macbook)
@chatgpt-codex-connector

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 ⚠️ Failed 2026-11-01T16:48:39.348462Z
We couldn’t complete this review. Comment @codex review to try again.
5735c98 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@SSFSKIM
SSFSKIM merged commit 7aa1cbb into main Nov 1, 2026
6 checks passed
SSFSKIM added a commit that referenced this pull request Nov 1, 2026
…l, under ABC, apart from #187's verdict (refs #188)

Before Part A, on cua's engine and the vendor's: the native matrix's electron/frontmost/paste.replace and the three
background rows behind the run's Finder window, sent as matrix-cells.mjs makes plan.mjs's cases (the #255 prepares
unchanged) and judged as caseRow judges a row, with the matrix's oracle; and cell 3, recorded only: an element click on
the fixture's field holding a selection, and a coordinate click mid-text, the selected range read before and after by
the approved bundle's text-view probe. Each item selects ABC and reads it back before its first act and after its last.
The judge reports both in their own sections; #187's verdict never reads them. Sessions can bind some of their scenes
(Finder is never observed), and keep cua/elementClick.

Sminos-Session: cursor235#b93055dd (cua on macbook)
SSFSKIM added a commit that referenced this pull request Nov 1, 2026
…eat/171-m3

Only the plugin version overlapped; this branch's 0.21.0 is kept, the next minor above main's 0.20.6. Main's change
is the macOS engine and its service (src/services/engine/service.mjs, observations.mjs) and the native matrix; it
touches none of native/linux-engine/, scripts/linux-engine-diff/ or src/services/engine/linux/, and the Linux
service imports neither changed module.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
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.

1 participant