From 29c7a65633f90f9ba513c54c34fbd573a6992a91 Mon Sep 17 00:00:00 2001 From: Colin Neilens Date: Wed, 23 Sep 2026 21:29:36 -0700 Subject: [PATCH] Re-resolve the graph parent while waiting for workspace chrome The mount loop re-queried its children every attempt but from a \ reference captured before the project and loop rows were invoked. That invocation transitions the canvas and remounts the graph fragment, so the captured parent can already be dead when the loop starts, and Get-DirectChildren on a dead parent yields nothing for as long as it is asked. Waiting longer could never recover from that. Re-resolve the parent alongside the children on every attempt, in both the chrome mount loop and the detail-children loop, so each attempt observes one live generation of the tree. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens --- Tools/windows/uia-live-gate.ps1 | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Tools/windows/uia-live-gate.ps1 b/Tools/windows/uia-live-gate.ps1 index 51c6a80f..9cda0f52 100644 --- a/Tools/windows/uia-live-gate.ps1 +++ b/Tools/windows/uia-live-gate.ps1 @@ -1568,12 +1568,17 @@ try { $workspaceStart = $null $workspaceUsage = $null # The workspace chrome mounts its toolbar, tab, split-control and detail children - # asynchronously after the loop invocation above. A loaded CI runner has been observed - # exhausting a 10s budget here and failing on the toolbar identity child while every - # other assertion in this block was satisfiable moments later, so this waits 20s. - # The break condition below is unchanged: all eight children must still appear. + # asynchronously after the loop invocation above. The invocation also remounts the + # graph fragment itself, so the parent captured before it can be dead by the time + # this loop runs - and Get-DirectChildren on a dead parent yields nothing forever, + # which no amount of waiting recovers from. Re-resolve the parent as well as the + # children on every attempt so this observes the live tree rather than a stale + # generation of it. The break condition is unchanged: all eight children must appear. for ($attempt = 0; $attempt -lt 200; $attempt++) { - $workspaceChildren = @(Get-DirectChildren $graph $rawWalker) + $liveGraph = Find-FragmentById $root "graph" $rawWalker + if ($null -eq $liveGraph) { Start-Sleep -Milliseconds 100; continue } + $graph = $liveGraph + $workspaceChildren = @(Get-DirectChildren $liveGraph $rawWalker) $workspaceToolbar = @($workspaceChildren | Where-Object { $_.Current.AutomationId -match '^workspace-toolbar-' -and $_.Current.Name -eq "UIA project" }) | Select-Object -First 1 @@ -1638,7 +1643,16 @@ try { $resolvedDetails = $null $detailFailure = "workspace right panel never resolved its detail children" for ($attempt = 0; $attempt -lt 100; $attempt++) { - $liveChildren = @(Get-DirectChildren $graph $rawWalker) + # Re-resolve the parent too: the fragment provider can remount the graph itself, + # and a dead parent yields no children no matter how long this waits. + $liveGraph = Find-FragmentById $root "graph" $rawWalker + if ($null -eq $liveGraph) { + $detailFailure = "workspace right panel lost its graph parent while waiting for layout" + Start-Sleep -Milliseconds 100 + continue + } + $graph = $liveGraph + $liveChildren = @(Get-DirectChildren $liveGraph $rawWalker) $candidates = @() $pendingLabel = $null foreach ($spec in $detailSpecs) {