The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(bot-screen): a watcher's SetDesktopSize is dropped, not forwarded to Xvnc
teknium1b428634d6377
diff --git a/tests/tools/test_bot_desktop_rfb_filter_limits.py b/tests/tools/test_bot_desktop_rfb_filter_limits.pyindex df4dd2fe27a..047259412fb 100644--- a/tests/tools/test_bot_desktop_rfb_filter_limits.py+++ b/tests/tools/test_bot_desktop_rfb_filter_limits.py@@ -34,18 +34,20 @@ def set_desktop_size(width, height, screens=1):@pytest.mark.parametrize("holder", [False, True])-def test_set_desktop_size_is_framed_and_forwarded_even_to_a_watcher(holder):- """Regression for #110039: launcher.sh passes -AcceptSetDesktopSize (the viewer fits the screen to its- pane), but the filter had no frame for client message 251 and killed the stream with 'unknown RFB client- message type'. It carries no input, so it passes through like SetEncodings, lease or not."""+def test_set_desktop_size_is_framed_and_gated_like_input(holder):+ """Regression for #110039: launcher.sh passes -AcceptSetDesktopSize, but the filter had no frame for client+ message 251 and killed the stream with 'unknown RFB client message type'. It is framed now, and because it+ resizes the bot's framebuffer under a working agent it is treated like input: the lease holder's resize+ is forwarded, a watcher's is dropped while the stream (and the request that follows) stays intact."""parser = RfbClientFilter(lambda: holder)parser.feed(_HANDSHAKE)- msg = set_desktop_size(1280, 800) + b"\x03\x00" + b"\x00" * 8 # followed by a FramebufferUpdateRequest- assert parser.feed(msg) == msg+ resize = set_desktop_size(1280, 800)+ update_request = b"\x03\x00" + b"\x00" * 8+ assert parser.feed(resize + update_request) == (resize if holder else b"") + update_requestdef test_truncated_set_desktop_size_waits_for_the_rest():- parser = RfbClientFilter(lambda: False)+ parser = RfbClientFilter(lambda: True)parser.feed(_HANDSHAKE)msg = set_desktop_size(1280, 800, screens=2)for byte in msg[:-1]:diff --git a/tools/bot_desktop/rfb_filter.py b/tools/bot_desktop/rfb_filter.pyindex 88a0668e17b..2e4b8483ded 100644--- a/tools/bot_desktop/rfb_filter.py+++ b/tools/bot_desktop/rfb_filter.py@@ -4,9 +4,10 @@ noVNC's ``viewOnly`` is a UI hint; anyone holding the socket could still injectparses the client stream and forwards only non-input messages from viewers that do not hold thelease. RFB messages do not align with WebSocket frames, so this is a stateful stream parser fedarbitrary chunks (RFC 6143 §7.5 layouts; TigerVNC's EnableContinuousUpdates 150, Fence 248 and-SetDesktopSize 251 — Xvnc runs -AcceptSetDesktopSize so the viewer can fit the screen to its pane — pass-through untouched since they carry no input; QEMU Extended KeyEvent 255 is keyboard input — noVNC-switches to it as soon as Xvnc advertises the pseudo-encoding — so it is gated like KeyEvent).+SetDesktopSize 251 are framed too. 150 and 248 pass through untouched since they carry no input; QEMU+Extended KeyEvent 255 is keyboard input — noVNC switches to it as soon as Xvnc advertises the+pseudo-encoding — so it is gated like KeyEvent; SetDesktopSize resizes the bot's framebuffer under the+agent (Xvnc runs -AcceptSetDesktopSize), so it is gated like input: only the lease holder may send it).Xvnc runs ``-SecurityTypes None``, so the handshake is fixed-size: 12-byte version, 1-byte securitychoice, then ``ClientInit`` (1 byte). ``ServerInit`` is server→client and never crosses this filter.@@ -16,7 +17,7 @@ from __future__ import annotationsfrom typing import Callable-_INPUT_TYPES = {4, 5, 6, 255} # KeyEvent, PointerEvent, ClientCutText, QEMU Extended KeyEvent+_INPUT_TYPES = {4, 5, 6, 251, 255} # KeyEvent, PointerEvent, ClientCutText, SetDesktopSize, QEMU Extended KeyEvent# Fixed-length client messages: type -> total length including the type byte._FIXED = {