Repository navigation
fix(tests): Usage hero fixture check fails when a Usage element briefly leaves UI Automation after a resize - #2165
Conversation
…ly leaves UI Automation after a resize Read every peer the hero proof measures inside one wait that treats a missing, offscreen or replaced element as not ready, and require two identical layout samples before asserting and capturing. The previous poll dereferenced a one-shot UsagePageRoot lookup and failed with a NullReferenceException when the shell re-rendered after the resize or when the host-warning banner appeared. 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 changesThe PR waits for a complete, stable Usage hero layout before measuring and capturing it after a window resize. Example: The Light-theme fixture resizes to the 1400-DIP capture target and UsagePageRoot temporarily disappears from UI Automation.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this collaborator-authored PR fixes a concrete test-readiness failure still present on main, preserves the layout assertions, and introduces no identified correctness defect. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe native fixture test drives Companion against a synthetic Gateway, reads the Usage page through Windows UI Automation, and produces geometry assertions and capture artifacts. flowchart LR
A[Fixture Gateway] --> B[Companion Usage page]
C[Native fixture test] --> B
B --> D[UI Automation observations]
D --> E[Stable layout snapshot]
E --> F[Assertions and captures]
Technical reviewBest possible solution: Keep the repair in the existing fixture owner, retry transient UI Automation omissions, and assert the unchanged layout contract from the successful snapshot. Do we have a high-confidence way to reproduce the issue? The current-main source deterministically throws if the post-resize root lookup returns null, matching the reported injected-miss result; this review did not execute a reproduction. Is this the best way to solve the issue? This is a focused repair: the named snapshot helper handles a meaningful native observation boundary, separates geometry equality from marker identity, and preserves persistent-failure detection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ec6271566652. 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:
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 13, 2026, 7:06 AM ET / 12:06 UTC. |
What Problem This Solves
Fixes: the Usage hero fixture check (
UsageHero_RealShellCapturesCardAndRangeInLightAndDark) fails intermittently with aNullReferenceExceptionwhen a Usage element is briefly missing from UI Automation right after the test resizes the window.User Impact
No user-visible change. The Mock Gateway fixture shard B stops failing on this test when the shell re-renders after a resize.
Why This Change Was Made
After resizing the window to the capture width, the test waited for the page width to settle. It did so by reading
FindById(run, "UsagePageRoot")!inside arun.WaitForAsyncpoll, which does not catch errors from its condition. Then it read the page, hero, range controls, actions and page marker once each, outside the wait.FindByIdskips app windows that UI Automation reports as offscreen, and a lookup can miss an element while the shell re-renders. Both happen right after a resize across a responsive width tier, or when the asynchronous "Windows containment unavailable" banner appears; the banner was visible in the failing run's capture.NullReferenceExceptionon main aab86ee;Assert.False(IsOffscreen)inUsageRangeBounds.The test now reads every element it measures inside one wait (
TryReadUsageHeroLayout):ElementNotAvailableExceptionmeans "not ready yet", and the wait polls again.UsageRangeBounds, which another test uses, keeps its behavior.Earlier "Main Usage session header has no visible measured geometry" failures stopped after #2124 (fix(tests): Systems UI checks fail during native transitions) and are not part of this change.
Evidence
UsagePageRootlookup right after the resize fails with the CI signature,Usage-Light-hero-1400: System.NullReferenceException.TryReadUsageHeroLayout, passes. The injection was temporary and is not committed.Change Type
Scope
winnodeRequired proof pools
none: test-only change to a mock Gateway fixture UI test. CI runs it natively in the fixture shard B job.Validation
Local, head 1d15635 on main 378fd1a, isolated
OPENCLAW_TRAY_*profile. Native runs held the exclusive native-desktop lock, and the real%APPDATA%and%LOCALAPPDATA%\OpenClawTraymetadata manifests were unchanged afterwards.NullReferenceException(expected)scripts\test-gateway-fixture.ps1(full fixture suite, local)scripts\validate-test-timing-patterns.ps1./build.ps1dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csprojdotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csprojgit diff --checkHanselman dual review (Claude Opus 5.5 and GPT-6 Astra, high effort) found no blocking issues.
Real Behavior Proof
OPENCLAW_TRAY_*profile, fixture Gateway.dotnet test tests\OpenClaw.Tray.UITests -c Debug -r win-x64 -p:DevBuild=false --filter "FullyQualifiedName~GatewayFixtureUiTests.UsageHero_RealShellCapturesCardAndRangeInLightAndDark", with the fixture environment thatscripts\test-gateway-fixture.ps1sets.Failed ... Usage-Light-hero-1400: System.NullReferenceException.Passed! 1/1 (56 s).Passed! 1/1five times in a row.-NativeInputProofand-Screenshots, which CI passes.SettingsPane_KeepsToggleChoiceAcrossPinnedPagesAndRestart:ElementNotAvailableExceptionin the sharedInvokehelper. This is not in the CI flake inventory and is not changed here.Security Impact
Yes, explain the risk and mitigation: N/ACompatibility and Migration
Review Conversations