Skip to content

fix(tests): Dashboards fixture tests fail when a control's UI Automation element is briefly missing after a re-render or resize - #2222

Merged
bkudiess merged 2 commits into
openclaw:mainfrom
bkudiess:bkudiess-dash-oneshot-sweep
Nov 14, 2026
Merged

bkudiess merged 2 commits into
openclaw:mainfrom
bkudiess:bkudiess-dash-oneshot-sweep

Conversation

@bkudiess

@bkudiess bkudiess commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • An action waits until its control is present and enabled, then invokes it once. A UIA action is never retried. Every old action already needed an enabled control, because invoking a disabled control throws.
  • A read waits until the control is present and keeps the element it found.
  • Code inside an existing wait treats a missing control as "not ready yet" instead of throwing.

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, DashboardsBackdropSpansGalleryAndBoardInBothThemes failed with "Named backdrop host is missing". This was on code this PR had not changed yet.

  • Its "stable host" wait polled a helper that throws when the page host is absent.
  • During the minimum-width resize, the host's UIA element was briefly absent. The wait does not catch that kind of error, so the test failed at once.

The backdrop and responsive tests' stability waits now do the following:

  • Treat a missing host as not ready, and start the two-read stability check again.
  • Return the settled width, so the resize logic uses that value instead of reading the host again once.

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.

  • Run 1 passed all four.
  • Run 2, under CPU contention, failed DashboardsRenderNativeReportsTabsAndFailureStates with Timed out waiting for visible dashboard pixels: 99.97, Uptime (run 43633347061, job 132564781176). This PR had not changed that line.
  • The failure frame shows the HTML "Service health" widget still saying "This widget is taking longer than usual to load". That is the product's Slow state: a spinner that keeps loading, not an error. The frame was captured 30.1 s after board.get returned, and the rest of the board had rendered.

Evidence for the new budget:

  • On CI, the time from board.get to 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).
  • One earlier failure of the same wait is in the CI inventory (11-09, run 42721643675).
  • Product timing (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:

  • The literal 30 s is now DashboardPixelsTimeout: default 60 s, overridable with OPENCLAW_GATEWAY_FIXTURE_DASHBOARD_PIXELS_TIMEOUT_SECONDS, capped at 90 s. This follows the file's existing named-timeout pattern.
  • 60 s covers one product frame retry after its 30 s deadline plus a normal render, and stays inside the 150 s test body budget. The normal path still returns in seconds.
  • On timeout, the message now names each widget's state (Loading, Slow, Error or NeedsApproval), so a slow load stays distinguishable from a failed one. Slow is detected by its visible text, because its panel has no UI Automation element. The diagnostic is best-effort and never replaces the original timeout.

Evidence

  • RED: the local backdrop failure above ("Named backdrop host is missing", raised from inside the stability wait during the minimum-width capture), on the original helper.
  • GREEN: after the fix, the four Dashboards fixture tests passed 12 times in a row (see Validation).
  • The other 30 conversions have the same cause as the CI failures fixed in fix: pinned pages can crash Companion after Settings refreshes its agent list #2171 and fix(tests): Dashboards test crashes when the empty board's detail text is read once after a re-render #2193. I could not force those publishing gaps locally.
  • Review: dual-model Hanselman review (Claude Opus 5.5 and GPT-6 Astra long-context, both high effort), plus a delta review of the fixes. Both delta reviews were clean.
    • Both models (HIGH consensus): the pinned-host settle wait kept its previous width when the host disappeared, so it could report "settled" after one read of a re-created host. Fixed: it now resets the stability check.
    • Opus MEDIUM: the backdrop test first used the pre-capture width for its assertions and evidence. Fixed: a bounded re-read after the capture ties them to the saved frame again.
    • Opus LOW, not changed: the occlusion negative control checks IsOffscreen on 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.
  • Pixel budget review: dual-model review of the pixel budget change, plus a delta review.
    • Both models (HIGH consensus): the first diagnostic caught only two exception types, so a UIA error could have replaced the timeout. Fixed: it now catches every exception.
    • Opus MEDIUM: Slow was identified by a panel id that has no UI Automation element, so it would have been reported as Loading. Fixed: Slow is detected by its text.
    • Lower-severity fixes from both models: each widget is checked separately with cached properties; board-wide timeouts are labelled as such; the comment no longer promises a terminal state; the override cap is lowered from 120 to 90 s.
    • Both delta reviews were clean.
    • Not changed (Astra): recording the state during polling instead of after the timeout. A hung UIA provider is still bounded by the 150 s body budget.
  • Local check of the new message: with the budget overridden to 1 s, the timeout read ... 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

  • 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

  • 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%\OpenClawTray was unchanged after every run.

Each pass runs all 4 Dashboards fixture tests: DashboardsPinnedHost_RecordsBothThemesAcrossPaneAndScrollStates, DashboardsBackdropSpansGalleryAndBoardInBothThemes, DashboardsResponsiveLightWidthsRenderTheMeasuredPageHost and DashboardsRenderNativeReportsTabsAndFailureStates.

Tree Result
Before the backdrop fix Run 1 failed: backdrop host missing (RED above)
After the sweep and backdrop fix 5/5 passes
After the review fixes 5/5 passes
Pushed head, after rebasing onto main that includes #2216 2/2 passes
  • .\scripts\validate-test-timing-patterns.ps1: passed. The GatewayFixtureNativeDashboardsUiTests.cs one-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

  • Environment tested: local Windows x64 desktop, 175% DPI, isolated profiles.
  • PR head or commit tested: 7085f3e for the sweep. Head a2ee25b (on main 8e9f258b2) adds the pixel budget, which is proven by this PR's soak.
  • Exact steps or command run: dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-x64 -p:DevBuild=false --no-build --filter "FullyQualifiedName~GatewayFixtureUiTests.Dashboards" with OPENCLAW_RUN_GATEWAY_FIXTURE_UI=1 and native input proof enabled.
  • Evidence after fix: the pass counts above.
  • Observed result: every Dashboards action and read waits for its own control, and the resize stability waits survive a briefly missing host.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A (local artifacts only).
  • Not verified or blocked:
    • The first CI attempt at head 6c0bb78 failed only the soak, for the reason described above. The result for head a2ee25b is pending.
    • Two deliberate one-shot reads are unchanged. The responsive test's start-up host check stops on purpose and saves a UIA dump. Its failure handler reads the host width only for diagnostics.

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): No
  • 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 14, 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: The stability wait immediately throws "Named backdrop host is missing."
  • After: The bounded wait resets its stability samples and continues until the host returns with a stable width.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused test repair with limited validation confidence while the current-head soak failure remains unclassified.
