Skip to content

fix(test): fixture UI failures are misattributed to failure containment - #2169

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-fixture-failure-stack
Nov 13, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-fixture-failure-stack

Conversation

@bkudiess

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: Gateway fixture UI test failures are reported with failure-containment frames (GatewayFixtureUiFailure.ObserveAsync/FinishAsync) in their stack, so a test's own assertion looks like a crash in the fixture host.

User Impact

No product change. A failing fixture UI test now reports its original exception with the stack it was thrown with, so triage starts at the real failing line instead of the containment code.

Why This Change Was Made

main run 43430233130 failed GatewayFixtureUiTests.DashboardsRenderNativeReportsTabsAndFailureStates with a NullReferenceException whose stack included GatewayFixtureUiFailure.ObserveAsync and FinishAsync. The artifacts show:

  • The exception was thrown by the test body (GatewayFixtureNativeDashboardsUiTests.cs:1343, a one-shot UI Automation lookup of the pinned Dashboards item).
  • The app was alive: it answered MCP calls, and failure.png was captured from its live window with Dashboards visibly pinned and selected.
  • Containment worked: failure-lifecycle.json lists every stage as completed and records the original exception without containment frames.

The extra frames came from ObserveAsync(body). Re-awaiting a faulted task rethrows the same exception object and appends the awaiting frames to its stack, before FinishAsync rethrows the original. ObserveAsync now awaits with ConfigureAwaitOptions.SuppressThrowing and reads Exception to mark it observed, so it never rethrows and the original keeps its thrown stack. Containment order, phase deadlines and the drain/dispose checks are unchanged.

