Skip to content

fix(tests): wait for the Sessions gallery window - #2337

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-daily-flake-fix
Nov 24, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-daily-flake-fix

Conversation

@bkudiess

@bkudiess bkudiess commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: a47d933b91592d14f5d293ff1afbed029f1293a9

Dimension Assessment Rationale
Change confidence 9/10 ↑ Fresh-head gallery passed 20 runs and CI fixture shard passed 88/88 including the gallery; injected recovery and prior contention proof support the fix.
↓ Nine local fixture cases failed on both base and head; ARM64 gallery resize failure remains unexplained.
Diagnosis confidence 9/10 ↑ An injected empty window enumeration reproduced the CI stack and passed with bounded re-acquisition.
Evidence fit 9/10 ↑ The failure reaches the same one-shot Single lookup 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. SettingsWindow now 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 optional OPENCLAW_TEST_SETTINGS_WINDOW_TIMEOUT_SECONDS override. The 100 ms delay is a polling interval, not a layout settle.

The gallery and its helper path contain no other throwing Single/First window 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 taking sessions-width-1000.png. RED reproduced InvalidOperationException: Sequence contains no matching element through SettingsWindow -> 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 e2a47a77825072b83e9431a1ee7f46a7f674aa22 also 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

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required 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 on 01eeb998c535ca0c14d747b27e9daea91a512bb0. 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:

$shardA = 'Category=GatewayFixture&KeyboardProof!=Required&FullyQualifiedName!~OpenClaw.Tray.UITests.GatewayFixtureUiTests.Automations&FullyQualifiedName!~OpenClaw.Tray.UITests.GatewayFixtureUiTests.Inbox&FullyQualifiedName!~OpenClaw.Tray.UITests.GatewayFixtureUiTests.Dashboards&FullyQualifiedName!~OpenClaw.Tray.UITests.GatewayFixtureUiTests.Usage&FullyQualifiedName!~OpenClaw.Tray.UITests.GatewayFixtureUiTests.MainSearch'
Command Result
.\build.ps1 Passed at a47d933b, local x64 and Crabbox RTX 1 and 2 ARM64
dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 -p:DevBuild=false Passed at a47d933b, local x64; ARM64 build also passed on both Crabbox hosts
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore At a47d933b: 5,972 passed, 29 skipped, 0 failed
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --logger 'trx;LogFileName=tray.trx' --results-directory <isolated-results> At a47d933b on Crabbox RTX 2: 6,941 passed, 0 skipped, 0 failed. A local a47d933b run also passed 6,941/6,941. Earlier e2a47a run 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'} Earlier base 8ffe470e: expected RED, 0/1, exact CI stack and injection log confirmed
Invoke-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'} Earlier base 8ffe470e: GREEN, 1/1; injection artifact confirmed
Invoke-NativeUiTest.ps1 -Worktree <worktree> -Owner <iteration-owner> -Filter 'FullyQualifiedName~SessionsDesignNativeWindowGallery' -Repeat 1 -Screenshots <0-or-1> -KeyboardProof -ArtifactsRoot <iteration-results> Local x64 at 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> Helper-only change needs explicit affected-test selection, supplied to the soak
.\scripts\Invoke-CiTestSoak.ps1 -SelectionPath <explicit-gallery-selection> -ResultsDirectory <isolated-results> through Invoke-WithDesktopLock.ps1 At e2a47a: 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 -KeyboardProof At e2a47a: 137 passed, 9 failed. All nine failed identically in a locked A/B of clean base 01eeb998 and PR head a47d933b; causes unknown.
PR CI Build and Test 45291444622, attempt 1 Passed at 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.ps1 Passed; baseline not raised
git --no-pager diff --check Passed

