The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(display): display.thumbnail is suppressed while a human holds the lease
teknium1e58d20e976c7
diff --git a/tests/tui_gateway/test_display_methods.py b/tests/tui_gateway/test_display_methods.pyindex d23cef507b1..8a863821894 100644--- a/tests/tui_gateway/test_display_methods.py+++ b/tests/tui_gateway/test_display_methods.py@@ -31,3 +31,32 @@ def test_install_worker_keeps_the_requested_profile_scope(tmp_path, monkeypatch)assert resp["result"]["started"], respassert done.wait(5)assert seen["home"] == str(named)+++def _fresh_lease():+ from tools.bot_desktop import lease+ lease._reset_for_tests()+ yield lease+ lease._reset_for_tests()+++def _call(server, method, params):+ return server.handle_request({"jsonrpc": "2.0", "id": 7, "method": method, "params": params})+++def test_thumbnail_is_suppressed_while_a_human_holds_the_lease(monkeypatch, _fresh_lease):+ """The Desktop polls thumbnails on a timer; while a human drives the screen that grab would ship+ whatever they are typing to every connected client, so it must not touch the framebuffer at all."""+ import tui_gateway.server as server+ from tools.bot_desktop import thumbnail++ grabs = []+ monkeypatch.setattr(thumbnail, "thumbnail_data_url", lambda: grabs.append(1) or "data:image/jpeg;base64,SECRET")+ _fresh_lease.acquire("viewer-1")+ result = _call(server, "display.thumbnail", {})["result"]+ assert result["data_url"] is None and result["suppressed"] == "human_has_control"+ assert grabs == [], "the framebuffer was grabbed while a human held the lease"+ _fresh_lease.release("viewer-1")+ assert _call(server, "display.thumbnail", {})["result"]["data_url"].endswith("SECRET")+diff --git a/tui_gateway/methods_display.py b/tui_gateway/methods_display.pyindex 77266891697..aae515fe43f 100644--- a/tui_gateway/methods_display.py+++ b/tui_gateway/methods_display.py@@ -59,8 +59,12 @@ def _(rid, params: dict) -> dict:@method("display.thumbnail")@_profile_scopeddef _(rid, params: dict) -> dict:- """One JPEG grab of the bot's screen (``data_url``: null while stopped). Read-only: no lease change."""+ """One JPEG grab of the bot's screen (``data_url``: null while stopped). Read-only: no lease change.+ Suppressed while a human holds the lease — the frame may show what they are typing."""try:+ from tools.bot_desktop import lease as _bd_lease+ if _bd_lease.human_holds():+ return _ok(rid, {"data_url": None, "suppressed": "human_has_control"})from tools.bot_desktop.thumbnail import thumbnail_data_urlreturn _ok(rid, {"data_url": thumbnail_data_url()})except Exception as e: