Skip to content

test: stabilize flaky UI-job and SetupEngine CI failures - #1981

Merged
larroy merged 6 commits into
openclaw:mainfrom
larroy:fix/ci-ui-flakes
Nov 4, 2026
Merged

larroy merged 6 commits into
openclaw:mainfrom
larroy:fix/ci-ui-flakes

Conversation

@larroy

@larroy larroy commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: intermittent Build and Test CI failures in the Tray UI and SetupEngine suites when runner load or window-creation timing races make assertions and waits fail spuriously.

User Impact

User impact: no user-visible product change; CI runs on main stop failing on timing-sensitive UI-job and SetupEngine flake modes, so real regressions become visible instead of drowning in retries.

Why This Change Was Made

The flake modes share a small set of causes: a testhost PerMonitorV2 DPI context that launched-app collections can poison before UIThreadFixture initializes, single-shot asserts on transient re-renders, and unbounded native operations that a busy hosted runner cannot finish in the old budget. The change serializes the UI test assembly, polls transient state instead of asserting it once, waits for Gateway request quiescence before request-count asserts, and raises two genuinely insufficient timeouts (handoff settle 45 s, GatewayPackageCleanup worker 120 s). The SVG decode bound stays at SvgRenderTimeout + 2 s. A2UISvgTests.PathologicalGeometry_BoundedByRenderTimeout flakes because SvgImageSource.SetSourceAsync sometimes blocks the UI thread past the 8 s cap (the cap fires on time, the load returns about 6 s late). That is a product defect, so the test stays strict and the finding is recorded in docs/CI_FAILURES.md. A new test, Load_QueuedBehindBusyDecodeSlots_CompletesOnceASlotFrees, covers queue wait plus decode. No retries, masking, or weakened assertions were added; strict waits were replaced by bounded condition polling. Timeline-scroll coverage keeps main's exact single end-scroll followed by passive visibility polling, so the #1549 clipping regression stays covered. docs/CI_FAILURES.md records the proven-unresolved modes, including the hosted-runner fixture window-creation hang and the wizard __more button race, which remain open product investigations.

Evidence

  • Focused runs of the touched suites before and after the change on this workstation; strict single-shot waits that flaked locally under load now pass repeatedly with polling waits.
  • docs/CI_FAILURES.md updated: fixed modes removed from the backlog, remaining modes attributed with run links and next steps.
  • Hosted CI: Build and Test run 41803498631 on head 0314a946: the UI, functional, and accessibility tests job aborted when the Tray UI testhost crashed during ReactorChatLayoutProofTests.ReasoningPicker_PreservesCurrentValueWithoutInventingSupportedOptions (last marker chat-proof: body start, no teardown; 241 UI tests had passed). That is the open ReasoningPicker testhost-crash mode in docs/CI_FAILURES.md, also seen on main (run 41716238427), and it is unrelated to the files changed in 0314a946. The earlier head 32653620 was green in run 41721151363; an even earlier revision left a static-method logging block in GatewayFixtureUiTests that broke the UI job's compile, which 32653620 repaired.
  • PathologicalGeometry_BoundedByRenderTimeout can still fail on hosted runners for the product reason above, as it already does on main (run 41737007496).

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-infrastructure and docs change only; no product behavior, installer, node, or native runtime contract is touched, so no capacity-dependent custom Windows proof applies.

Validation

  • ./build.ps1: pass.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: pass.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: pass.
  • Focused: repeated runs of the touched UI-test classes and GatewayPackageCleanupTests on this ARM64 workstation; previously flaky local modes pass consistently.

Real Behavior Proof

  • Environment tested: local x64 Windows workstation, isolated task worktree.
  • PR head or commit tested: 0314a946 (review fixes: strict IsLoaded for the wizard More button, SvgRenderTimeout + 2 s single-decode bound, new queued-load test, SVG attribution in docs/CI_FAILURES.md). ./build.ps1 passes; Shared 4810 passed (24 skipped); Tray 4788 passed; A2UISvgTests 15/15 and NativeFallback_GatewayMoreRejectsAnOverlappingContinue pass locally (PathologicalGeometry alone passes at about 8 s).
  • Exact steps or command run: ./build.ps1; dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj (4810 passed, 24 skipped); dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj (4788 passed); dotnet build tests/OpenClaw.Tray.UITests/OpenClaw.Tray.UITests.csproj -p:Platform=x64 (0 errors); hosted Build and Test run 41721151363 was green on the earlier head 32653620; run 41803498631 on 0314a946 hit the documented ReasoningPicker testhost crash (see Evidence).
  • Evidence after fix: local required suites green (Shared 4810/4834 passed, Tray 4788/4788 passed); the hosted UI job compiles the UI test assembly and passed 241 UI tests on 0314a946 before the unrelated testhost crash.
  • Observed result: the timing-dependent failures this PR targets are resolved, except the open modes listed in docs/CI_FAILURES.md. For the SVG one, a throwaway UI-dispatcher heartbeat attributes to the UI thread being blocked past the cap: SVG decode timed out logged at 8.07 s, a dispatcher callback queued at 0.1 s serviced only at about 14 s, reproduced in 3 of 5 local runs. Unresolved modes are documented in docs/CI_FAILURES.md.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A (no UI change).
  • Not verified or blocked: the fixture window-creation hang, the wizard __more race, the ReasoningPicker testhost crash, and the SVG SetSourceAsync UI-thread blocking remain open product investigations (see docs/CI_FAILURES.md).

