fix(cua-driver): verify set_value writes with an AXValue read-back - #2621
Merged
Conversation
`set_value` reported success on the `AXUIElementSetAttributeValue` return
code alone:
if err == kAXErrorSuccess {
Ok(format!("✅ Set AXValue on [{element_index}] {role}."))
}
A success code is not evidence that the value landed. `type_text`'s own
docs already describe the trap: web content behind an `AXWebArea` "accepts
a write and echoes it back through AXValue while the renderer/DOM never
observes it". `set_value` had no equivalent guard, so an agent driving a
web input got a green checkmark for a write the page never took.
This reads AXValue before and after the write and classifies the result:
- `verified: true` — read-back equals the requested value
- `verified: false` — read-back ran but does not match; the message tells
the caller to confirm via screenshot
- `verified` absent — AXValue is not readable, so the write can be neither
confirmed nor denied
- `changed: false` — the value did not move, which combined with
`verified` separates "already had this value" from "the write did not
take"
Numeric controls are compared numerically, so a slider reporting `"25.0"`
verifies a requested `"25"`.
Both flags are emitted in `structuredContent` so clients can branch on
them instead of parsing the human-readable message. The AXPopUpButton path
drives menu items rather than writing AXValue, so it reports neither flag
rather than claiming an unverified write.
This follows the same honest-verification direction as the 0.7.0 work: a
tool should not report success it cannot substantiate.
Verified:
- `cargo test -p platform-macos`: 189 passed, 0 failed (6 new unit tests
covering the echo, idempotent, unreadable, and numeric cases)
- `cargo fmt -p platform-macos -- --check`: clean
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Jul 28, 2026
Contributor
Author
Reuse the existing AXWebArea ancestor proof so Chromium, WebKit, and Electron accessibility echoes never become verified renderer writes. Align set_value responses with the path, verified, effect, and escalation contract, and compare numeric values only for numeric controls with a bounded relative tolerance. Co-authored-by: Francesco Bonacci <195596869+f-trycua@users.noreply.github.com>
f-trycua
approved these changes
Jul 28, 2026
f-trycua
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed after surface-aware verification hardening. Web AX echoes are untrusted, native numeric comparison is bounded, and responses follow the action effect contract.
This was referenced Jul 28, 2026
This was referenced Jul 29, 2026
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.
Summary
set_valuetreated a successful AX write as proof that the value reached the application. Chromium, WebKit, and Electron can echo an accessibility write even when the renderer did not accept it, so that could produce a falseverified: true.Change
path,verified,effect, and optionalescalation.The AXPopUpButton path remains unverified because it selects a menu item instead of writing AXValue directly.
Validation
cargo test -p platform-macos --locked: 193 passedcargo fmt --all -- --checkThis is split from #2210 so the verification change can be reviewed independently.