Proof confidence 🦐 gold shrimp (3/6) This test-only patch requires no additional shipped-entry-point proof; the reported native fixture runs support its changed test behavior.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Contributors encounter false Dashboards fixture failures when controls briefly disappear from UI Automation.
Reason: The repair follows the established timing contract, preserves meaningful native rendering coverage, and has direction authorized by its collaborator author.

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
Reviewed head: 7085f3e094ac834a417068bdbeed91e46dee1674

Before merge

None.

Findings

None.

Agent review details

How this fits together

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

Technical review

Best 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

  • Dashboards element acquisition and resize stability keeps the original intent (e59374c: The original Dashboards feature added native rendering, layout, scrolling, and failure-state coverage; subsequent chrome work retained these contracts.)
  • Timing-pattern baseline keeps the original intent (8b7a8be: The earlier detail-read repair lowered this file's remaining one-shot count to 30; removing the entry now continues the same ratchet.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Raw commit e59374c adds tests/OpenClaw.Tray.UITests/GatewayFixtureNativeDashboardsUiTests.cs:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e59374c064f4; files: tests/OpenClaw.Tray.UITests/GatewayFixtureNativeDashboardsUiTests.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 scope Production +0/-0; tests and baseline +121/-67 Growth is confined to readiness handling in existing tests, without new production machinery or test processes.

Labels

Label changes:

  • add P3: This is a test-reliability repair with no shipped product behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a test-reliability repair with no shipped product behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Inspect the failed responsive-layout test's TRX to establish whether the failure is introduced or pre-existing.

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 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]>
@bkudiess
bkudiess force-pushed the bkudiess-dash-oneshot-sweep branch from 7085f3e to 6c0bb78 Compare November 14, 2026 19:40
…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]>
@bkudiess
bkudiess merged commit d79a8fd into openclaw:main Nov 14, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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