Stabilize Windows UIA foreground focus - #394
Merged
Merged
Conversation
coneilen
force-pushed
the
coneilen-microsoft-fix-windows-spikes-reliability
branch
10 times, most recently
from
September 21, 2026 00:29
78bd081 to
6981dbd
Compare
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
force-pushed
the
coneilen-microsoft-fix-windows-spikes-reliability
branch
from
September 21, 2026 01:03
36f4c8d to
724a148
Compare
coneilen
deleted the
coneilen-microsoft-fix-windows-spikes-reliability
branch
September 21, 2026 01:34
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
This hardens the Windows UIA live gate against the
windows-spikesforeground/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-spikesfailed inNative UI Automation live gatewithworktree 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 forTools/windows/uia-live-gate.ps1; embedded C#Add-Typecompile check;git diff --check-> all passed locally. A full local./Tools/windows/validate.ps1 -Task windows-shell -SkipTrayLiveattempt was blocked before this change path by the local Swift toolchain errormissing required modules: '_complex', 'ucrt'.REGRESSION:
./Tools/windows/Tests/ValidationRunner.Tests.ps1-> now asserts the UIA live gate keepsAttachThreadInput,IsForegroundWindow($shellWindow), andUIA_FOCUS_DIAGNOSTICScoverage so row focus is not accepted without foreground ownership evidence.