Repository navigation
fix(tests): Dashboards fixture tests fail when a control's UI Automation element is briefly missing after a re-render or resize - #2222
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 existing Dashboards fixture tests wait for missing UI Automation elements and retain settled resize measurements. Example: DashboardsContentHost briefly disappears from UI Automation during a minimum-width resize.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this collaborator-authored PR addresses remaining unsafe UIA reads on main, and no definite introduced defect was found. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe native Dashboards fixture tests drive Companion against a synthetic Gateway, observe controls through Windows UI Automation, and produce assertions and screenshots for CI. flowchart LR
A[Mock Gateway] --> B[Companion Dashboards]
B --> C[Windows UI Automation]
C --> D[Dashboards fixture tests]
D --> E[CI assertions and artifacts]
Technical reviewBest possible solution: Retain the focused readiness changes and unchanged assertions, then resolve attribution of the failing responsive-layout soak before landing. Do we have a high-confidence way to reproduce the issue? Main contains one-shot dereferences and throwing host reads that fail immediately when UIA returns no element; the PR reports a local backdrop failure, but this review ran no target code. Is this the best way to solve the issue? The patch addresses readiness at the existing test owners, retains captured elements, resets samples when the host is absent, and preserves single invocation and assertion semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 86b17b750e85. 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:
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 14, 2026, 1:18 AM ET / 06:18 UTC. |
GatewayFixtureNativeDashboardsUiTests.cs produced repeated CI flakes from one-shot FindById(...)! reads after a re-render or resize (openclaw#2171, openclaw#2193). Sweep the remaining 30 into bounded waits: invocations wait until the control is present and enabled and invoke once, reads wait for presence and keep the polled element, and lambdas inside waits treat a missing peer as not ready. A local run also showed DashboardsBackdropSpansGalleryAndBoardInBothThemes failing with "Named backdrop host is missing": its stability wait polled a helper that threw when the host peer was briefly absent during the minimum-width resize. The backdrop and responsive stability waits now treat a missing host as not ready, restart their stability window, and return the settled width so callers do not re-read it once. The one-shot lookup baseline entry for this file drops from 30 to 0. Co-authored-by: Copilot App <[email protected]>
7085f3e to
6c0bb78
Compare
…t widget state
The new-test soak's CPU-contention run failed
DashboardsRenderNativeReportsTabsAndFailureStates with "Timed out waiting for
visible dashboard pixels: 99.97, Uptime". The failure frame shows the HTML
Service health widget still in the product's Slow state ("This widget is taking
longer than usual to load") 30.1 s after board.get. On CI, boards normally
render in 1.8-6.6 s (12 samples, 4 runs).
Replace the literal 30 s with DashboardPixelsTimeout (default 60 s, override
OPENCLAW_GATEWAY_FIXTURE_DASHBOARD_PIXELS_TIMEOUT_SECONDS, capped at 90 s):
one product frame retry after its 30 s load deadline plus a normal render,
inside the 150 s test body budget. On timeout, the message now names each
widget's Loading, Slow, Error or NeedsApproval state, so a slow load stays
distinguishable from a failed one. The diagnostic never replaces the timeout.
Co-authored-by: Copilot App <[email protected]>
Related: #2171 (fix: pinned pages can crash Companion after Settings refreshes its agent list), #2193 (fix(tests): Dashboards test crashes when the empty board's detail text is read once after a re-render), #2216 (fix(tests): Automations fixture tests fail when an editor control's UI Automation element appears late)
What Problem This Solves
Fixes: the native Dashboards Mock Gateway fixture UI tests intermittently fail when the test reads a dashboard, sidebar or title-bar control that UI Automation has briefly not published, for example right after a re-render, a pin change or a window resize. This file produced three CI hits in one day (#2171, #2193).
User Impact
User impact: there is no product change. Contributors stop seeing false Dashboards fixture failures.
Why This Change Was Made
#2171 and #2193 each fixed one single lookup in this file. 30 more lookups of the same kind remained. Each found a control once and assumed it was there (
FindById(...)!). All of them are now bounded waits:State and geometry assertions are unchanged. They still read the value once, right after the wait.
A second flake, found while validating: on the first local run,
DashboardsBackdropSpansGalleryAndBoardInBothThemesfailed with "Named backdrop host is missing". This was on code this PR had not changed yet.The backdrop and responsive tests' stability waits now do the following:
The backdrop test still reads the host again (in a bounded wait) after each screenshot, so the recorded and asserted width matches the saved frame.
The repository timing baseline entry for this file is removed: its one-shot lookup count drops from 30 to 0. The change adds no retries, sleeps, fixed settle counts, skips or weaker assertions.
Dashboard pixel wait budget (added after rebasing onto #2227). With native input available in the soak, the first soak attempt ran all four Dashboards tests.
DashboardsRenderNativeReportsTabsAndFailureStateswithTimed out waiting for visible dashboard pixels: 99.97, Uptime(run 43633347061, job 132564781176). This PR had not changed that line.board.getreturned, and the rest of the board had rendered.Evidence for the new budget:
board.getto the expected pixels was 1.8-6.6 s across 12 samples in 4 runs (shard B of three PRs, plus this soak's passing runs).BoardWidgetWebHost,BoardWidgetDocumentLoader): a widget shows Slow after 10 s. Each sandbox frame or document delivery has a 30 s load deadline. A frame that never becomes ready is retried with backoff, and the widget shows an error after 3 attempts.Change:
DashboardPixelsTimeout: default 60 s, overridable withOPENCLAW_GATEWAY_FIXTURE_DASHBOARD_PIXELS_TIMEOUT_SECONDS, capped at 90 s. This follows the file's existing named-timeout pattern.Evidence
IsOffscreenon the element whose bounds it measured, instead of finding it again. This is a stricter check of the same element, and the separate occluder window does not re-render the app.... Widget state: BoardWidget_status-card: Loading.That run used the first version of the diagnostic. The local desktop then locked, so later local runs are invalid and this PR's soak is the runtime proof.Change Type
Scope
winnodeRequired proof pools
none: test-only change to Mock Gateway fixture UI tests that CI runs directly.Validation
All runs were local on Windows x64 at 175% DPI, with isolated profiles and physical input proof enabled. Metadata for the real
%APPDATA%/%LOCALAPPDATA%\OpenClawTraywas unchanged after every run.Each pass runs all 4 Dashboards fixture tests:
DashboardsPinnedHost_RecordsBothThemesAcrossPaneAndScrollStates,DashboardsBackdropSpansGalleryAndBoardInBothThemes,DashboardsResponsiveLightWidthsRenderTheMeasuredPageHostandDashboardsRenderNativeReportsTabsAndFailureStates.mainthat includes #2216.\scripts\validate-test-timing-patterns.ps1: passed. TheGatewayFixtureNativeDashboardsUiTests.csone-shot entry is removed (30 to 0)../build.ps1: all builds succeeded on the pushed head.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 5876 passed, 0 failed, 29 skipped.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 6669 passed, 0 failed.Real Behavior Proof
main8e9f258b2) adds the pixel budget, which is proven by this PR's soak.dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-x64 -p:DevBuild=false --no-build --filter "FullyQualifiedName~GatewayFixtureUiTests.Dashboards"withOPENCLAW_RUN_GATEWAY_FIXTURE_UI=1and native input proof enabled.Yes/No/N/A): N/A (local artifacts only).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): NoYes/No): NoReview Conversations