Repository navigation
fix(test): fixture UI failures are misattributed to failure containment - #2169
Conversation
…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]>
|
🦞👀 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 changesThis 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.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Regression provenancePossible 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: unit tests only. 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. 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, 8:56 AM ET / 13:56 UTC. |
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
mainrun 43430233130 failedGatewayFixtureUiTests.DashboardsRenderNativeReportsTabsAndFailureStateswith aNullReferenceExceptionwhose stack includedGatewayFixtureUiFailure.ObserveAsyncandFinishAsync. The artifacts show:GatewayFixtureNativeDashboardsUiTests.cs:1343, a one-shot UI Automation lookup of the pinned Dashboards item).failure.pngwas captured from its live window with Dashboards visibly pinned and selected.failure-lifecycle.jsonlists 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, beforeFinishAsyncrethrows the original.ObserveAsyncnow awaits withConfigureAwaitOptions.SuppressThrowingand readsExceptionto 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
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 noObserveAsyncframe, and the receipt recordscapture:error:InvalidOperationExceptionanddispose:completed.ObserveAsync:Assert.DoesNotContain() Failure: Sub-string found.net10.0supportsConfigureAwaitOptions. Noted limit (pre-existing, no current caller does this): if a capture or stop delegate rethrew the original object itself,ObservePhaseAsynccould still extend its stack.Change Type
Scope
winnodeRequired 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
49a9747aplus this exact change (committed as058c4434):./build.ps1: passed (after removing one corruptobj\...\ref\OpenClaw.Chat.dllintermediate 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
058c4434a5c60520ae5b52570e8562639f3c94bd.dotnet test ./tests/OpenClaw.Tray.IntegrationTests/OpenClaw.Tray.IntegrationTests.csproj --filter FullyQualifiedName~GatewayFixtureRunTests.GatewayFixtureUiFailure.ObserveAsyncandFinishAsyncframes after the test's own frame.Yes/No/N/A): N/ASecurity 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