Skip to content

test(dashboards): widget boundary timeouts do not say whether WebView2 or the ticket fetch stalled - #2177

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-widget-ticket-flake
Nov 13, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-widget-ticket-flake

Conversation

@bkudiess

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: when a native widget boundary test times out, the failure does not say what the widget reached.

DashboardWidgetCellTests.RejectedTicket_NeverRendersBeforeAnAuthorizedReplacement(revoked: True) failed on main ec49620b (job 131969808060) after 38.9 s with only "Native widget HTTP/relay boundary did not settle." The widget log is not part of the CI artifacts, so the cause cannot be determined from that run.

This PR makes the next occurrence identify its own cause. It does not claim to prevent the flake. See "Not verified".

User Impact

User impact: none. Test diagnostics, plus richer detail in one existing warning log line.

Why This Change Was Made

The test waits for Unauthorized after a revoked ticket. BoardWidgetWebHost.StartAsync starts the HTTP document fetch and then awaits WebView2 initialization. If initialization throws, the host reports a terminal Failed, tears down, and cancels the in-flight fetch. Unauthorized is then never reported, and the wait times out.

Evidence for that path:

  • CI's exact failure point reproduced: I temporarily injected an immediate WebView2 initialization failure. Both cases then time out at the first wait, with States=[Loading, Failed: Widget content needs the Microsoft Edge WebView2 Runtime.] and DocumentRequests 0 or 1.
  • Consistent with the CI run: the failing case was the first widget WebView in that test process. The next case passed in 6.7 s, which is consistent with a failed environment creation being retried (BoardWebViewEnvironment does not cache a faulted task).
  • Ruled out: cold start delaying delivery. A local timing trace shows Unauthorized arrives 60 ms after Loading warm, and 110–150 ms cold under heavy CPU load (6 busy processes, 2-core affinity).
  • Separate, local-only issue: under that load, one run failed at the later Ready wait because WebView2's cold start exceeded the 30 s budget. That is a different wait and not CI's failure.

Other paths that could drop or delay Unauthorized are not excluded: an Unloaded during mount, or an HTTP or thread-pool stall. The new output distinguishes them.

Changes:

  • WaitForWebHostAsync timeouts now report each mounted host's status and detail, an optional per-test summary, and the last five [Dashboards] log lines.
  • RejectedTicket_* records its full state history, with details, and the document request count.
  • BoardWidgetWebHost now logs the exception type and HRESULT when WebView2 initialization fails (previously only ex.Message), so the next CI failure names the actual error.
  • No assertion, readiness condition or deadline changed.

Evidence

Injected-failure output with this change:

Native widget HTTP/relay boundary did not settle within 00:00:05. Hosts=[Failed: Widget content needs the Microsoft Edge WebView2 Runtime.]; States=[Loading, Failed: Widget content needs the Microsoft Edge WebView2 Runtime.]; DocumentRequests=1; RecentLog=[... [Dashboards] widget WebView2 initialization failed: COMException 0x8007139F: TEMP injected]

(The injection and the 5 s loader timeout were temporary and are not committed.)

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 diagnostics plus one log-line detail. CI's UI job runs these tests. No custom pool applies.

Validation

Tested on base 3cc72800 with the final tree (commit 81de322f; the tested tree is identical). main is now fbc02870, with no changes to these files.

  • dotnet test tests/OpenClaw.Tray.UITests --no-build --filter "FullyQualifiedName~DashboardWidgetCellTests.RejectedTicket_NeverRendersBeforeAnAuthorizedReplacement": 5 consecutive passes (2/2 each).
  • dotnet test tests/OpenClaw.Tray.UITests --no-build --filter "FullyQualifiedName~DashboardWidgetCellTests": 119 passed, 0 failed (before the log-line change, which does not touch the test path).
  • .\scripts\validate-test-timing-patterns.ps1: passed.
  • ./build.ps1: all builds succeeded.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 6,444 passed, 0 failed.
  • Isolation: native runs used isolated OPENCLAW_TRAY_* roots under the shared desktop lock. The real OpenClawTray profile manifests were unchanged.
  • Review: Hanselman dual-model review (Claude Opus 5.5 and GPT-6 Astra long-context; high reasoning). No CRITICAL or HIGH findings.
    • Fixed: the MEDIUM finding from Opus, also raised by Astra as LOW: log the exception type and HRESULT so CI can confirm the cause.
    • Both reviewers agree the WebView2-initialization explanation is plausible but unconfirmed, and that a product retry should wait for the CI-reported HRESULT.