Dual-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

  • Environment tested: native Windows x64, Active and unlocked desktop, isolated real Companion app against the synthetic loopback fixture Gateway, shared desktop lock; managed suite additionally on Crabbox native ARM64.
  • PR head or commit tested: a47d933b91592d14f5d293ff1afbed029f1293a9; earlier load proof e2a47a77825072b83e9431a1ee7f46a7f674aa22 shares the current test-file Git blob 9c1f1372c1315c0322989e2de2698200d51b840b.
  • Exact steps or command run: RED/GREEN and final-repeat commands above. Native runner resides in ~\.copilot\skills\openclaw-flake-fix\scripts.
  • Evidence after fix: 20 individual fresh-head runs returned SUMMARY: 1/1 passed (HEAD=a47d933b91592d14f5d293ff1afbed029f1293a9 dirty=0). Earlier injected GREEN returned SUMMARY: 1/1 passed, with INJECTED: one empty owned-window enumeration during CaptureSessionsWindow. recorded in its artifact.
  • Additional load proof: at e2a47a, 20/20 gallery passes through the CI soak, including six contended runs. Screenshot-1 produced ten sessions-width-1000.png captures; screenshot-0 produced none.
  • Observed result: the temporary missing UIA window is reacquired and the gallery preserves its original screenshot, width, tier and distinct-image assertions.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A. Local screenshots inspected; no private machine path presented as public evidence.
  • Not verified or blocked: on two Crabbox ARM64 hosts at 200% DPI, the current head's gallery stopped at the 1386-DIP resize, measuring 1376 DIP; clean main 01eeb998 failed identically on RTX 1, while clean main was not run on RTX 2. Cause is unknown. A local e2a47a full fixture run failed nine cases: two Automations_PinnedHostToggleHitTabAndBanner, PinnedSystems_ToggleHitTabAndFeedbackRemainOnVisibleSurface, two Automations_HeroWashScrollsWhileTheBackplateStaysAnchored, two SidePanel_TitleBarControlsAndCaptionRowTabsTakeRealPointerClicks, DesktopLobster_ClickTypesIntoRealComposer_AfterExternalEditorFocus_AndRetainsDraft, and SessionsRows_ArrowNavigationEntersLaterRowActions. A locked nine-case comparison failed the same cases on clean main 01eeb998 and head a47d933b; 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

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): No
  • Command or tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: N/A

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes
  • Config or environment changes? (Yes/No): Yes, optional test-only OPENCLAW_TEST_SETTINGS_WINDOW_TIMEOUT_SECONDS override; defaults to 20 seconds.
  • Migration needed? (Yes/No): No
  • If yes, list the exact upgrade steps: N/A

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: The immediate Single lookup throws InvalidOperationException.
  • After: The helper polls until it finds the window, with a default 20-second acquisition budget.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with reported native fixture validation; retained runtime artifacts were not independently inspected and CI remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) No shipped behavior changes; the body records native Windows x64 fixture fault injection and repeat runs against the identical helper source, with local artifacts described but not publicly linked.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Contributors encounter intermittent red CI when the Sessions gallery cannot immediately reacquire its native window.
Reason: The collaborator-authored repair follows the repository's observable-readiness guidance and preserves the existing gallery contract; its optional timeout override is test-only.

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
Reviewed head: bc20e35db36459711e6d294d547ee570c8cd7e9f

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Sessions window acquisition keeps the original intent (3f47e83: The native Sessions redesign added responsive gallery captures using a uniquely identified owned window; its merged PR documents the intended layout and capture coverage.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Pedro Larroy: Raw commit b6c849e adds tests/OpenClaw.Tray.UITests/GatewayFixtureUiTests.cs:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: b6c849e8ed44; files: tests/OpenClaw.Tray.UITests/GatewayFixtureUiTests.cs)
  • Scott Hanselman: Raw commit 3e74082 adds tests/OpenClaw.Tray.UITests/GatewayFixtureUiTests.cs:279 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 3e740827aeb1; files: tests/OpenClaw.Tray.UITests/GatewayFixtureUiTests.cs)

Preflight source

Source 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

Metric Value Why it matters
Change size Production +0/-0; test helper +35/-3 The growth supplies bounded synchronous acquisition and explicit cardinality handling for existing synchronous callers.

Labels

Label changes:

  • add P2: Intermittent false CI failures consume contributor and maintainer attention without a demonstrated shipped-product outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Intermittent false CI failures consume contributor and maintainer attention without a demonstrated shipped-product outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

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]>
@bkudiess
bkudiess force-pushed the bkudiess-daily-flake-fix branch from bc20e35 to a47d933 Compare November 23, 2026 23:44
@bkudiess
bkudiess merged commit 6958dae into openclaw:main Nov 24, 2026
34 checks passed
vincentkoc added a commit that referenced this pull request Nov 24, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant