Conversation
…create_no_race_keeps_worker_alive)
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for adding focused WebSocket coverage. The coverage goal is still useful, but this test file needs adaptation before it can be salvaged onto current main.
Problems
tests/tui_gateway/test_ws.py:26definesFakeWebSocketwithoutclose(), while currenttui_gateway/ws.py:452unconditionally awaitsws.close()inhandle_ws()cleanup. The handle_ws cases will therefore fail during teardown rather than complete their assertions.- Current main substantially changed this path after the PR base: token batching is in
tui_gateway/ws.py:125-221, MCP startup is at:312-317, and disconnect teardown is at:425-450. The tests also need to isolate the new MCP-startup call and cover these current contracts.
Suggested changes
- Add an awaited
closemock to the fake, patch MCP startup in handle_ws tests, and port the reusable cases to the current transport semantics. - Add coverage for batching/order and disconnect session teardown alongside the existing parse and dispatch failures.
Automated hermes-sweeper review.
|
|
||
|
|
||
| class FakeWebSocket: | ||
| """Minimal stand-in for a starlette WebSocket to avoid starlette imports in test.""" |
Collaborator
There was a problem hiding this comment.
handle_ws() now always awaits ws.close() in its finally block (tui_gateway/ws.py:452), but this fake does not provide close. Add an async close mock/method so the handle_ws tests can reach their assertions without failing during cleanup.
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings tui_gateway/ws.py coverage from 0% to 86% (150 stmts, 21 missed).
Covers: WSTransport init/write/write_async/_safe_send/close,
_ws_peer_label, _disable_nagle, and key paths in handle_ws (accept,
parse error, dispatch, ready send failure, dispatch crash).
Closes #36617