The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): set_theme reaches its bridge again
alt-glitch51dbec440702
diff --git a/tests/tui_gateway/test_theme_bridge.py b/tests/tui_gateway/test_theme_bridge.pyindex 76ec25cfd66..3a4702f30e8 100644--- a/tests/tui_gateway/test_theme_bridge.py+++ b/tests/tui_gateway/test_theme_bridge.py@@ -29,3 +29,12 @@ def test_pick_outcomes(monkeypatch, answer, elapsed, result):assert theme_bridge.theme_request("s1", {"picker": "accent"}) == resultassert sent == [("theme.pick", "s1", {"picker": "accent"}, theme_bridge.THEME_PICK_TIMEOUT_S)]+++def test_the_session_callbacks_reach_the_bridge(monkeypatch):+ """Built the way production builds them: server._agent_cbs, rebound to server.py's globals."""+ calls = []+ monkeypatch.setattr(theme_bridge, "theme_request", lambda sid, payload: calls.append((sid, payload)) or {"success": True})++ assert server._agent_cbs("s1")["theme_callback"]({"accent": "violet"}) == {"success": True}+ assert calls == [("s1", {"accent": "violet"})]diff --git a/tui_gateway/agent_callbacks.py b/tui_gateway/agent_callbacks.pyindex 4fcd5a5f8e9..18b7d30ad8b 100644--- a/tui_gateway/agent_callbacks.py+++ b/tui_gateway/agent_callbacks.py@@ -10,7 +10,6 @@ import contextlibimport threadingfrom .method_ctx import bind_module-from .theme_bridge import theme_request# Child-session live mirror: a delegated child's activity reaches the gateway only as@@ -145,6 +144,9 @@ def _setup_choose_request(sid: str, payload: dict) -> dict | None:def _agent_cbs(sid: str) -> dict:+ # Late import: bind_module rebinds this function to server.py's globals and skips plain imports.+ from tui_gateway.theme_bridge import theme_request+def _read_block(method: str, timeout: int):# read_terminal / read_preview (desktop GUI): server request like clarify; the preview# read gets longer since a URL tab extracts text from a live page.