Skip to content

fix(desktop): refuse a swipe or fill the driver cannot confirm, and retry stalled reads (ENG-1533) - #2353

Merged
okwasniewski merged 12 commits into
mainfrom
kdy1/desktop-unanswered-review-fixes
Nov 27, 2026
Merged

okwasniewski merged 12 commits into
mainfrom
kdy1/desktop-unanswered-review-fixes

Conversation

@kdy1

@kdy1 kdy1 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

What

Fixes to the macOS desktop driver: the items the last review of #2322 (michal-e2e at e7a74d44e) asked for that missed the merge, and the ones michal-e2e's review of this PR found next to them.

  • A swipe on a SwiftUI scroll area along an axis it has no scroll bar for goes to the scroll area above it, or fails as not actionable (nothing here scrolls down), where it used to do nothing and pass.
  • A read the app is slow to answer fails as a stall (retryable APP_UNRESPONSIVE), not as a wrong answer, in type, press, raise, focus, and the window list. A headed type checks that the app is still frontmost right before its first key.
  • scrollTo on a gone element fails with a stale ref instead of passing. A tap or check on a row the list replaces as it scrolls the row in fails at once, where it waited out the scroll poll.
  • A secure fill whose field was replaced is unconfirmed, not a success.
  • A stepper whose value read stalls is retried, not refused as unsupported or stopped short with no step. Its failure messages name no value, so a secret filled into one cannot leak re-parsed (0042 as 42).
  • selectOption names a list row the way the snapshot does, so a row with an untitled heading over "Paid" is "Invoice Paid" to both.

Why

#2322 merged with these items unanswered. The scroll one was a must-fix: a swipe that moves nothing reported success. The others turn a slow app into a non-retryable failure, a gone element into a pass, or let a stepper message carry a secret.

How it works

  1. scrolls_itself (crates/e2e-desktop-napi/src/actions/scroll.rs:43) is the snapshot's rule for Scroll: a scroll bar for the axis, or the page action for any role but a scroll area. scroll and scroll_by both use it. When nothing scrolls, the refusal is ACTION_FAILED (scroll.rs:115), which the engine reads as NOT_ACTIONABLE, as for a window with nothing to scroll; ACTION_NOT_SUPPORTED read as UNSUPPORTED_CAPABILITY, which an agent step reports as POLICY_DENIED.
  2. stalled (actions/mod.rs:118) is the one stall mapping: AX_CANNOT_COMPLETE passes up, any other failure reads as no answer. element_attribute (:128) uses it for the focused element and window in type_text, press, and key_window; raise (:297, through forward), focus (:453), holds_focus (windows.rs:179, a sheet's AXParent), and windows::list use it too. type_text reads frontmost once more as the last read before a physical first key (actions/typing.rs:107).
  3. read_frame (ax.rs:364) and placement (snapshot.rs:326) pass AX_INVALID_ELEMENT up, so reveal answers STALE_REF for a gone element. After AXScrollToVisible, reveal ends its poll as soon as the element is gone (actions/mod.rs:374), delivered like any failure after that scroll.
  4. secure_count (actions/values.rs:327) treats a gone field like a stall: no proof the field counts none.
  5. shown_number (actions/values.rs:219) reads a stepper's value before it decides the stepper shows no number: a stall or a gone element fails before any press. Stepping starts from that number (:263), not from a second read.
  6. step_to and set_value drop the target, the fill text, and the stepper's values from their messages (actions/values.rs:136).
  7. gather_texts (actions/select.rs:85) walks a row the way the snapshot gathers a name from content: every level, a text's children before the text. It takes the tree reads as closures, so a unit test drives it with a fake tree.

A row replaced as it scrolls in still fails as an action that may have taken effect, not one the locator retries: after_scroll counts the scroll as input, and that rule holds for every failure after it.

Issue

Review items left open on #2322, and michal-e2e's review of this PR.

Verified

Ran it locally: yes (macOS 27.2.1, arm64, background mode)

  • The desktop testbed at this commit, with the addon built from it: pnpm --filter @e2e-dev/desktop-testbed test passed 23 of 23. The desktop package tests with that addon passed 248 of 248.
  • Unit tests feed AX_CANNOT_COMPLETE to the stall mapping (stalled, unread) and to shown_number, drive every step_to failure and assert no digit is in its message, and cover the scroll rule, the secure count on a gone field, and the row name order on a fake tree. Mutants that drop the stall in stalled or shown_number, or put the value in the wrap or "already showed" message, each fail a test.
  • Checked by reading only, since they need a real accessibility element and a fake tree comes only with feat(desktop): fold out-of-view rows, and add app.back, clearState, sessions, and video (ENG-1533) #2356: the call sites of scrolls_itself in scroll and scroll_by, the frontmost re-check before the first key, the gone-element arms of read_frame and placement, and the replaced-row exit in reveal.
  • Not reproduced live: a stalled focus read, a field replaced mid-fill, and a row replaced by its own scroll each need an app that does it on cue.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. None: the pending .changeset/desktop-native-driver.md bumps @e2e-dev/desktop and both platform packages for the release that first ships this driver, and these are fixes to it.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it. No behavior the docs describe changed.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

🤖 Generated with Claude Code

@kdy1
kdy1 requested a review from okwasniewski as a code owner November 27, 2026 12:11
@github-actions github-actions Bot added the e2e team Opened by the e2e team label Nov 27, 2026
@kdy1
kdy1 added this pull request to stack #2359 November 27, 2026 12:12
@github-actions github-actions Bot added the size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile label Nov 27, 2026
@kdy1 kdy1 changed the title kdy1/desktop unanswered review fixes fix(desktop): refuse a swipe or fill the driver cannot confirm, and retry stalled reads (ENG-1533) Nov 27, 2026
@kdy1 kdy1 added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 27, 2026

@michal-e2e michal-e2e left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.

Reviewed at b19515d66 (merge base 026d8570d, main), the bottom of stack 2359.

Nothing blocks this one, @kdy1. All eight items left open on #2322 are answered in the driver, and the checks below are green. The optional items are everything I found, so nothing new should come up in a later round on this commit. The first one is a behavior this change adds; the rest are gaps next to the fixes.

Must fix: none.

Optional

  • scrollIntoView on an off-screen row can now wait out the whole action deadline and then fail, and a tap, check or right-click on that row waits the same time before failing. reveal is behind all four (actions/mod.rs:361, :460, :469, values.rs:42). After AXScrollToVisible it polls until placement answers Ok(Shown) (actions/mod.rs:344). With this change a gone element makes placement answer Err(AX_INVALID_ELEMENT), which never equals Ok(Shown). So a row whose element the list replaces as it scrolls in keeps the poll going until the deadline, then fails unconfirmed, and since refCommand counts these as input, the engine reports ACTION_MAY_HAVE_COMMITTED (driver.ts:264). On the merge base the replaced element read as shown: scrollIntoView passed, and a tap failed at once with the same error. I traced this by reading. I did not check live how often AppKit or SwiftUI lists replace a row's element on scroll. Please end the poll as soon as placement says the element is gone, with a message that says it was replaced. Should that failure let the locator try again? A scroll was sent, so it is marked delivered today, and the engine will not retry it.
  • Your PR description says "The unit tests cover the mappings." They cover the secure count. I ran 24 mutants over the branches this PR adds or changes, and 17 left cargo test green. Among them: element_attribute dropping a stall again (actions/mod.rs:121), the frontmost check after the first-key re-check removed (actions/typing.rs:102), read_frame and placement reading a gone element as no frame again, the stepper's stall read falling through to "cannot be set", and scroll_by ignoring the role (actions/scroll.rs:111). Four of the five stepper messages can name the value again with no test failing; only "steps past the value" is checked (actions/mod.rs:636). Can we either say under ## Verified which mappings are checked by reading only, or split the stall mapping out the way secure_count is, so a test can feed it AX_CANNOT_COMPLETE? For the messages, asserting that no ASCII digit appears in the wrap and "already showed" step_to failures would cover the secret case the doc comment at values.rs:136 promises.
  • A stepper fill can still report "may have committed" after a stall when nothing was pressed. set_value now maps a stalled first AXValue read to a retryable stall, but reads AXValue again right after through number(), which turns a stall into None (actions/values.rs:258). step_to then returns Ok(false) without a step (values.rs:145), and the fill fails unconfirmed as "stopped short of the value". This is older than this PR, but it sits right next to the fix. Passing the number the first read already holds as shown would close it.
  • The stall fix covers the five reads the #2322 review named. The same question still gets the old answer in four places: raise (actions/mod.rs:297), focus (actions/mod.rs:415), holds_focus reading a sheet's AXParent (windows.rs:179), and windows::list (windows.rs:190). holds_focus is on the path of key_window and of type's window checks (typing.rs:33 and :90), so a key for a field in a sheet whose app stalls on AXParent still gets a non-retryable "not the app's key window". Can these go through element_attribute too?
  • Which error should a node swipe give when nothing scrolls? A node swipe on a SwiftUI scroll area with no scroll bar for the axis, and no scroll area above it, now fails with ACTION_NOT_SUPPORTED "nothing here scrolls down" (actions/scroll.rs:114). The engine maps that to UNSUPPORTED_CAPABILITY (driver.ts:268), and when that error ends an agent step, toAgentError files it as POLICY_DENIED (packages/core/src/agent/error.ts:142). A window swipe with nothing to scroll says NOT_ACTIONABLE instead (surface.ts:975). Failing is what the #2322 review asked for. The question is only the class: should a list that fits read as "not actionable", like the window case, rather than as a capability the engine lacks?

Verified

  • The #2322 asks at this head, each read against the code: the scroll rule (scrolls_itself, the same rule as snapshot.rs:461-468, used by both scroll and scroll_by); the frontmost read after the first-key re-check; the row text walk (children before the text, scroll bars skipped, as snapshot.rs:701-756 does; a second walk whose order matches, not one shared walk); the secure count on a gone field; read_frame and placement passing a gone element up; the five focus reads through element_attribute; the stepper stall read; and the five stepper messages naming no value.
  • A stall in the middle of typing does not cause a retyped string: a check failure after the first key goes through stopped(...).delivered() (input.rs:339-345), and driver.ts:264 maps it to ACTION_MAY_HAVE_COMMITTED before the retryable case.
  • At b19515d66 with Rust 1.100.0: cargo fmt --all --check, cargo clippy --workspace --locked --all-targets -- -D warnings and cargo test --workspace --locked (59 passed) all exit 0. The merge base runs 56.
  • Suites at b19515d66, run here: pnpm run build, pnpm --filter @e2e-dev/desktop run build:native (the addon from this crate), pnpm check, and the @e2e-dev/desktop package tests with that addon present: all exit 0, and the desktop suite passed 248 of 248 in 7 files, its loader test loading the arm64 addon built from this commit.
  • New tests: 3 added and 1 changed, and each fails under at least one mutant: the scroll rule test (mutants that accept a scroll area by its page action, or ignore the bar), the secure count test (a gone field counted as none), the row name test (scroll bar parts read, or no descent into a text), and the stepper test's new !contains('3') (the "steps past" message naming the target).
  • Mutation testing: 24 mutants, one per branch, condition or message this PR adds or changes in crates/e2e-desktop-napi/src, each applied to b19515d66 with cargo test --workspace after it. 7 failed at the intended test's own assert (read by hand, since cargo test has no failure reporter). 17 survived: the call sites of the scroll rule in scroll and scroll_by, the stall mapping in element_attribute, press, key_window and the four type reads, the frontmost re-check, four of the five value-free messages, the stepper stall read, and the gone-element arms of read_frame and placement.
  • CI: on the first attempt, test (24, runner) failed in tests/integration/test-step.test.ts (a step timeout read as failed, not timed out) and test (24.8.0, packages) failed in packages/web tests/unit/host-libraries.test.ts:110 (an expect.poll on an ldd process). Neither loads this crate, and the same suites passed on the other Node versions at this commit, so I classed both as flaky. Both passed when re-run on this commit, and CI is green.

Not run

  • The desktop testbed live on this commit. It opens apps on this Mac's screen, and I had no go-ahead for that during this review. Your 23 of 23 and 18 of 18 were run at the top of the stack, not at this commit. pnpm --filter @e2e-dev/desktop-testbed test at b19515d66 would close it.
  • A stalled focus read, a field replaced mid-fill, and a row replaced by its own scroll, live. Each needs an app that does it on cue.
  • The x86_64 build of the addon. CI's native job builds and checks it at this commit; I built arm64 only.

Accepted as intended

  • The range refusal no longer names the number for any fill, secret or not ("the value is outside the range of this incrementor"). That is the cost of keeping a secret out of the message.
  • A swipe on a SwiftUI scroll area that cannot move along the axis now goes to the scroll area above it or fails, where it used to pass. The #2322 review asked for exactly that.

For the maintainer

  • The scroll rule this PR adopts, which I asked for on #2322, reads "scrolls" from a scroll bar for the axis. A SwiftUI ScrollView(.horizontal, showsIndicators: false) may list no scroll bar while it does scroll. If so, a node swipe on such a carousel now fails or moves the area above it, where the page action used to move the carousel. The snapshot already offers no Scroll there, so only an explicit locator swipe changes. Checking one such view in Accessibility Inspector would settle it. If it lists no bar, the choices are a line in the desktop guide's scrolling row, or checking whether the page action moved anything before refusing.

Nit

  • The checklist says no changeset is needed because "@e2e-dev/desktop has not been released yet". 0.0.1 has been on npm latest since 2026-11-25. The pending .changeset/desktop-native-driver.md already bumps @e2e-dev/desktop and both platform packages for the release that first ships this driver, so no changeset is needed; the reason should say that instead.

@kdy1
kdy1 force-pushed the kdy1/desktop-unanswered-review-fixes branch from b19515d to 196a556 Compare November 27, 2026 12:50
@github-actions github-actions Bot removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 27, 2026
@kdy1

kdy1 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

[claude-opus-5-5] responding on behalf of kdy1

Thanks. Every optional item is fixed on this PR, now at 196a55604:

Also run at this PR's commit: the desktop testbed with the addon built from it passed 23 of 23, and the desktop package tests 248 of 248.

Left for a maintainer: whether a ScrollView(.horizontal, showsIndicators: false) lists a scroll bar. I have not checked one in Accessibility Inspector.

@michal-e2e michal-e2e left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.

Reviewed at 4ae96583a (merge base 731045fae, main), the bottom of stack 2359, after my review at b19515d66.

Thanks @kdy1, all five optional items and the nit are done in the five new commits, and the description now matches. Nothing blocks this one.

Must fix: none.

Accepted as intended

  • A row replaced as it scrolls in now fails at once instead of waiting out the poll, and still fails as one that may have taken effect. Your description gives the reason: after_scroll counts the scroll as input for every failure after it.
  • A swipe with nothing to scroll is now ACTION_FAILED, read as NOT_ACTIONABLE like the window case.

Follow-ups

  • The six branches your description lists as checked by reading only (the replaced-row exit, the stepper's first read, the stall in raise, holds_focus and the window list, and scroll's error code) can get tests once #2356's fake tree is in.

Verified

  • git range-diff against my last review: the seven original commits are unchanged apart from the rebase onto main 731045fae, and five new commits (6969743d9 to 4ae96583a) add the fixes. The delta is Rust only, in six files under crates/e2e-desktop-napi/src.
  • Each earlier item, read at this head:
    • reveal ends its poll on AX_INVALID_ELEMENT (actions/mod.rs:375-377).
    • set_value steps from the number its first read showed (shown_number, values.rs:219).
    • raise, focus, holds_focus and windows::list go through the one stalled mapping.
    • A swipe with nothing to scroll answers ACTION_FAILED.
    • A new test asserts that no stepper failure has a digit in it.
    • The description and checklist are updated.
  • At 4ae96583a with Rust 1.100.0: cargo fmt --all --check, cargo clippy --workspace --locked --all-targets -- -D warnings and cargo test --workspace --locked (62 passed) exit 0. pnpm run build, pnpm --filter @e2e-dev/desktop run build:native and pnpm check exit 0. The desktop suite passed 248 of 248 with the addon built from this commit.
  • Mutation testing on the new branches, plus the two message mutants that survived last time: 10 mutants, each applied to 4ae96583a with cargo test --workspace. 4 failed at the intended test's own assertion (read by hand): stalled dropping a stall, shown_number reading a gone stepper as no number, and both message mutants, which the new no-digit test now catches. 6 survived, the six branches in the follow-up above.

Not run

  • The desktop testbed on this Mac's screen; your 23 of 23 at this commit is taken as reported.
  • This commit's own CI was still running when I read it.

kdy1 and others added 12 commits November 27, 2026 22:18
…for the axis

SwiftUI gives every scroll area the AXScroll*ByPage actions, also one whose
content fits or that scrolls only along the other axis. `scroll` counted
the page action for the direction as "scrolls itself", so a swipe down on
a horizontal carousel inside a vertical page sent AXScrollDownByPage to
the carousel, moved nothing, and answered success.

`scrolls_itself` now uses the rule the snapshot offers `Scroll` with: a
scroll bar for the axis, or, for any role but a scroll area, the page
action. A scroll area without that bar hands the swipe to the scroll area
above it, and with none is refused as "nothing here scrolls".

Review: michal-e2e on #2322 at e7a74d4 (must fix).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… last

The focus reads before a key went through `Element::element()`, which
drops a stall: an app slow to answer AXFocusedUIElement or
AXFocusedWindow got "the field lost keyboard focus", a refusal the engine
does not retry, where every other stalled read is a retryable
APP_UNRESPONSIVE. `element_attribute` keeps the stall, and `type`,
`press`, and `key_window` read focus through it. Past the first typed
key, an unanswered read still only shortens the wait for the next key.

A headed `type` also re-read the field's focus after its AXFrontmost
check for the first key. That read waits on the app, and another app
that came forward meanwhile would take the key. The frontmost check is
now the last read before the first physical key, as it is for `press`.

Review: michal-e2e on #2322 at e7a74d4 (optional).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`read_frame` and the parent reads in `placement` read AX_INVALID_ELEMENT
as no frame and no parent, so a gone element was `Placement::Shown` and
`scrollTo` answered success before any scroll. Before the reveal rewrite,
AXScrollToVisible refused a gone element as stale.

`read_frame` and `placement` now pass AX_INVALID_ELEMENT up as they pass
a stall, and `reveal` maps it to the retryable STALE_REF. `frame()` still
reads any failure as no frame.

Review: michal-e2e on #2322 at e7a74d4 (optional).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A secure fill checks AXNumberOfCharacters after the write. A field that a
change handler replaced answers AX_INVALID_ELEMENT there, which read as
"counts none", so the fill succeeded unchecked. `secure_count` now treats
a gone field like a stall: no proof the field counts none, so the fill
ends unconfirmed unless the count shows the whole text, as a plain
field's fill does.

Review: michal-e2e on #2322 at e7a74d4 (optional).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fill on a stepper whose AXValue cannot be written reads the value to
see that it shows a number. A read the app did not answer in time fell
through to "the value of this stepper cannot be set", a non-retryable
ACTION_NOT_SUPPORTED. It is now the retryable APP_UNRESPONSIVE (and a
gone element a stale ref), as every other stalled read is.

Review: michal-e2e on #2322 at e7a74d4 (follow-up).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stepper's failures printed the fill text and the parsed target, and
the engine copies the driver's message into the step's error. The secret
ledger matches a secret in every spelling a serializer gives it, but not
re-parsed as a number, so a secret `0042` filled into a stepper would
print as `42`. The five messages (out of range, stopped short, wraps,
already showed, steps past) now say "the value" and "where it started"
instead of numbers.

Review: michal-e2e on #2322 at e7a74d4 (for the maintainer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`row_texts` stopped at a text child and read only that child's own
label, while the snapshot walks into it and names the row from every
text below. A row holding "Invoice" and an untitled heading over "Paid"
was "Invoice Paid" to a locator but "Invoice" to `select`.

`gather_texts` now walks the way the snapshot gathers a name from
content: every level, a text's children before the text itself, and no
scroll bar's parts. It takes the tree reads as closures, so a unit test
pins the order on a fake tree.

Review: michal-e2e on #2322 at e7a74d4 (optional).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it in

After `AXScrollToVisible`, `reveal` polled until the element read as
shown. Since the gone-element fix, `placement` answers a replaced element
with `AX_INVALID_ELEMENT`, which never reads as shown, so a tap, check, or
scrollIntoView on a row the list replaces as it scrolls in waited out the
poll and then failed as "still off screen". It now ends the poll at once
with `STALE_REF`, delivered like any failure after that scroll, as
`after_scroll` counts it.

Found by michal-e2e's review of #2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`set_value` mapped a stalled first `AXValue` read to a retryable stall,
then read `AXValue` again for the number to step from, a read that turned
a stall into no number. `step_to` then returned without a step, and the
fill failed unconfirmed as "stopped short of the value" with nothing
pressed. The first read's number is now where stepping starts.

The read is split into `shown_number`, so a unit test feeds it a stall and
a gone element.

Found by michal-e2e's review of #2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stall fix covered the five focus reads #2322's review named. Four
more places still read a stall as an answer: `raise` read a stalled
`AXFrontmost` or `AXFocusedWindow` as "could not be brought forward";
`focus` read a stalled `AXFocusedUIElement` as no focus; `holds_focus`
read a stalled sheet `AXParent` as another window, so a key for a field
in a sheet got a non-retryable "not the app's key window"; and
`windows::list` listed every window as unfocused. Each now fails with the
retryable `APP_UNRESPONSIVE`, before anything is sent where the read comes
first.

`stalled` is the one mapping they share, and a unit test feeds it
`AX_CANNOT_COMPLETE`.

Found by michal-e2e's review of #2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A node swipe where nothing scrolls along the axis failed with
`ACTION_NOT_SUPPORTED`, which the engine reads as `UNSUPPORTED_CAPABILITY`
and an agent step reports as `POLICY_DENIED`. A window swipe with nothing
to scroll already fails as `NOT_ACTIONABLE`; the node swipe now does too
(`ACTION_FAILED`), with the same "nothing here scrolls" message.

Raised by michal-e2e's review of #2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The doc comment on `step_to` promises its failures name no value, since a
secret filled into a stepper could come back re-parsed (`0042` as `42`),
where the ledger would not redact it. Only the "steps past" message was
checked. The test now drives every failure `step_to` gives: a wrap, a
step past and back, a step past that cannot go back, a probe that left
the value changed, and one out of time. It asserts no ASCII digit
appears in any of them.

Asked for by michal-e2e's review of #2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kdy1
kdy1 force-pushed the kdy1/desktop-unanswered-review-fixes branch from 4ae9658 to 8ea401c Compare November 27, 2026 13:25

@michal-e2e michal-e2e left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.

Reviewed at 8ea401cdb (merge base 27fd3763f, main), the bottom of stack 2359, after my review at 4ae96583a.

@kdy1, this push is a rebase onto main, which now has #2347. git range-diff shows the same twelve commits, and the one that differs, 1366a7bdd, differs only in a context line next to #2347's new tests. So my last review carries over: nothing blocks this one.

Must fix: none.

Verified

  • git range-diff from 4ae96583a to 8ea401cdb: 11 of 12 commits unchanged, 1366a7bdd changed in one context line. Between the two heads, the lines added and removed under crates/ are exactly #2347's, and this PR adds no line to the perform and answered code that #2347 changed.
  • At 8ea401cdb with Rust 1.100.0: cargo fmt --all --check, cargo clippy --workspace --locked --all-targets -- -D warnings and cargo test --workspace --locked (63 passed, one more than last time, from #2347) exit 0.
  • CI at this commit: every check passed, the macOS native job included.

Not run

  • The desktop testbed on this Mac's screen, as before.

The follow-up from my last review still stands: tests for the six branches checked by reading only, once #2356's fake tree is in.

@kdy1 kdy1 added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 27, 2026
@okwasniewski
okwasniewski added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 7dd2fd0 Nov 27, 2026
40 checks passed
@okwasniewski
okwasniewski deleted the kdy1/desktop-unanswered-review-fixes branch November 27, 2026 17:17
kblok pushed a commit to hardkoded/e2e that referenced this pull request Nov 27, 2026
…NG-1533) (e2e-inc#2355)

* fix(desktop): let a scroll area scroll itself only with a scroll bar for the axis

SwiftUI gives every scroll area the AXScroll*ByPage actions, also one whose
content fits or that scrolls only along the other axis. `scroll` counted
the page action for the direction as "scrolls itself", so a swipe down on
a horizontal carousel inside a vertical page sent AXScrollDownByPage to
the carousel, moved nothing, and answered success.

`scrolls_itself` now uses the rule the snapshot offers `Scroll` with: a
scroll bar for the axis, or, for any role but a scroll area, the page
action. A scroll area without that bar hands the swipe to the scroll area
above it, and with none is refused as "nothing here scrolls".

Review: michal-e2e on e2e-inc#2322 at e7a74d4 (must fix).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): read focus before a key as a stall, and check frontmost last

The focus reads before a key went through `Element::element()`, which
drops a stall: an app slow to answer AXFocusedUIElement or
AXFocusedWindow got "the field lost keyboard focus", a refusal the engine
does not retry, where every other stalled read is a retryable
APP_UNRESPONSIVE. `element_attribute` keeps the stall, and `type`,
`press`, and `key_window` read focus through it. Past the first typed
key, an unanswered read still only shortens the wait for the next key.

A headed `type` also re-read the field's focus after its AXFrontmost
check for the first key. That read waits on the app, and another app
that came forward meanwhile would take the key. The frontmost check is
now the last read before the first physical key, as it is for `press`.

Review: michal-e2e on e2e-inc#2322 at e7a74d4 (optional).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): refuse scrollTo on a gone element as a stale ref

`read_frame` and the parent reads in `placement` read AX_INVALID_ELEMENT
as no frame and no parent, so a gone element was `Placement::Shown` and
`scrollTo` answered success before any scroll. Before the reveal rewrite,
AXScrollToVisible refused a gone element as stale.

`read_frame` and `placement` now pass AX_INVALID_ELEMENT up as they pass
a stall, and `reveal` maps it to the retryable STALE_REF. `frame()` still
reads any failure as no frame.

Review: michal-e2e on e2e-inc#2322 at e7a74d4 (optional).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): do not confirm a secure fill by a field that went away

A secure fill checks AXNumberOfCharacters after the write. A field that a
change handler replaced answers AX_INVALID_ELEMENT there, which read as
"counts none", so the fill succeeded unchecked. `secure_count` now treats
a gone field like a stall: no proof the field counts none, so the fill
ends unconfirmed unless the count shows the whole text, as a plain
field's fill does.

Review: michal-e2e on e2e-inc#2322 at e7a74d4 (optional).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): retry a stepper whose value read stalls

A fill on a stepper whose AXValue cannot be written reads the value to
see that it shows a number. A read the app did not answer in time fell
through to "the value of this stepper cannot be set", a non-retryable
ACTION_NOT_SUPPORTED. It is now the retryable APP_UNRESPONSIVE (and a
gone element a stale ref), as every other stalled read is.

Review: michal-e2e on e2e-inc#2322 at e7a74d4 (follow-up).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): name no value in a stepper's failure messages

The stepper's failures printed the fill text and the parsed target, and
the engine copies the driver's message into the step's error. The secret
ledger matches a secret in every spelling a serializer gives it, but not
re-parsed as a number, so a secret `0042` filled into a stepper would
print as `42`. The five messages (out of range, stopped short, wraps,
already showed, steps past) now say "the value" and "where it started"
instead of numbers.

Review: michal-e2e on e2e-inc#2322 at e7a74d4 (for the maintainer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): name a list row for select as the snapshot names it

`row_texts` stopped at a text child and read only that child's own
label, while the snapshot walks into it and names the row from every
text below. A row holding "Invoice" and an untitled heading over "Paid"
was "Invoice Paid" to a locator but "Invoice" to `select`.

`gather_texts` now walks the way the snapshot gathers a name from
content: every level, a text's children before the text itself, and no
scroll bar's parts. It takes the tree reads as closures, so a unit test
pins the order on a fake tree.

Review: michal-e2e on e2e-inc#2322 at e7a74d4 (optional).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): stop waiting on a row the list replaced as it scrolled it in

After `AXScrollToVisible`, `reveal` polled until the element read as
shown. Since the gone-element fix, `placement` answers a replaced element
with `AX_INVALID_ELEMENT`, which never reads as shown, so a tap, check, or
scrollIntoView on a row the list replaces as it scrolls in waited out the
poll and then failed as "still off screen". It now ends the poll at once
with `STALE_REF`, delivered like any failure after that scroll, as
`after_scroll` counts it.

Found by michal-e2e's review of e2e-inc#2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): step a stepper from the number its first read showed

`set_value` mapped a stalled first `AXValue` read to a retryable stall,
then read `AXValue` again for the number to step from, a read that turned
a stall into no number. `step_to` then returned without a step, and the
fill failed unconfirmed as "stopped short of the value" with nothing
pressed. The first read's number is now where stepping starts.

The read is split into `shown_number`, so a unit test feeds it a stall and
a gone element.

Found by michal-e2e's review of e2e-inc#2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): read a stall as one in raise, focus, and the window list

The stall fix covered the five focus reads e2e-inc#2322's review named. Four
more places still read a stall as an answer: `raise` read a stalled
`AXFrontmost` or `AXFocusedWindow` as "could not be brought forward";
`focus` read a stalled `AXFocusedUIElement` as no focus; `holds_focus`
read a stalled sheet `AXParent` as another window, so a key for a field
in a sheet got a non-retryable "not the app's key window"; and
`windows::list` listed every window as unfocused. Each now fails with the
retryable `APP_UNRESPONSIVE`, before anything is sent where the read comes
first.

`stalled` is the one mapping they share, and a unit test feeds it
`AX_CANNOT_COMPLETE`.

Found by michal-e2e's review of e2e-inc#2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): refuse a swipe with nothing to scroll as not actionable

A node swipe where nothing scrolls along the axis failed with
`ACTION_NOT_SUPPORTED`, which the engine reads as `UNSUPPORTED_CAPABILITY`
and an agent step reports as `POLICY_DENIED`. A window swipe with nothing
to scroll already fails as `NOT_ACTIONABLE`; the node swipe now does too
(`ACTION_FAILED`), with the same "nothing here scrolls" message.

Raised by michal-e2e's review of e2e-inc#2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): check that no stepper failure names a value

The doc comment on `step_to` promises its failures name no value, since a
secret filled into a stepper could come back re-parsed (`0042` as `42`),
where the ledger would not redact it. Only the "steps past" message was
checked. The test now drives every failure `step_to` gives: a wrap, a
step past and back, a step past that cannot go back, a probe that left
the value changed, and one out of time. It asserts no ASCII digit
appears in any of them.

Asked for by michal-e2e's review of e2e-inc#2353.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(desktop): install rustup from a pinned, checksum-verified rustup-init

Both `native` jobs ran `curl https://sh.rustup.rs | sh` when the image had
no rustup, and the release job builds the driver npm ships right after it.
The new `.github/actions/rust-toolchain` composite action downloads
rustup-init 1.29.3 for the runner's architecture from
static.rust-lang.org and checks it against the SHA-256 recorded in the
action before it runs it. It then installs the toolchain
rust-toolchain.toml pins and puts that toolchain's cargo first on PATH,
the step spec's job already had; the release job now runs it too, which
build-native.ts did implicitly through rustup before. rust-toolchain.toml
stays the toolchain pin.

Answers the follow-up from the e2e-inc#2325 review (okwasniewski): the release
job's rustup install was an unpinned curl | sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(desktop): load the x64 addon under Rosetta before it ships

The x64 driver was built and its architecture read with lipo, but no job
loaded it, so a build that fails to dlopen or to answer would reach Intel
users unnoticed. The new `.github/actions/load-x64-addon` composite action
installs Rosetta when `arch -x86_64` cannot run, downloads the official
darwin-x64 Node of the version setup-node installed, checks the tarball
against that release's SHASUMS256.txt, and has it require the x64 addon
under `arch -x86_64` and call status(). It fails on a Node that is not x64,
a load failure, or a status() without a boolean `accessibility`.

Spec's `native` job runs it after the arm64 load. The release job's
`native` job now loads both builds, the arm64 one natively and the x64 one
this way, before it uploads them. The engine's loader test stays arm64
only: vitest's native dependencies are installed for arm64.

Answers the follow-up from the e2e-inc#2325 review (okwasniewski): the x64 addon
is built but never loaded by any job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(desktop): pick rustup-init by OS and architecture together

The rustup step chose its binary by `uname -m` alone, so a Linux x86_64
job using the action would download the macOS build, pass the checksum,
and fail with an exec format error. It now matches `Darwin arm64` and
`Darwin x86_64`, and anything else gets the message it already printed:
no pinned rustup-init for that OS and architecture.

Raised by michal-e2e's review of e2e-inc#2354.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(desktop): retry the rustup-init and x64 Node downloads

The native job runs on every pull request and `spec gate` needs it, so a
single 5xx or reset from static.rust-lang.org or nodejs.org failed every
pull request and merge-queue entry until a rerun. Each download now
retries 3 times, as `mcp-publisher` already does.

Raised by michal-e2e's review of e2e-inc#2354.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): print a test line for every point tool

The point tools (tap_at, hover_at, drag_at, type_at, press_at,
select_at) printed no test line, so test_lines left their steps out of
the draft without saying so: a tab tapped and a field edited at a point
were missing from a desktop draft.

Each point tool now plans its line the way the step resolves its
target, through the step's own hit test on the newest screen. Where the
engine takes the bare point, a tap prints screen.tapAt({ x, y }) in the
viewport's CSS pixels; elsewhere the tool acts on the listed control
under the point by id and prints that control's locator line (tap,
hover, fill, press, selectOption, dragTo). A hover or a drag at bare
points, and a typed key on a point where nothing is listed, print
"No test line:" and why, and the draft keeps the step as a comment. A
point tool called before the first screenshot does nothing and records
nothing.

Answers okwasniewski's e2e mcp pass on e2e-inc#2323 (2026-11-26T17:54).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): write the line of an earlier screen's id for the node it acted on

An action on a node id from an earlier observation ran, then answered
"No test line: not on the newest screen". The step resolves the id as
an agent step does (feed.resolve): an id the newest observation no
longer lists is found again by what its node read as, when exactly one
node on the newest screen reads the same, and the action runs on that
node. The test line looked the id up on the newest screen only.

Keeping the action is the decision here, not refusing it before it
acts: it is the agent's own resolution, the node it acts on is on the
newest screen, a secret fill still runs the full authorization on that
node, and an engine that numbers every screen afresh (SwiftUI) would
otherwise fail every second call of a batch. The line now keeps the
screens before the newest one, as the step does, and finds the same
node; two nodes that read alike give no line, as the action fails then.
The MCP reference said ids were valid only against the newest
observation; it now says how an earlier id resolves.

Answers okwasniewski's e2e mcp pass on e2e-inc#2323 (2026-11-26T17:54).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(core): let a fixture operation say how a test line writes its call

`e2e mcp`'s test_lines wrote desktop.useWindow({ id: '36086', ... }):
the window id run_code passed, which no window has on the next launch,
so the drafted line never replays.

A fixture operation may now declare testLine (FixtureOperation, in
@e2e-dev/core/engine): for an argument that holds only while the app
runs, the arguments as a test writes them to find the same thing again,
or a note the line carries on why the arguments may not hold. The
fixture recorder keeps it by the recorded method, and run_code's
recorder asks it before it writes a line, with every string in the
arguments through the secret ledger. Core still names no engine: the
desktop engine declares it for useWindow, which now drafts as
desktop.useWindow((await desktop.windows()).find((window) =>
window.title === "Inbox")), the form the testbed's own tests use; an
untitled window or a bare id keeps its arguments with a comment that
the id holds only while the window is open.

Answers okwasniewski's e2e mcp pass on e2e-inc#2323 (2026-11-26T17:54). The
only change in packages/desktop is the useWindow declaration and its
unit test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): give attached run_code the engine's fixtures

