Repository navigation
fix(gateway): classify opening timeouts and repair lifetime checks - #146508
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 maintainer review before merge. Reviewed September 12, 2026, 7:48 PM ET / 23:48 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR classifies Gateway opening timeouts as transport errors, repairs Vitest mock-resolution ordering, and corrects a media-access test’s file-handle cleanup. Merge readiness✅ Ready for maintainer review The updated PR remains useful and has no actionable introduced findings. Current main still lacks the timeout classification, and the additional lifetime repairs address concrete failures without changing production authorization or timeout budgets. Priority: P2 Review scores
Verification
How this fits togetherGateway clients translate WebSocket connection failures into diagnostics and recovery decisions for CLI callers. The accompanying test infrastructure changes ensure asynchronous mock resolution finishes before imports and shared-worker cleanup proceed. flowchart TD
A[Gateway query] --> B[WebSocket connection]
B --> C[Opening timeout classification]
C --> D[Transport diagnostics and recovery]
E[Test imports and mock changes] --> F[Serialized mock resolution]
F --> G[Registry lookup]
F --> H[Shared-worker cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +5, Tests -135, Docs +13, Other +77. Total -40 across 12 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep timeout normalization in the WebSocket adapter and mock ordering in Vitest’s native owner, with the documented upstream-removal gate. Do we have a high-confidence way to reproduce the issue? Yes: a TCP peer that accepts but never upgrades produces an uncoded ws timeout that current main cannot classify through its errno-based recovery path; the held-unmock regression also targets the actual dependency fetch boundary. These paths were source-verified, not executed by this reviewer. Is this the best way to solve the issue? Yes: both repairs sit with the existing owners, and the media fixture now proves policy withdrawal and descriptor closure instead of passing through an unrelated activation failure. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1ccb3e114fe3. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review The updated head includes the verified Vitest mock-resolution owner repair and media-fixture lifetime correction alongside the transport classification fix. The final body records the real import regression, cleanup proof, original cold CI group passing on macOS/Linux, installed patch hashes, and complete validation results. |
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes notedThis PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin, a member of
Security review is still recommended before merge when the dependency graph change is intentional. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…penclaw#146508) * fix(gateway): classify websocket opening timeouts for recovery * test: close media handles in cloud dispatch policy proof * fix(test): serialize mock resolution in the Vitest owner
What Problem This Solves
Gateway queries lose their transport classification when a TCP peer stalls during the WebSocket upgrade. Validation also exposed two reproducible lifetime failures: Vitest could reuse a removed mock, and a media-policy fixture leaked file handles while producing a misleading successful assertion.
User Impact
Gateway queries now return actionable transport errors that existing recovery code recognizes. The regression checks exercise the intended authorization and media-ownership paths, including under the original CI test ordering.
Timeout budgets and automatic retry policy are unchanged. The Vitest version remains pinned at 5.0.0; its existing temporary patch owns the framework correction.
Why This Change Was Made
ETIMEDOUTin the Node WebSocket adapter. Existing RPC diagnostics and recovery classification then work without consumer message matching. The contract is ws 8.21.3's timeout callback and its freshError(message)inabortHandshake.Production OpenClaw delta is +5 lines. The dependency implementation grows by 9 lines while the duplicated local test tooling shrinks by 75; patch context and indentation account for the larger generated diff. Overall the PR is net negative, with no new runtime config, protocol, or database surface.
Evidence
callGatewayprobe returnsgateway_transport_errorand recovery eligibility in 484 ms.importActual/nested-factory reentrancy and resolution failure recovery.The original CI failure is retained as evidence: run 34720664470, large-9. Commit history shows #122100 began forwarding raw connection errors, while #124581 normalized errno failures but missed this uncoded timeout. The Vitest 5 migration in #138264 retained the local serializer's older queue assumptions. This PR preserves the original opening-handshake deadline from #108348.