Skip to content

Commit d4083b5

Browse files
committed
Bump WS auth timeouts to 60 s for slow CI runners
The previous 15 s bump cleared 3.11 + 3.13, but 3.10 / 3.12 / 3.14 still tripped a random subset of WS handshake tests on GitHub Windows runners (the same handshake takes ~0.6 s locally). Different tests fail on different versions = pure load-induced flake. Bump auth-handshake timeouts to 60 s on both viewer and host paths plus the ws-host handshake timeout. 60 s is generous but harmless: the handshake never takes more than a fraction of a second under real conditions; the timeout exists only to stop a malicious / abandoned client from holding a slot forever. Test side: bump every viewer.connect(timeout=10.0) in the WS test file to 30.0 — the explicit caller timeout has to be at least as generous as the inner handshake or the connect bails first. Verified local suite still 16/16 in test_remote_desktop_websocket + test_mcp_plugin_watcher in 60.96 s.
1 parent fbd3b25 commit d4083b5

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

je_auto_control/utils/remote_desktop/host.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
FrameProvider = Callable[[], bytes]
3838
InputDispatcher = Callable[[Mapping[str, Any]], Any]
3939

40-
_AUTH_TIMEOUT_S = 15.0
40+
_AUTH_TIMEOUT_S = 60.0
4141
_DEFAULT_QUALITY = 70
4242

4343

je_auto_control/utils/remote_desktop/viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
ClipboardCallback = Callable[[str, Any], None]
2727
ErrorCallback = Callable[[Exception], None]
2828

29-
_DEFAULT_AUTH_TIMEOUT_S = 15.0
29+
_DEFAULT_AUTH_TIMEOUT_S = 60.0
3030
_DEFAULT_CONNECT_TIMEOUT_S = 5.0
3131
_NOT_CONNECTED_MESSAGE = "viewer is not connected"
3232

je_auto_control/utils/remote_desktop/ws_host.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
WsProtocolError, server_handshake,
1818
)
1919

20-
_HANDSHAKE_TIMEOUT_S = 15.0
20+
_HANDSHAKE_TIMEOUT_S = 60.0
2121

2222

2323
class WebSocketDesktopHost(RemoteDesktopHost):

test/unit_test/headless/test_remote_desktop_websocket.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_ws_viewer_authenticates_and_receives_frames():
122122
host="127.0.0.1", port=host.port, token="tok",
123123
on_frame=received.append,
124124
)
125-
viewer.connect(timeout=10.0)
125+
viewer.connect(timeout=30.0)
126126
assert _wait_until(lambda: len(received) >= 2, timeout=30.0)
127127
assert all(frame == b"ws-frame" for frame in received)
128128
viewer.disconnect()
@@ -137,7 +137,7 @@ def test_ws_viewer_with_wrong_token_is_rejected():
137137
host="127.0.0.1", port=host.port, token="wrong",
138138
)
139139
with pytest.raises(AuthenticationError):
140-
viewer.connect(timeout=10.0)
140+
viewer.connect(timeout=30.0)
141141
assert host.connected_clients == 0
142142
finally:
143143
host.stop(timeout=1.0)
@@ -149,7 +149,7 @@ def test_ws_viewer_input_reaches_host_dispatcher():
149149
viewer = WebSocketDesktopViewer(
150150
host="127.0.0.1", port=host.port, token="tok",
151151
)
152-
viewer.connect(timeout=10.0)
152+
viewer.connect(timeout=30.0)
153153
viewer.send_input({"action": "mouse_move", "x": 42, "y": 24})
154154
viewer.send_input({"action": "type", "text": "hi"})
155155
captured = host._test_captured_input # noqa: SLF001
@@ -170,7 +170,7 @@ def test_ws_host_announces_host_id():
170170
host="127.0.0.1", port=host.port, token="tok",
171171
expected_host_id="700800900",
172172
)
173-
viewer.connect(timeout=10.0)
173+
viewer.connect(timeout=30.0)
174174
assert viewer.remote_host_id == "700800900"
175175
viewer.disconnect()
176176
finally:
@@ -184,7 +184,7 @@ def test_plain_tcp_viewer_against_ws_host_is_rejected():
184184
host="127.0.0.1", port=host.port, token="tok",
185185
)
186186
with pytest.raises((OSError, AuthenticationError)):
187-
viewer.connect(timeout=10.0)
187+
viewer.connect(timeout=30.0)
188188
assert _wait_until(lambda: host.connected_clients == 0)
189189
finally:
190190
host.stop(timeout=1.0)
@@ -204,7 +204,7 @@ def test_ws_viewer_against_plain_host_fails():
204204
)
205205
with pytest.raises((OSError, ConnectionError, WsProtocolError,
206206
AuthenticationError)):
207-
viewer.connect(timeout=10.0)
207+
viewer.connect(timeout=30.0)
208208
finally:
209209
host.stop(timeout=1.0)
210210

0 commit comments

Comments
 (0)