Repository navigation
fix(tests): wait for the Sessions gallery window - #2337
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes Sessions gallery helpers wait for the owned window when UI Automation temporarily cannot find it. Example: UI Automation returns no owned window while capturing sessions-width-1000.png.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a concrete test-harness failure still present on main, and no actionable defect was found in the introduced diff. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe fixture UI suite drives an isolated Companion app against synthetic Gateway data; its Sessions helpers acquire owned native windows for screenshots, resizing, scrolling, and layout assertions. flowchart LR
A[Sessions gallery test] --> B[Settings window helper]
B --> C[Owned process windows]
C --> D[Sessions page marker]
D --> E[Successful window observation]
E --> F[Capture and layout assertions]
Technical reviewBest possible solution: Keep bounded acquisition in the existing SettingsWindow owner while preserving unique-window selection, app-exit failures, and all gallery assertions. Do we have a high-confidence way to reproduce the issue? The base source deterministically throws when window enumeration has no Sessions match; the author reports reproducing that exact path with one injected empty enumeration, but this review did not execute it. Is this the best way to solve the issue? The change fixes readiness at the shared acquisition owner, retains the successful observation, and preserves existing failure conditions without adding production machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8ffe470e7d50. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 19, 2026, 3:09 AM ET / 08:09 UTC. |
Re-acquire the owned Sessions window inside a bounded poll so transient UIA misses do not fail screenshot and layout helpers. Keep duplicate-window and app-exit failures immediate. Co-authored-by: Copilot App <[email protected]>
bc20e35 to
a47d933
Compare
…ersion7-coordinated-2355-20261124 * commit 'f86e395d5c8edbc968d8d6e789d1ac16a1124a80': fix(tests): read chat text from complete UIA snapshots (#2364) fix: reduce typing lag in long chats (#2343) fix(tests): wait for the Sessions gallery window (#2337) fix(migration): keep the shutdown request until the receiver reads it (#2360) fix(tests): isolate settings publication tests from ThreadPool pressure (#2359) fix: keep candidate builds from contending on GitHub environment exports fix(tests): prevent stale chat ink captures (#2357)
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
a47d933b91592d14f5d293ff1afbed029f1293a9↓ Nine local fixture cases failed on both base and head; ARM64 gallery resize failure remains unexplained.
Singlelookup through the screenshot path; the injection reproduced that stack.↓ The original intermittent miss itself was not captured live.
Related: #2262 and #2329 (fix(tests): stop the Sessions gallery UI test failing when the pane toggle appears late).
What Problem This Solves
Main CI can fail while taking the Sessions gallery screenshots because one UI Automation lookup can temporarily miss the Sessions window. The gallery must wait for that window instead of failing its first lookup.
User Impact
User impact: no user-visible product change. This fixes an intermittent test-harness failure without changing the app or weakening its geometry and screenshot assertions.
Why This Change Was Made
Main run 44460609847 failed after five successful main runs following the earlier pane-toggle repair. That fix missed the screenshot helper, which the screenshot-disabled soak did not exercise.
Class 1: a one-shot live UIA lookup.
SettingsWindownow re-enumerates owned windows inside a bounded poll and returns the successful observation. Missing or detached peers are not ready; multiple matching windows and app exits still fail immediately. Its nine call sites share this fix, including capture, resize, scrolling, visibility, restoration and failure capture. The default 20-second acquisition budget has the optionalOPENCLAW_TEST_SETTINGS_WINDOW_TIMEOUT_SECONDSoverride. The 100 ms delay is a polling interval, not a layout settle.The gallery and its helper path contain no other throwing
Single/Firstwindow acquisitions. Three such lookups elsewhere in the file belong to unrelated tests and were not swept. Existing host-element lookups remain unchanged and on watch. No MEDIUM-or-higher finding was reported by either reviewer; Opus noted LOW diagnostic, bounded nested-wait and pre-existing host-lookup limitations.Evidence
On the earlier base
8ffe470e, an uncommitted, environment-gated fault returned one empty owned-window enumeration while takingsessions-width-1000.png. RED reproducedInvalidOperationException: Sequence contains no matching elementthroughSettingsWindow -> CaptureSessionsWindow -> CaptureWidth -> CaptureSessionsWidthsAsync. The same fault passed after the repair; both runs confirmed the injection fired. The injection was removed before subsequent validation.At the current head, gallery repeats passed 10/10 with screenshots disabled and 10/10 with screenshots enabled, with native input and isolated profiles. Earlier contention soaks at
e2a47a77825072b83e9431a1ee7f46a7f674aa22also passed 10/10 per setting; its changed test-file blob is identical to this PR head. The earlier collapsed-pane PNG was inspected and contains the rendered Sessions page, not a blank frame.Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: native UIA acquisition and screenshot-helper validation against the isolated fixture app. Targeted results below do not claim the entire pool.Validation
The current head is
a47d933b91592d14f5d293ff1afbed029f1293a9, based on01eeb998c535ca0c14d747b27e9daea91a512bb0. Managed and native runs used isolated tray data, roaming and local roots. Historical RED/GREEN, soak and review evidence is explicitly labeled below; identical source does not make it an execution at the new head.The full-lane filter is the existing CI shard-A filter:
.\build.ps1a47d933b, local x64 and Crabbox RTX 1 and 2 ARM64dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 -p:DevBuild=falsea47d933b, local x64; ARM64 build also passed on both Crabbox hostsdotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restorea47d933b: 5,972 passed, 29 skipped, 0 faileddotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --logger 'trx;LogFileName=tray.trx' --results-directory <isolated-results>a47d933bon Crabbox RTX 2: 6,941 passed, 0 skipped, 0 failed. A locala47d933brun also passed 6,941/6,941. Earliere2a47arun had an ActivationRouter timeout; its full rerun passed 6,939/6,939, and #2360 later fixed that test area.Invoke-NativeUiTest.ps1 -Worktree <worktree> -Owner '974a09f3 Sessions RED width path' -Filter 'FullyQualifiedName~SessionsDesignNativeWindowGallery' -Repeat 1 -Screenshots 1 -KeyboardProof -Inject @{OPENCLAW_TEST_INJECT_SETTINGS_WINDOW_MISS='1'}8ffe470e: expected RED, 0/1, exact CI stack and injection log confirmedInvoke-NativeUiTest.ps1 -Worktree <worktree> -Owner '974a09f3 Sessions GREEN width path' -Filter 'FullyQualifiedName~SessionsDesignNativeWindowGallery' -Repeat 1 -Screenshots 1 -KeyboardProof -Inject @{OPENCLAW_TEST_INJECT_SETTINGS_WINDOW_MISS='1'}8ffe470e: GREEN, 1/1; injection artifact confirmedInvoke-NativeUiTest.ps1 -Worktree <worktree> -Owner <iteration-owner> -Filter 'FullyQualifiedName~SessionsDesignNativeWindowGallery' -Repeat 1 -Screenshots <0-or-1> -KeyboardProof -ArtifactsRoot <iteration-results>a47d933b: 10/10 per screenshot setting, zero skipped; shared desktop lock and profile checks passed for each run..\scripts\Get-CiChangedTests.ps1 -BaseRef origin/main -OutputPath <selection>.\scripts\Invoke-CiTestSoak.ps1 -SelectionPath <explicit-gallery-selection> -ResultsDirectory <isolated-results>throughInvoke-WithDesktopLock.ps1e2a47a: screenshots 0 and 1, 10/10 each, including 3 contended iterations per setting, native input on and zero skips. Changed test source is byte-identical to current head; the whole tree differs.Invoke-NativeUiTest.ps1 -Worktree <worktree> -Owner <owner> -Filter 'Category=GatewayFixture' -Repeat 1 -Screenshots 1 -KeyboardProofe2a47a: 137 passed, 9 failed. All nine failed identically in a locked A/B of clean base01eeb998and PR heada47d933b; causes unknown.a47d933b. Fixture UI TRX: 88/88 passed, including Sessions gallery; 0 skipped. The helper-only change selected no tests for the CI soak.pwsh -NoProfile -File .\scripts\validate-test-timing-patterns.ps1git --no-pager diff --checkDual-model static review of the prior unchanged test-file diff found no MEDIUM-or-higher issue. Simplification retained only the acquisition budget and helper-level fix.
Real Behavior Proof
a47d933b91592d14f5d293ff1afbed029f1293a9; earlier load proofe2a47a77825072b83e9431a1ee7f46a7f674aa22shares the current test-file Git blob9c1f1372c1315c0322989e2de2698200d51b840b.~\.copilot\skills\openclaw-flake-fix\scripts.SUMMARY: 1/1 passed (HEAD=a47d933b91592d14f5d293ff1afbed029f1293a9 dirty=0). Earlier injected GREEN returnedSUMMARY: 1/1 passed, withINJECTED: one empty owned-window enumeration during CaptureSessionsWindow.recorded in its artifact.e2a47a, 20/20 gallery passes through the CI soak, including six contended runs. Screenshot-1 produced tensessions-width-1000.pngcaptures; screenshot-0 produced none.Yes/No/N/A): N/A. Local screenshots inspected; no private machine path presented as public evidence.01eeb998failed identically on RTX 1, while clean main was not run on RTX 2. Cause is unknown. A locale2a47afull fixture run failed nine cases: twoAutomations_PinnedHostToggleHitTabAndBanner,PinnedSystems_ToggleHitTabAndFeedbackRemainOnVisibleSurface, twoAutomations_HeroWashScrollsWhileTheBackplateStaysAnchored, twoSidePanel_TitleBarControlsAndCaptionRowTabsTakeRealPointerClicks,DesktopLobster_ClickTypesIntoRealComposer_AfterExternalEditorFocus_AndRetainsDraft, andSessionsRows_ArrowNavigationEntersLaterRowActions. A locked nine-case comparison failed the same cases on clean main01eeb998and heada47d933b; this rules out attributing those results solely to this diff, not their cause. The HeroWash pair passed in inspected CI; the other seven were not run in CI fixture shards. No live Gateway, WSL/MXC, or installer claims. WinApp CLI was unavailable locally.Security Impact
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain the risk and mitigation: N/ACompatibility and Migration
Yes/No): YesYes/No): Yes, optional test-onlyOPENCLAW_TEST_SETTINGS_WINDOW_TIMEOUT_SECONDSoverride; defaults to 20 seconds.Yes/No): NoReview Conversations