Real Behavior Proof

  • Environment tested: Windows 11 dev box, in-process native WinUI UI tests, Debug win-x64.
  • PR head or commit tested: 81de322f.
  • Exact steps or command run: see Validation, plus the temporary WebView2-failure injection.
  • Evidence after fix: the injected failure produces the diagnostic output above.
  • Observed result: as above.
  • Screenshot or artifact links verified? (Yes/No/N/A) N/A
  • Not verified or blocked:
    • The CI root cause is not confirmed and this PR does not prevent the flake.
    • If the WebView2 path is confirmed, a possible product follow-up is one bounded retry of WebView2 initialization plus accurate error text. Today a transient failure is terminal and shows "needs the Microsoft Edge WebView2 Runtime".
    • The CI first-attempt result is pending.

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:

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:

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.

…2 or the ticket fetch stalled

RejectedTicket_NeverRendersBeforeAnAuthorizedReplacement(revoked: True) timed out on CI waiting for Unauthorized with no further detail. Injecting an immediate WebView2 initialization failure reproduces that exact failure: the host reports Failed and tears down, cancelling the ticket fetch, so Unauthorized never arrives. The widget boundary wait now reports every mounted host's status, the test's full state history and document request count, and the recent [Dashboards] log lines; the WebView2 initialization log line now includes the exception type and HRESULT. No assertion or deadline changes.

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 adds widget state, request counts, recent logs, and WebView2 exception details to native test failure diagnostics.

Example: WebView2 initialization throws COMException 0x8007139F during the revoked-ticket test.

  • Before: The test reports only that the native widget HTTP/relay boundary did not settle.
  • After: The timeout includes Failed state, state history, DocumentRequests=1, and the exception type and HRESULT.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct diagnostic improvement supported by native harness output and reported repeated passes; hosted native checks remain in progress.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored diagnostic change has no new user-facing behavior; supplied Windows native harness output exercises the enriched failure path at the reviewed tree.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Maintenance · Worth it: Yes · Fix scope: Complete
User problem: Contributors cannot distinguish widget initialization failure from an HTTP or lifecycle stall when the native boundary test times out.
Reason: The maintainer-authored change supplies actionable context for a recorded failure without speculative retries or weaker assertions.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it provides useful, narrowly scoped diagnostics absent from main, preserves test behavior, and has no actionable findings.

Priority: P3
Reviewed head: 81de322f186917151b12e435ecd45448f150a145

Before merge

None.

Findings

None.

Agent review details

How this fits together

BoardWidgetWebHost fetches ticketed widget documents and initializes an isolated WebView2; mounted native tests observe its state and HTTP boundary.

flowchart LR
  A[Native widget test] --> B[BoardWidgetWebHost]
  B --> C[Ticketed document fetch]
  B --> D[WebView2 initialization]
  B --> E[State callbacks and warning log]
  E --> F[Timeout diagnostics]
Loading

Technical review

Best possible solution:

Retain the focused diagnostics and use a future failure trace to determine whether a product repair is needed.

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

Source confirms that main emits a generic boundary timeout; the supplied injected-failure output demonstrates the diagnostic gap, while the original CI flake mechanism remains unconfirmed.

Is this the best way to solve the issue?

The defect is insufficient timeout context; the invariant is unchanged pass/fail behavior and timing; the smallest complete fix enriches the existing wait helper and initialization warning, as this diff does.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 90653249bd8a.

Provenance checked

  • WebView2 initialization warning keeps the original intent (e59374c: The native Dashboards reader logs initialization failures and leaves a terminal state until Retry.)
  • Mounted widget boundary waits and state observations keeps the original intent (e59374c: The original tests protect HTTP ticket rejection, authorized replacement, and native rendering boundaries.)

Testing

Proof path: in-process harness.

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.

Review metrics

Metric Value Why it matters
Change size Production +1/-1; tests +36/-5 Growth is limited to failure diagnostics in existing owners, with no new test cases or production machinery.

Labels

Label changes:

  • add P3: Improves contributor diagnostics without changing end-user behavior or preventing the underlying intermittent failure.
  • 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: Improves contributor diagnostics without changing end-user behavior or preventing the underlying intermittent failure.
  • 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, 1:45 PM ET / 18:45 UTC.

@bkudiess
bkudiess merged commit e33f70d into openclaw:main Nov 13, 2026
35 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