Security Impact

  • New permissions or capabilities? (No)
  • Secrets or tokens handling changed? (No)
  • New or changed network calls? (Yes) UI tests now wait for Gateway fixture request quiescence and bind test listeners to loopback within the existing fixture; no new endpoints, protocols, or data scopes.
  • Command or tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any answer is Yes, explain the risk and mitigation: no new network surface; waits observe the existing loopback fixture only.

Compatibility and Migration

  • Backward compatible? (Yes)
  • Config or environment changes? (No)
  • Migration needed? (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 2, 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.

@larroy
larroy requested a review from karkarl November 2, 2026 23:13
@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. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 2, 2026
@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR stabilizes Windows test synchronization, initializes testhost DPI earlier, adjusts test timeout budgets, and documents unresolved CI failures.

Example: An off-screen WinUI control becomes ready without another composition frame.

  • Before: The readiness helper can time out despite the predicate becoming true.
  • After: A dispatcher timer checks the same predicate every 50 milliseconds within the bounded wait.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source review found no blocker; CI supports validation, while intermittent-flake elimination remains less strongly demonstrated.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored test-infrastructure PR is outside the ordinary contributor runtime-proof gate; exact-head hosted jobs passed, and the author reports local ARM64 validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Developers encounter intermittent CI failures that obscure real regressions.
Reason: The collaborator-authored direction is authorized and provides useful test reliability repairs; added environment overrides configure test budgets rather than shipped user preferences.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open for landing: all three prior findings are addressed, exact-head CI passes, and no actionable introduced defect was found.

Priority: P2
Reviewed head: 32653620c42eb3cfd277b0d56d2c973d879e01f8

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Controlled before-and-after execution for each timing mechanism is not supplied in inspectable output; exact-head hosted job results establish successful validation without proving every intermittent failure eliminated.
Agent review details

How this fits together

The Windows test infrastructure drives mounted WinUI controls, launched Companion instances, loopback Gateway fixtures, and PowerShell cleanup harnesses, producing assertions and CI results.

flowchart LR
  A[Windows CI] --> B[Testhost initialization]
  B --> C[WinUI fixture]
  C --> D[Mounted controls]
  A --> E[Companion application tests]
  E --> F[Loopback Gateway fixture]
  A --> G[PowerShell cleanup harness]
  D --> H[Test results]
  F --> H
  G --> H
Loading

Technical review

Best possible solution:

Land the focused test-infrastructure repairs while retaining strict assertions and tracking the documented product failures separately.

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

Source inspection supports the reported timing mechanisms, but intermittent failures were not reproduced during this read-only review.

Is this the best way to solve the issue?

The patch uses existing fixture and helper owners to wait for observable conditions, preserves negative request assertions and clipping coverage, and avoids production changes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 12789b405719.

Provenance checked

  • WinUI readiness polling keeps the original intent (3eed1f1: Onboarding tests wait for actual framework readiness; fix(tests): wait for onboarding cards before invocation #1646 (fix(tests): wait for onboarding cards before invocation) subsequently strengthened strict card readiness and diagnostics.)
  • Testhost DPI and fixture lifetime keeps the original intent (3eed1f1: Native onboarding proof establishes product-equivalent DPI; Fix Tray UI test window hiding for release #897 (Fix Tray UI test window hiding for release) preserves an attached compositor tree using an off-screen window.)
  • Gateway request-count assertions keeps the original intent (d318127: Verified onboarding readiness must not trigger unintended Gateway work; the patch retains that invariant after existing delayed handshake traffic settles.)
  • Flyout transitions and teardown keeps the original intent (3eed1f1: Native chat proof waits for flyout transitions; the change reuses that seam and closes remaining popups before disposing their owners.)
  • SVG decode duration assertions changes intended behavior with a stated reason (9fa43f3: Malicious SVG tests require bounded decoding; the revised test budget reflects the current independent queue and decode limits while retaining the duration assertion.)
  • Cleanup worker harness keeps the original intent (62752f4: Cleanup tests preserve receipt validation and replacement protection; only the test process deadline changes.)
  • Shared-window draft retention keeps the original intent (4e31031: Settings navigation must preserve the same composer and draft; bounded polling retains both identity and exact draft assertions without repairing or hiding permanent loss.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Pedro Larroy: Raw commit 9ab23fc adds docs/CI_FAILURES.md:3 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9ab23fcd2d46; files: docs/CI_FAILURES.md)
  • Scott Hanselman: Raw commit 2e5e219 adds tests/OpenClaw.Tray.UITests/TestSupport.cs:78 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2e5e219ade50; files: tests/OpenClaw.Tray.UITests/TestSupport.cs)
  • Joel: Raw commit 62752f4 adds tests/OpenClaw.SetupEngine.Tests/GatewayPackageCleanupTests.cs:11 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 62752f44cda2; files: tests/OpenClaw.SetupEngine.Tests/GatewayPackageCleanupTests.cs)

Review metrics

Metric Value Why it matters
Change scope Production +0/-0; tests +203/-33; documentation +40/-0 Growth stays within existing test owners and supplies bounded synchronization, lifecycle cleanup, and failure attribution.

Labels

Label changes:

  • 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.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Intermittent test failures reduce CI reliability, with no production behavior change or demonstrated urgent user regression.
  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-02T23:24:07.899Z sha ee10fef :: needs changes before merge. :: [P2] Preserve the single-scroll clipping regression | [P3] Correct the reasoning-picker failure citation | [P3] Correct the attribution of existing startup diagnostics

Reviewed November 3, 2026, 6:52 PM ET / 23:52 UTC (Revision 2).

- Serialize the UITests assembly and lock the testhost PerMonitorV2 DPI
  context at assembly load so launched-app collections cannot poison it
  before the UIThreadFixture initializes (mode A).
- Re-issue the chat timeline end-scroll while waiting for message 240
  instead of one scroll followed by a passive 20 s wait (mode B).
- Poll the retained composer draft instead of asserting it once, tolerate
  the handoff receipt temp-file/move race, and raise the handoff settle
  budget to 45 s (modes C, C2).
- Re-check WaitForRenderedConditionAsync on a dispatcher timer so off-screen
  windows and dynamically inserted children settle, accept XamlRoot as
  in-tree for the wizard More button, wait for Gateway request quiescence
  before request-count asserts, bound SVG decode with the real
  queue-wait-plus-decode product bound, and invoke SettingsBack only when
  it is enabled (modes D, G1-G4).
- Close composer flyouts by awaiting real closure, close stray popups
  before Reactor teardown, and mark teardown phases in the console
  (modes E, F1); bracket the dispose finalizer drain (mode F2).
- Raise the GatewayPackageCleanup worker timeout to 120 s (mode H).
- Record proven unresolved modes in docs/CI_FAILURES.md.
…citations

The static ScrollToAsync refactor kept the old instance-method logging
block, so GatewayFixtureUiTests did not compile (CS0103 scroll/before,
CS9105 output in static context) and the UI job failed all three steps.

Restore main's ScrollToAsync verbatim, with its scroll diagnostics, and
the one end-scroll followed by passive visibility polling in the
resize test, so the clipping regression from openclaw#1549 stays covered.

Also correct two CI_FAILURES.md review findings: run 41532119336 is a
fork run about hosted fixture startup, not the local pristine
reasoning-picker crash, and the 90 s fail-fast wait, phase-bearing
message, and bootstrap/window-creation markers are existing fixture
diagnostics, not new in this change.
@larroy

larroy commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@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. 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 rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 3, 2026
@clawsweeper clawsweeper Bot 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 3, 2026
- Keep IsLoaded as the wizard More-button readiness check. The poll timer
  already covers the no-frame case, and a bare XamlRoot check let the
  automation peer invoke a button a user could not yet click.
- Restore the single-decode SVG bound to SvgRenderTimeout + 2 s. The
  single-load tests arrange no queue contention, so the doubled
  queue-plus-decode budget only hid a real overshoot: the decode cap fires
  on time but SvgImageSource.SetSourceAsync blocks the UI thread past it.
  Assert the decode slots are idle before timing and include timestamped
  resolver warnings in the failure message.
- Add Load_QueuedBehindBusyDecodeSlots_CompletesOnceASlotFrees to cover
  queue wait plus decode deterministically.
- Record the UI-thread blocking attribution in docs/CI_FAILURES.md.
@larroy
larroy requested a review from shanselman November 4, 2026 17:12
@larroy
larroy merged commit b6c849e into openclaw:main Nov 4, 2026
45 of 47 checks passed
@larroy
larroy deleted the fix/ci-ui-flakes branch November 4, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. 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.

2 participants