run_code in a session attached to a held test (open_session { attach })
had no engine fixture: `desktop is not defined`, even when the test
names it, while a standalone session's code has it. On macOS 27 the
attached agent then could not pick the real window back with
desktop.useWindow() once a system dialog took the screen.

Core's new createEngineFixtures builds the engine's own fixtures over a
session, each on first touch, as a test's are, recording into the step
recorder and budget it is given. The held test's tools give run_code
those fixtures over the held test's session, beside the app they
already built, with the attachment's own step recorder: the calls stay
out of the test's report, and a --step hold never stops one of them,
which recording into the test's recorder would. What a fixture changes
lives in the engine session, so the test sees it after it resumes.

Answers okwasniewski's e2e mcp pass on e2e-inc#2323 (2026-11-26T18:09).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): draft a useWindow line that fails when no window has the title

The drafted `useWindow` line found the window by title, and on replay
with no window of that title `find` returned `undefined`, which
`useWindow` takes as "go back to the focused window": the test then read
and asserted on another window with no error. The line now ends with
`?? "titled Inbox"`, an id `useWindow` refuses with "the app has no
window titled Inbox". It drafts by title only when the title is a
non-empty string; a window object with none, as plain JavaScript can
pass, keeps the id and its note.

Found by michal-e2e's review of e2e-inc#2355.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): raise the core and e2e peer floor to the release with testLine

