Skip to content

Stabilize Windows UIA foreground focus - #394

Merged
coneilen merged 1 commit into
mainfrom
coneilen-microsoft-fix-windows-spikes-reliability
Sep 21, 2026
Merged

coneilen merged 1 commit into
mainfrom
coneilen-microsoft-fix-windows-spikes-reliability

Conversation

@coneilen

Copy link
Copy Markdown
Collaborator

Summary

This hardens the Windows UIA live gate against the windows-spikes foreground/focus contention failure without weakening the row identity assertions. The gate now uses attached-thread foreground activation, only accepts the row focus sample when GraphCode owns the foreground window, and emits focused-element/foreground-owner diagnostics when contention remains.

Evidence

RED: gh run view 35530292594 --repo scgopi/GraphCode --log-failed -> windows-spikes failed in Native UI Automation live gate with worktree row could not retain focus against concurrent desktop focus changes; focused=Text Area:Text Area; gh run view 35499731585 --repo scgopi/GraphCode --log-failed -> main workflow-dispatch baseline failed at the same assertion.

GREEN: ./Tools/windows/Tests/ValidationRunner.Tests.ps1; PowerShell parser check for Tools/windows/uia-live-gate.ps1; embedded C# Add-Type compile check; git diff --check -> all passed locally. A full local ./Tools/windows/validate.ps1 -Task windows-shell -SkipTrayLive attempt was blocked before this change path by the local Swift toolchain error missing required modules: '_complex', 'ucrt'.

REGRESSION: ./Tools/windows/Tests/ValidationRunner.Tests.ps1 -> now asserts the UIA live gate keeps AttachThreadInput, IsForegroundWindow($shellWindow), and UIA_FOCUS_DIAGNOSTICS coverage so row focus is not accepted without foreground ownership evidence.

@coneilen
coneilen force-pushed the coneilen-microsoft-fix-windows-spikes-reliability branch 10 times, most recently from 78bd081 to 6981dbd Compare September 21, 2026 00:29
Require the UIA live gate to regain true foreground ownership before accepting row focus, and log foreground/focused-element diagnostics when the contention path fails.

Add a validation-runner guard so the live gate cannot regress to accepting row focus without foreground ownership evidence.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen force-pushed the coneilen-microsoft-fix-windows-spikes-reliability branch from 36f4c8d to 724a148 Compare September 21, 2026 01:03
@coneilen
coneilen merged commit 0210e0e into main Sep 21, 2026
10 checks passed
@coneilen
coneilen deleted the coneilen-microsoft-fix-windows-spikes-reliability branch September 21, 2026 01:34
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