Repository navigation
fix: report refused Gateway connections as network failures - #2029
Conversation
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: ready, awaiting a maintainer decision. What this changesThe PR classifies typed transport exceptions before message text and shares that classification between handshake observations and connection-failure events. Example: A Gateway connection to ws://127.0.0.1:55001 is refused.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision Keep open: this maintainer-authored PR repairs a source-confirmed defect still present on main, with no introduced correctness bug identified; its overlapping work needs coordination with #2023. Priority: P2 Decision needed
Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared operator Gateway client receives WebSocket exceptions and emits typed categories consumed by connection recovery and native setup diagnostics. flowchart TD
A[WebSocket connection attempt] --> B[Transport exception chain]
B --> C[OpenClawGatewayClient classification]
C --> D[Handshake observations]
C --> E[Connection failure event]
D --> F[Native setup diagnostics]
E --> G[Gateway connection manager]
Technical reviewBest possible solution: Coordinate one landing path that retains typed exception precedence, consistent failure events, and the distinct shared-text parsing protection proposed by the overlapping PR. Do we have a high-confidence way to reproduce the issue? Main deterministically matches 500 inside port 55001 before reaching the inner SocketException; source inspection establishes the path, but this read-only review executed no reproduction. Is this the best way to solve the issue? The patch is a focused existing-owner repair: typed causes must outrank incidental message digits, and both failure events should agree; every changed hunk supports those invariants without new state or parallel recovery machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4aee38a1bfaa. Provenance checked
TestingProof path: in-process harness. 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. Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 5, 2026, 9:11 PM ET / November 6, 2026, 02:11 UTC. |
What Problem This Solves
Fixes: refused Gateway connections are reported as server, rate-limit, or authentication failures when the local port happens to contain matching digits.
User Impact
User impact: refused Gateway connections are now reported as network failures, while TLS and HTTP upgrade failures retain their correct categories.
Why This Change Was Made
Transport classification now checks typed causes before message text and uses the same exception-aware classification for handshake observations and connection-failure events.
Evidence
The loopback refused-socket regression verifies both handshake and connection-failure events report
Network. Deterministic exception-chain cases cover port-digit collisions, TLS socket resets, and HTTP status precedence. An independent rubber-duck review of the final diff found no actionable issues. The Windows interactive diagnostics proof pool was not run; see the proof limitation below.Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: the corrected error category can appear in diagnostics; current-head UI proof was not run.Validation
.\build.ps1- passed.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --filter 'FullyQualifiedName~GatewayHandshakeObservationTests|FullyQualifiedName~GatewayErrorClassifierTests'- 73 passed, 0 failed, 0 skipped.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore- 4,936 passed, 25 skipped, 0 failed.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore- 5,062 passed, 0 skipped, 0 failed.Real Behavior Proof
11443f9830a4d943547693c7afb6d1f276ddbc6c; it contains the validated source. The test runner emitted no source receipt, so file SHA-256s were manually recorded at PR preparation:OpenClawGatewayClient.cs77F7A7ECBD4A4E8B8049474E7AAD43F87356236FE5E252E7A86CEFFF46A539AC;GatewayHandshakeObservationTests.cs50CAF948C66A0CAE944C70B8BC907184C2B91DAE39FF09A3D85D7D3E3CFA97D6.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --filter 'FullyQualifiedName~GatewayHandshakeObservationTests|FullyQualifiedName~GatewayErrorClassifierTests'Networkfor refused transport; TLS remainsTls; HTTP 401, 429, and 503 remainAuth,RateLimited, andServer.Yes/No/N/A): N/A.windows-winui-interactivewas not run; no current-head visible UI diagnostics proof or live WSL Gateway proof was collected. Hosted CI results are tracked in the PR check list.Security Impact
Yes/No): No.Yes/No): No.Yes/No): No.Yes/No): No.Yes/No): No.Yes, explain the risk and mitigation: N/A.Compatibility and Migration
Yes/No): Yes; only incorrect failure categories are corrected.Yes/No): No.Yes/No): No.Review Conversations