`@e2e-dev/desktop` now declares `FixtureOperation.testLine`, which
`@e2e-dev/core` 0.25.0 does not have; on it the window line is drafted
with the id again, without a word. Both peers now read `>=0.25.1 <1`, as
the web and mobile engines already do.

Found by michal-e2e's review of e2e-inc#2355.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): keep one set of engine fixtures for an attachment's run_code

`run_code` asks for its attempt on every call, and the held test's
attachment built new engine fixtures each time. State a fixture keeps
did not carry from one call to the next: a web route added in one call
lived on that call's `browser`, so `unroute` in the next removed nothing
and the route was still there when the test resumed. The attachment now
builds the attempt once, on the first call, as a standalone session
keeps its own, and each call enters its own phase of the attachment's
one budget, cancelled with that call.

The new test sets a property on the fixture in one call and reads it in
the next; on the per-call fixtures it reads nothing.

Found by michal-e2e's review of e2e-inc#2355.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(core): carry a node's test id on ExecutorNode

The listing an executor reads shows a node's test id (`testid="..."`),
but `ExecutorNode` had no field for it, so code working from the tree
could not tell apart two controls only their test ids separate.
`projectTree` now copies `testId` onto the node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): find an earlier screen's id for its line by the action's own rule

The line for an id only an earlier screen listed re-found the node with
its own `twinsOf`, which compares role, name, text, and placeholder and
ignores the test id, while the action re-finds it with `describeTarget`
and `relocateDescriptor`, which go by role, name, test id, placeholder,
and input purpose. Two "Delete" buttons with different test ids,
renumbered: the tap landed on the right one and the line said "not on
the newest screen". Two nameless rows whose text swapped: the line named
the row the action did not touch. The line now calls the same two
functions on the listed nodes.

Found by michal-e2e's review of e2e-inc#2355.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): tell the agent an older node id works when one node reads like it

`open_session` still said node ids are valid only for the newest
observation, while the docs and the skill say an older id is found again
when exactly one node on the newest screen reads like its node. Its text
now says the same, and the reference names the fields the action goes
by: role, name, test id, placeholder, and the text of a node with
neither a name nor a test id.

Raised by michal-e2e's review of e2e-inc#2355.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(mcp): replay a drafted check line beside the tap_at lines

The point-tool change replaced the `check` step with a `tap_at` on the
checkbox and left the `check` entry as dead data, so no drafted
`.check()` line was replayed. The checkbox is checked with `check` again,
then tapped twice at its point with `tap_at`, off and on, and every line
replays in the run.

Raised by michal-e2e's review of e2e-inc#2355.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e team Opened by the e2e team Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants