Repository navigation
fix(tests): Automations fixture tests fail when an editor control's UI Automation element appears late - #2216
Conversation
Automations_DesignerAgendaBudgetAndResizeKeepExpansionAndDialogDraft threw a NullReferenceException on main b713f34 at Invoke(FindById("AutomationEditorSave")!) right after waiting for AutomationEditorName. The failure screenshot shows the editor open with its footer button rendered, so Reactor had published the Name peer before the footer Save peer was reachable through UIA. Sweep every one-shot FindById(...)! read in AutomationsUiTests.cs into bounded waits: invocations wait for the peer to be present and enabled and invoke once, reads wait for presence and keep the polled peer, and lambdas inside waits treat a missing peer as not ready. Assertions on state stay immediate after the wait. The one-shot lookup baseline for this file drops from 68 to 0. 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 replaces one-shot Automations UI Automation lookups with bounded readiness waits and lowers the timing-pattern baseline. Example: Automations_DesignerAgendaBudgetAndResizeKeepExpansionAndDialogDraft opens the new automation editor.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs a null-dereference path still present on main; no introduced correctness or security defect was found. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe fixture UI tests drive the real Windows app through UI Automation against a synthetic Gateway and turn rendered control state into assertions. flowchart LR
A[Fixture UI test] --> B[Bounded readiness wait]
B --> C[Windows UI Automation]
C --> D[Native Automations controls]
D --> E[State assertions]
Technical reviewBest possible solution: Use the existing fixture readiness owners to acquire each required control before use while preserving single invocations and independent state assertions. Do we have a high-confidence way to reproduce the issue? Source confirms that a missing Save peer after the Name-field wait reaches an unguarded invocation; the intermittent publication gap was not reproduced locally, as the author explicitly reports. Is this the best way to solve the issue? The change follows the existing readiness contract, retains each successful capture, and preserves invoke-once semantics without weakening the tested state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f1f167ad1816. 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:
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, 12:20 AM ET / 05:20 UTC. |
…ditor write runs before its control appears (#2225) * test(automations): wait for sibling peers before presence checks and edits Follow-up from the #2216 review. Presence checks and helper lookups that ran right after a wait on a different control could still miss a Reactor sibling whose UIA peer was not published yet. - 17 Assert.NotNull(Find*(...)) readiness checks now wait for the control. - ExpandAutomation and SetEditorValue become async: they wait for the expander or the enabled value peer, then act once. - The two retention checks (the loaded row after a refresh failure and after going offline) stay immediate reads, so a removed row still fails. Co-authored-by: Copilot App <[email protected]> * test(automations): wait for agenda rows before counting them Automations_LargeAgendaPagesBeyondBrowseAndJumpsToInlineRow failed on #2225's first attempt with "Assert.InRange() Failure: Range (1 - 6), Actual: 0": the agenda list peer was published before its row buttons and the test counted them once. - Wait until the list has at least one agenda row, and keep the 1-6 range assertion on the rows from that same poll. - The expanded-group wait now also requires the target item and captures it, instead of a later .First() read. - The offline "Schedule as of" text is a readiness check after waiting on another control, so it now waits for the text. Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Copilot App <[email protected]>
Related: #2193 (same one-shot lookup class in the Dashboards fixture test)
What Problem This Solves
Fixes: the Automations Mock Gateway fixture UI tests intermittently fail with
NullReferenceExceptionwhen the test reads an editor or row control that UI Automation has not published yet. Latest occurrence:Automations_DesignerAgendaBudgetAndResizeKeepExpansionAndDialogDraftonmainb713f345, run 43544397293, job 132292249802 (fixture UI shard B, 6 s in).Automations_DesignerValidationFocusAndDraftsStayIsolatedhad the sameNullReferenceExceptiononmainon 11-13.User Impact
User impact: there is no product change. Contributors stop seeing false Automations fixture failures.
Why This Change Was Made
The CI stack points at
AutomationsUiTests.cs:96,Invoke(FindById(run, "AutomationEditorSave")!). It runs right after a wait for the editor's Name field.The failure screenshot shows the New automation editor open, with its Create automation button rendered. So the app was fine. The Name field's UI Automation element was published before the footer button's element was reachable, and the single lookup caught that moment. Both are rendered by the same Reactor editor (
AutomationEditor.cs), so a wait on one does not guarantee the other.This file had 68 such one-shot lookups. All of them are now bounded waits:
State assertions are unchanged. They still read the value once, right after the wait. The error-toast persistence check stays a single immediate read on purpose, because it proves the toast is still there after a fixed time.
From review, the same race was also fixed on the failing tests' paths in three places the guard does not count: the editor values read right after a resize, the Discard draft presence check, and the navigation-pane toggle invoke.
The repository timing baseline entry for this file is removed: its one-shot lookup count drops from 68 to 0. The change adds no retries, sleeps, fixed settle counts, skips or weaker assertions.
Evidence
Assert.NotNull(FindById(...))presence checks, and the?? throwlookups insideExpandAutomationandSetEditorValue, are left for a follow-up to keep this PR scoped. No CI failures are known at those lines.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. Metadata for the real
%APPDATA%/%LOCALAPPDATA%\OpenClawTraywas unchanged after every run.Automations_DesignerAgendaBudgetAndResize…andAutomations_DesignerValidationFocus…Automations_ResponsiveShellWidthsHaveDistinctMeasuredFramesSessionHistoryRestoresSelectionTranscriptAndDraftAcrossAgents(other caller of the refactoredInvokeWhenEnabledAsync)Automations_HeroWashScrollsWhileTheBackplateStaysAnchoredmaind1316cc09("The wash did not follow the hero"). This is a local DPI issue, not caused by this change..\scripts\validate-test-timing-patterns.ps1: passed. TheAutomationsUiTests.csone-shot lookup entry is removed (68 to 0)../build.ps1: all builds succeeded.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: 6668 passed, 0 failed.maina7fd19432. That commit did not touch these test files, and the guard passed after the rebase.Real Behavior Proof
dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-x64 -p:DevBuild=false --no-build --filter "FullyQualifiedName~.Automations_"withOPENCLAW_RUN_GATEWAY_FIXTURE_UI=1, plus the repeated filters above.Yes/No/N/A): N/A (local artifacts only).Automations_PinnedHostToggleHitTabAndBanner(keyboard proof, in another file) also fails locally at 175% DPI onmain. It does not use any helper changed here.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