Skip to content

fix(tests): Dashboards test crashes when the empty board's detail text is read once after a re-render - #2193

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-dash-empty-detail
Nov 13, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-dash-empty-detail

Conversation

@bkudiess

Copy link
Copy Markdown
Collaborator

Related: #2171 (fix: pinned pages can crash Companion after Settings refreshes its agent list)

What Problem This Solves

Fixes: GatewayFixtureUiTests.DashboardsRenderNativeReportsTabsAndFailureStates intermittently fails with NullReferenceException at GatewayFixtureNativeDashboardsUiTests.cs:1353. Latest occurrence: #2181 run 43494207420, job 132123027028 (Mock Gateway fixture UI shard B, Dark theme, 34 s in). #2181 itself only changed DesktopCompanionWindowTests.cs.

User Impact

User impact: there is no product change. Contributors stop seeing a false Mock Gateway fixture failure.

Why This Change Was Made

Line 1353 is Assert.Equal("No content was supplied …", FindById(run, "DashboardEmptyDetail")!.Current.Name).

The test opens the empty session dashboard and waits until its Open chat action is on screen. It then waits until the re-pinned Dashboards sidebar row is selected, and only after that looks up the detail text once.

On CI that single lookup returned null, but the app was fine:

  • The failure screenshot shows the empty board fully rendered with exactly that detail text.
  • The request log shows a single board.get for the empty session, so the board did not reload.
  • In the product, the title, detail and Open chat action render together in one VStack (DashboardsStates.Status).

So the detail's UI Automation element was briefly unavailable between the test's waits while the sidebar row was being re-added, and the one-shot lookup caught that moment. This is the same one-shot-lookup class #2171 fixed at line 1343 of this test.

The last wait before the assertion and screenshot now requires all three together:

  • the selected pinned row;
  • the on-screen Open chat action;
  • the detail text, read inside the wait.

The exact-text assertion is unchanged and runs right after the wait, followed by the screenshot, so it still checks the state that is captured. The repository timing baseline for this file drops from 31 to 30 one-shot UIA lookups. The change adds no retries of assertions, sleeps, fixed settle counts, skips or weaker assertions.

Evidence

  • Root cause:
  • Deterministic RED/GREEN: not feasible. This is a rare UI Automation publishing gap (one CI occurrence), and I found no way to force it locally. The fix makes the wait condition cover the element the assertion reads, rather than claiming a reproduced race.
  • Review: dual-model Hanselman review (Claude Opus 5.5 and GPT-6 Astra long-context, both high effort), plus a delta review of the fix.
    • Neither found a CRITICAL or HIGH issue.
    • Applied: Opus MEDIUM. The first version read the detail before the pin wait, so the check no longer covered the screenshot moment; the check now runs in the last wait.
    • Applied: Opus LOW. The code comment now states the observed cause, not an unproven one.
    • Not applied: Opus LOW. One combined timeout message no longer says which of the three conditions failed. The failure screenshot shows it.

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 a Mock Gateway fixture UI test that CI runs directly.

Validation

All runs were local on Windows x64 at 175% DPI, with isolated profiles. Metadata for the real %APPDATA%/%LOCALAPPDATA%\OpenClawTray was unchanged after every run.

Check Result
DashboardsRenderNativeReportsTabsAndFailureStates (Light and Dark) on the final source 6/6 passed (plus 6/6 on the pre-review revision)
  • .\scripts\validate-test-timing-patterns.ps1: passed (baseline 31 to 30 for this file).
  • ./build.ps1: all builds succeeded.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 5864 passed, 0 failed, 29 skipped.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 6501 passed, 0 failed.
  • Rebased onto main 1af3ced2d. Upstream did not change the test file, only other baseline entries. The guard passed after the rebase.

Real Behavior Proof

  • Environment tested: local Windows x64 desktop, 175% DPI, isolated profiles.
  • PR head or commit tested: 041669e (test source identical to the validated pre-rebase tree).
  • Exact steps or command run: dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-x64 -p:DevBuild=false --no-build --filter "FullyQualifiedName~DashboardsRenderNativeReportsTabsAndFailureStates" with OPENCLAW_RUN_GATEWAY_FIXTURE_UI=1.
  • Evidence after fix: the pass counts above.
  • Observed result: the empty dashboard state, detail text and selected pinned row are verified together before the screenshot.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A (local artifacts only).
  • Not verified or blocked:
    • The first-attempt CI result for this PR is pending.
    • Other one-shot lookups in this test have the same wait-then-read pattern but no known CI failures. They are left for follow-up to keep this change small: GalleryHeaderMatches() checks at about lines 1327 and 1341, pinned-row and customize lookups at about 1239 and 1252-1254, the copy-menu item at about 1313, and the pin toggle state at about 1333-1335.

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.

…t is read once after a re-render

DashboardsRenderNativeReportsTabsAndFailureStates waited for the empty board's
Open chat action and the re-pinned row, then looked up DashboardEmptyDetail once.
On CI the board's UIA elements were republished between those steps, the lookup
returned null and the test threw a NullReferenceException, although the board
was rendered correctly.

The last wait before the assertion and screenshot now requires the selected
pinned row, the on-screen action and the detail text together, and reads the
text inside that wait. The exact-text assertion is unchanged.

Co-authored-by: Copilot App <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 13, 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 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR captures the empty dashboard detail text inside the final UI Automation readiness wait and tightens the timing-pattern baseline.

Example: The Dashboards fixture test opens an empty board after unpinning and re-pinning Dashboards.

  • Before: A temporarily missing DashboardEmptyDetail element can cause NullReferenceException after the other readiness checks pass.
  • After: The test waits for the selected pin, visible Open chat action, and captured detail text before asserting the same expected message.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct test repair with reported local passes and partial CI confirmation; deterministic failure reproduction and completed focused CI are not yet available.
Proof confidence 🦐 gold shrimp (3/6) No shipped behavior changes, so separate product proof is unnecessary; reported native fixture passes support validation but were not independently replayed.
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 a false dashboard fixture failure when the detail element is temporarily unavailable to UI Automation.
Reason: The narrow synchronization repair follows repository policy, preserves coverage, and has direction established by its collaborator author.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a focused, maintainer-authored test repair that current main still needs; no introduced correctness or security defect was found.

Priority: P3
Reviewed head: 041669e3d1844f9bf550047de2d5417f8c347baa

Before merge

None.

Findings

None.

Agent review details

How this fits together

The native UI fixture drives Companion against a synthetic Gateway and reads its UI Automation tree to validate dashboard rendering.

flowchart LR
  A[Fixture test] --> B[Synthetic Gateway]
  B --> C[Companion Dashboards]
  C --> D[UI Automation tree]
  D --> E[Combined readiness wait]
  E --> F[Exact assertion and capture]
Loading

Technical review

Best possible solution:

Keep the combined readiness wait and captured detail value in the existing fixture test, preserving every assertion and the tighter baseline.

Do we have a high-confidence way to reproduce the issue?

Current main visibly dereferences a nullable detail lookup after unrelated waits, but the reported rare UI Automation gap has no deterministic reproduction and was not reproduced during this review.

Is this the best way to solve the issue?

This is the smallest complete repair: reuse the existing readiness helper, capture the observed value, preserve the independent expected text, and lower the ratchet.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6d968b68a6d7.

Provenance checked

  • Empty-dashboard assertion and final readiness check keeps the original intent (e59374c: The native Dashboards feature introduced the empty-state content assertion; the patch preserves its expected value and screenshot ordering.)
  • Selected re-pinned row readiness keeps the original intent (3cc7280: The earlier repair replaced a one-shot lookup of the recreated pin with a selected-state wait; that requirement remains in the combined predicate.)
  • Timing-pattern baseline keeps the original intent (3cc7280: The previous repair lowered the one-shot lookup count to 31; removing one further occurrence correctly tightens it to 30.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

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.

Labels

Label changes:

  • add P3: This repairs an intermittent false test failure without changing product behavior.
  • 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:

  • P3: This repairs an intermittent false test failure without changing product behavior.
  • 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 13, 2026, 5:06 PM ET / 22:06 UTC.

@bkudiess
bkudiess merged commit 8b7a8be into openclaw:main Nov 13, 2026
37 checks passed
bkudiess added a commit to bkudiess/openclaw-windows-node that referenced this pull request Nov 14, 2026
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 added a commit that referenced this pull request Nov 14, 2026
…ion element is briefly missing after a re-render or resize (#2222)

* test(dashboards): wait for UIA peers instead of one-shot reads

GatewayFixtureNativeDashboardsUiTests.cs produced repeated CI flakes from
one-shot FindById(...)! reads after a re-render or resize (#2171, #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]>

* test(dashboards): give the widget pixel wait a named budget and report 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]>

---------

Co-authored-by: Copilot App <[email protected]>
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