Repository navigation
fix(win_agent): recheck the bound scope around each source read, not each getter - #2788
Conversation
…each getter observe_complete_value re-read the caller's bound target scope (for editable input a strict census plus a hit test) before every provider property getter: about 25 scope checks, and so dozens of ElementFromPoint calls, per value. On hosted Windows that made reads time out, and an agent run died with an access violation inside uiautomation.ControlFromPoint, called from this guard (diagnostic run 46351124518, exit code 0xC0000005). The cheap checks still run before every getter: deadline, UIA HWND/PID/RuntimeId, native owner and, last, the sensitive status. The scope check now brackets each whole source read (binding read, then the end of each of the four reads, then a final check): six calls per value. A scope change between any two source reads is still refused.
Independent adversarial review: APPROVEFrom: Grok I reviewed this PR's own commit, What changed (
|
|
From: Grok I checked the merge from main. My approved head The required gates ( Needed: the PR author or session should rerun the failed jobs in run 46377707682 before re-queueing. If the sidepanel test fails again, it needs its own issue. |
Depends on #2787: this branch is stacked on it. Merge #2787 first; GitHub will then show only this PR's commit.
Problem
A diagnostic Desktop replay run (46351124518) with the fatal-error handler on caught the Windows agent crashing. It exited with
0xC0000005, an access violation insideuiautomation.ControlFromPoint, called from:native_value.observe_complete_value→guard→identity(server.current_binding) →_focused_target_control→_hits_targetThis crash explains the qualification campaign step's missing fault receipt, and most likely the intermittent
RemoteDisconnectedin the keyboard-lease e2e.#2291's guard re-read the caller's bound scope before every provider property getter. For editable input that scope check is a strict census plus a hit test, so one value read made about 25 of them, and so dozens of
ElementFromPointcalls. That is the slowness #2787 addresses on the census side, and the exposure behind this crash.Fix
guard(scope=False), before every getter, keeps every check except the caller's scope:guard(scope=True)addsidentity(). It runs at the end of each of the four source reads and once more at the end; together with the binding read, that brackets every source read. The result is 6 scope checks per value instead of about 25.Tests
value_identity_changedand gives no value and no proof.test_native_value_completeness.py,test_structural_value_completeness.py,test_win_agent_server.py,test_native_focus_keyboard.py,test_native_value_deployment.pyandtest_native_editable_value.py: 355 passed before the new tests.test_native_value_completeness.py: 81 passed with them.form_state_unreadable, and onefault-ambiguitytrial'squalification_fault_receipt_binding_invalid, which fails closed as FAILED_PLATFORM.Safety argument for review
Between two getters inside one source read, the bound control's identity (RuntimeId, HWND, PID, native owner) and its sensitive status are still rechecked every time. Only the caller's wider scope check, meaning which control has focus and what is hit at its point, moves to the read boundaries. A change in that scope during a read is caught at the read's end, and the value is discarded.