Repository navigation
fix: keep Gateway fixture cleanup safe after cancellation - #1784
Conversation
|
🦞👀 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 changes before merge. What this changesThis PR handles disposed-socket receive errors after fixture-owned cancellation and tests both cancellation branches. Example: FixturePeer disposal cancels its lifetime while a receive encounters ObjectDisposedException.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this focused fixture cleanup fix is absent from current main, and no introduced correctness defect was found. Priority: P3 Before merge
FindingsNone. Agent review detailsHow this fits togetherFixturePeer is a private Shared-test WebSocket client that authenticates against the loopback Gateway fixture and exposes responses, events, and reader completion to protocol tests. flowchart LR
A[Protocol test] --> B[FixturePeer]
B --> C[ClientWebSocket]
C --> D[Loopback Gateway fixture]
D --> E[Responses and chat events]
E --> B
A --> F[Owned cancellation and disposal]
F --> B
Technical reviewBest possible solution: Land the narrow cancellation-filtered repair with its real-socket regression once the author lifts the draft hold. Do we have a high-confidence way to reproduce the issue? Source shows an uncaught disposed-receive exception faulting cleanup; supplied real-socket evidence deterministically exercises that boundary, but does not establish a natural-race reproduction on unmodified main. Is this the best way to solve the issue? The filtered catch follows the existing cancellation policy, preserves unrelated failures, and uses the existing peer rather than introducing another cleanup owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 20fddaf66846. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
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 HistoryReviewed October 21, 2026, 6:05 PM ET / 22:05 UTC (Revision 3). |
Extract the independently reviewed reliability seam without the held native timeout consumer. No change to executor releases, package pins or sandbox enforcement.
f560ab3 to
74a3d88
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What Problem This Solves
Fixes: Gateway test cleanup can throw ObjectDisposedException after its own lifetime is cancelled.
User Impact
User impact: no product behavior change; cancellation-driven fixture cleanup no longer obscures the test result. This remains a draft while standalone current-head closeout and hosted results are inspected.
Why This Change Was Made
Guard only the disposed receive path caused by this fixture's own lifetime cancellation. Disposal errors before owned cancellation still propagate. The regression exercises the receive/disposal owner and real loopback authentication, including a replacement connection completing chat; only the external receive exception is injected.
Evidence
Current independent head:
23176db26448aa75c35a4c65989c5d5e5bcc17ac, based on main2b7cfce17bb496ec5d8f0c563fb71ebb46e015fa. Published SDK 1.0.0 pins are unchanged. This remains a test-fixture-only change, with no product policy, persistence or protocol change.Current-head CI has 7 successful checks, zero failed or pending checks at refresh. The earlier hosted review of parent74a3 is not credited as a review of this head.
The requested actual socket trace is now supplied inline below. The regression no longer constructs or throws a synthetic ObjectDisposedException. It authenticates using real loopback WebSockets, holds the receive boundary, disposes the actual ClientWebSocket and calls its real ReceiveAsync API. The framework produces ObjectDisposedException. Both cancellation ownership branches and replacement-client recovery execute against the actual fixture.
A controlled negative run withheld only the one-line owned-cancellation filter, leaving the same faithful socket scenario intact. Its owned branch failed with the actual framework exception; the unowned branch passed. Restoring the filter produced two passes. This is a one-line withheld-repair control, not a claim that an unmodified published-main checkout reproduced the race.
An earlier unconstrained natural-race trace ran three scenarios per current/base ref without observing a disposal exception; that benign result is retained and is not called a negative control. The held real-API boundary makes the relevant failure deterministic without manufacturing an exception object.
Change Type
Scope
winnodeRequired proof pools
none: this test-only fixture change is validated by deterministic loopback Shared tests; it does not change capacity-dependent product runtime behavior. Normal required build/Shared/private Tray closeout still applies.Validation
Final source was frozen before commit, full mandatory closeout passed and changed bytes were verified unchanged after committing:
.\build.ps1dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restoreExact focused command:
The post-commit run completed2026-10-21T21:56:19Z. Actual quiet/private desktop,
creator retention and original-native-handle completion receipts were checked.
The code does not hide external receive faults: the unowned branch asserts the
same real exception instance propagates through reader completion and disposal.
No real Gateway/provider, installed state, credentials or native sandbox was
used. Historical combined63a/291 results are not substituted for this current
standalone socket trace.
Real Behavior Proof
23176db26448aa75c35a4c65989c5d5e5bcc17acfor the final trace. Controlled red uses the proposed faithful regression with only the repair withheld; it is not labeled a published-main reproduction.Actual withheld-filter negative control:
The
Failed:line selects the actual failing TRX case; the exception lines andruntime observation are copied from that same invocation. No endpoint,
authentication token or user path is included.
N/Afor pixels. Inspectable genuine terminal output is inline rather than depending on raw CI-log download access. Raw TRX/native receipts remain retained locally.Security Impact
NoNoNoNoNoYes, explain the risk and mitigation: N/A. Loopback test authentication remains intact; unrelated disposal failures are not swallowed.Compatibility and Migration
YesNoNoReview Conversations
Current-head hosted review passed: Overall platinum hermit (4/6), Proof platinum hermit (4/6), Patch platinum hermit (4/6). No merge is authorized.