Out of scope: the underlying lookup race at line 1343 belongs to the pinned NavigationViewItem work in another change (microsoft/microsoft-ui-xaml#10757 / KeyedMenuRows); this PR does not touch product code or GatewayFixtureUiTests.

Evidence

  • New regression test GatewayFixtureRunTests.AppExitedBeforeCapture_RethrowsOriginalWithItsThrownStackAndRecordsCaptureError: the body faults with the original exception and capture fails as if the app had exited. It asserts the same exception object is rethrown, its stack starts with the stack it was thrown with and contains no ObserveAsync frame, and the receipt records capture:error:InvalidOperationException and dispose:completed.
    • RED with the previous ObserveAsync: Assert.DoesNotContain() Failure: Sub-string found.
    • GREEN with this change.
  • Hanselman dual-model review (Claude Opus 5.5 and GPT-6 Astra, high effort): no findings at any severity. Both confirmed faulted and canceled workers are still observed without throwing, timing and drain semantics are unchanged, and net10.0 supports ConfigureAwaitOptions. Noted limit (pre-existing, no current caller does this): if a capture or stop delegate rethrew the original object itself, ObservePhaseAsync could still extend its stack.

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 change in the fixture host's failure containment; covered by the regression test and the hosted fixture UI shards.

Validation

Run locally on 49a9747a plus this exact change (committed as 058c4434):

  • ./build.ps1: passed (after removing one corrupt obj\...\ref\OpenClaw.Chat.dll intermediate in the local worktree; unrelated to this change).
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 5862 passed, 0 failed, 29 skipped.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 6441 passed, 0 failed.
  • dotnet test ./tests/OpenClaw.Tray.IntegrationTests/OpenClaw.Tray.IntegrationTests.csproj --filter FullyQualifiedName~GatewayFixtureRunTests: 26 passed, 0 failed.
  • ./scripts/validate-test-timing-patterns.ps1: passed. git diff --check: clean.

Real Behavior Proof

  • Environment tested: local Windows dev host (managed tests); hosted fixture UI shards for runtime coverage.
  • PR head or commit tested: 058c4434a5c60520ae5b52570e8562639f3c94bd.
  • Exact steps or command run: dotnet test ./tests/OpenClaw.Tray.IntegrationTests/OpenClaw.Tray.IntegrationTests.csproj --filter FullyQualifiedName~GatewayFixtureRunTests.
  • Evidence after fix: 26 passed, including the new regression test; RED/GREEN recorded above.
  • Observed result: before the fix, run 43430233130's test result stack included GatewayFixtureUiFailure.ObserveAsync and FinishAsync frames after the test's own frame.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A
  • Not verified or blocked: a real fixture UI failure on the PR head was not reproduced; the hosted shards only show that passing runs are unaffected.

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.

…re-observing the test body rewrites its stack

Main run 43430233130 reported a NullReferenceException in
GatewayFixtureUiTests.DashboardsRenderNativeReportsTabsAndFailureStates with
GatewayFixtureUiFailure.ObserveAsync and FinishAsync frames, so failure
containment looked like the source. The exception came from the test body
(a one-shot UI Automation lookup); the app was alive and every containment
stage completed. ObserveAsync re-awaited the faulted body, which rethrows the
same exception object and appends containment frames to its stack before
FinishAsync rethrows the original.

Observe workers with ConfigureAwaitOptions.SuppressThrowing and mark the
exception observed, so the original failure keeps the stack it was thrown
with. A regression test simulates the app having exited before capture and
asserts the same exception is rethrown with its thrown stack and a recorded
capture error.

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 observes failed fixture workers without rethrowing their exceptions, preserving the original failure stack.

Example: A fixture test throws NullReferenceException and its failure capture also fails.

  • Before: Re-observing the test body adds ObserveAsync frames to the original exception.
  • After: The original exception retains its thrown stack, while capture failure and completed disposal remain recorded.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct infrastructure repair supported by a reported red/green regression and passing integration CI; changed-path evidence is unit-level.
Proof confidence 🦐 gold shrimp (3/6) This test-infrastructure correction has no shipped product behavior requiring entry-point proof; its focused regression exercises the actual failure owner.
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 investigating a failed fixture test see containment frames added to the original exception stack.
Reason: This maintainer-authored change repairs a concrete diagnostic defect with a minimal edit and a distinct regression, without expanding into the separate UI lookup failure.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR makes a useful, focused correction that current main still needs; no introduced correctness or security defect was found.

Priority: P3
Reviewed head: 058c4434a5c60520ae5b52570e8562639f3c94bd

Before merge

None.

Findings

None.

Agent review details

How this fits together

The fixture failure owner receives the original test exception and worker tasks, coordinates bounded cleanup, records lifecycle outcomes, and rethrows the original failure.

flowchart TD
A[Fixture UI test] --> B[Original exception and body task]
B --> C[Failure containment owner]
C --> D[Capture and owned cleanup]
C --> E[Observe workers without throwing]
D --> F[Lifecycle receipt]
E --> G[Rethrow original exception]
Loading

Technical review

Best possible solution:

Use the existing failure owner's nonthrowing task observation and retain the focused stack-preservation regression.

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

The source exposes the faulty re-await of the same exception, and the PR reports a targeted red/green regression; no reproduction was run during this read-only review.

Is this the best way to solve the issue?

The change directly removes the stack-mutating observation while preserving the existing containment owner, cleanup checks, and original exception propagation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 49a9747a4ea1.

Provenance checked

  • Fixture worker exception observation keeps the original intent (c370d8e: Contain failed native UI workers, retain the original assertion, and prevent disposal or fixture reuse while workers remain live.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Scott Hanselman: Raw commit 3e74082 adds tests/OpenClaw.Tray.IntegrationTests/GatewayFixtureRunTests.cs:30 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 3e740827aeb1; files: tests/OpenClaw.Tray.IntegrationTests/GatewayFixtureRunTests.cs)

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 improves internal test-failure diagnosis without changing product behavior or test outcomes.
  • 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 improves internal test-failure diagnosis without changing product behavior or test outcomes.
  • 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, 8:56 AM ET / 13:56 UTC.

@bkudiess
bkudiess merged commit 5e88242 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