Repository navigation
fix(tests): stop the Sessions gallery UI test failing when the pane toggle appears late - #2329
Conversation
… test SessionsDesignNativeWindowGallery invoked SettingsTogglePane through a one-shot UIA lookup right after collapsing the pane. CI (run 44386345268) missed the rendered toggle once and failed with a NullReferenceException. Wait for the toggle to be present and enabled, then wait for the pane state to change, instead of using a fixed sleep. Harden the matching collapse step the same way. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 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 replaces immediate Settings pane toggle lookups and a fixed delay with bounded readiness and pane-state waits in the Sessions gallery test. Example: SettingsTogglePane is temporarily absent from UI Automation for 4 seconds after collapsing the pane.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it provides a focused fix still absent from main, with no actionable defect found in the introduced diff. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe fixture UI suite drives the real Windows app against synthetic Gateway data and captures Sessions layouts through UI Automation. flowchart LR
A[Sessions gallery test] --> B[Bounded UIA readiness helper]
B --> C[Settings pane toggle]
C --> D[Settings shell pane state]
D --> E[Search button visibility]
E --> F[Layout captures and assertions]
Technical reviewBest possible solution: Retain the existing gallery owners and assertions while using bounded toggle acquisition and observable pane-state waits. Do we have a high-confidence way to reproduce the issue? The base source invokes a nullable UIA lookup immediately after pane collapse, establishing the reported null-dereference path; the author also reports a matching injected reproduction. Is this the best way to solve the issue? The patch is the smallest complete repair: wait for the existing toggle, invoke once, observe the production pane state, and preserve layout checks without adding production machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3196d82f1bcf. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
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:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 18, 2026, 7:27 PM ET / November 19, 2026, 00:27 UTC. |
The new-test soak sets OPENCLAW_GATEWAY_FIXTURE_SCREENSHOTS=0, so CaptureWidth failed reading a PNG that was never written. Hash captures and check their distinctness only when screenshots are enabled; geometry, tier and pane assertions still run. Co-authored-by: Copilot App <[email protected]>
Related: CI flake on
maina912363, run 44386345268, job 135092115045. This is a different failure in the same test that #2132 fixed earlier.What Problem This Solves
The "Mock Gateway application and compatibility tests" CI job sometimes fails in
SessionsDesignNativeWindowGallerywith aNullReferenceException. The test collapses the Settings pane, then immediately looks up the pane toggle button once. When UI Automation has not yet exposed the toggle, the lookup returns null and the test crashes. In the CI failure screenshot, the toggle is visibly rendered.User Impact
User impact: there is no user-visible change. This is a test-only fix, so
mainCI no longer fails on this race.Why This Change Was Made
The restore step now waits for the toggle to be present and enabled before invoking it, using the existing bounded
InvokeWhenEnabledAsynchelper. It then waits for an observable pane state instead ofThread.Sleep(250): the toolbar search button, which exists only while the pane is open. The matching collapse step earlier in the same flow gets the same treatment. The timing-pattern baseline is lowered for this file only: one fewer fixed delay and two fewer one-shot lookups. Product code is unchanged.The 400 ms settle after the restore resize stays as it was. That resize changes only the height and is not part of this failure. A width-only wait there would have added new one-shot UIA lookups (review finding).
Evidence
AccessibilityView=Raw. Layout and focus are unchanged. With that change, the original test failed 2/2 with the exact CI stack:Invokeline 2236 ←RestoreBaselineWindowline 2570 ← test line 890.RestoreBaselineWindowAsync.Change Type
Scope
winnodeRequired proof pools
none: test-only change to a gateway-fixture UI test. The existing "Mock Gateway application and compatibility tests" CI job runs it, and no capacity-dependent custom Windows proof applies.Validation
Everything below passed on the final tree (base
cf58b63936de01a66fe3b7bdb40616eda39cfbe0plus this diff), on Windows x64. GitVersion needed a sanitized PATH to avoid exit code 9009../scripts/validate-test-timing-patterns.ps1: passed.git diff --check: clean../build.ps1: all 5 projects built.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: Passed 5910, Skipped 29, Failed 0.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: Passed 6761, Failed 0.dotnet test tests/OpenClaw.Tray.UITests/OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-build --filter "FullyQualifiedName~GatewayFixtureUiTests.SessionsDesignNativeWindowGallery"withOPENCLAW_RUN_GATEWAY_FIXTURE_UI=1,OPENCLAW_GATEWAY_FIXTURE_SCREENSHOTS=1, and isolatedOPENCLAW_TRAY_DATA_DIR,OPENCLAW_TRAY_APPDATA_DIRandOPENCLAW_TRAY_LOCALAPPDATA_DIRtemp directories. Results: RED 2/2 failed as expected, GREEN 5/5 passed with injection, and 3/3 passed clean.Real Behavior Proof
61cc595ee4c3f06d260c7ecbc54e9e0b902ab971(the final working tree before commit, basecf58b639).dotnet testcommand above, with and without the temporary localAccessibilityView=Rawinjection onSettingsTogglePane.System.NullReferenceExceptionatGatewayFixtureUiTests.Invoke←RestoreBaselineWindow←SessionsDesignNativeWindowGallery(2/2). After the fix,Passed SessionsDesignNativeWindowGallery(5/5 with injection, 3/3 clean).Security Impact
Yes, explain the risk and mitigation: N/ACompatibility and Migration
Review Conversations