Skip to content

The agent that grows with you

test(tui_gateway): hold the compute-host hello to the supervisor's own budget

Teknium9232eea10e12
diff --git a/tests/tui_gateway/test_compute_host.py b/tests/tui_gateway/test_compute_host.py
index 2156ef385d2..dbee1673d09 100644
--- a/tests/tui_gateway/test_compute_host.py
+++ b/tests/tui_gateway/test_compute_host.py
@@ -45,7 +45,11 @@ def test_compute_host_line_json_hello_and_shutdown():
assert proc.stdin is not None
out = _stdout_queue(proc)
try:
- hello = _read_json_line(out)
+ # The hello waits behind the child's cold imports: hold it to the supervisor's own
+ # budget, not a tighter one that only a quiet machine meets (~1.3s idle, 5s+ loaded).
+ from tui_gateway.host_supervisor import _HELLO_TIMEOUT_SECS
+
+ hello = _read_json_line(out, timeout=_HELLO_TIMEOUT_SECS)
assert hello["type"] == "hello"
assert hello["host_pid"] == proc.pid
diff --git a/tui_gateway/host_supervisor.py b/tui_gateway/host_supervisor.py
index 8afd6edb376..e24ad802125 100644
--- a/tui_gateway/host_supervisor.py
+++ b/tui_gateway/host_supervisor.py
@@ -36,6 +36,8 @@ MUTATOR_ROUTE_TABLE: dict[str, str] = {
_REGISTRY_NAME = "dashboard-compute-host.json"
_RESPAWN_WINDOW_SECS = 300.0
_SHUTDOWN_TIMEOUT_SECS = 10.0
+# A cold host imports the agent stack before its hello (~1.3s idle, 5s+ on a loaded box).
+_HELLO_TIMEOUT_SECS = 10.0
# Late control-ack handlers: a compress that outlives its RPC waiter can run for the full
# compression ceiling plus a stall-fallback retry, so keep registrations past that — bounded.
# See #97948.
@@ -344,7 +346,7 @@ class HostSupervisor:
(self._drain_stderr, "compute-host-stderr"),
(self._wait_for_exit, "compute-host-wait")):
threading.Thread(target=target, args=(proc,), name=name, daemon=True).start()
- if not self._hello_event.wait(timeout=10.0):
+ if not self._hello_event.wait(timeout=_HELLO_TIMEOUT_SECS):
self._terminate_process(proc)
raise RuntimeError(f"compute host did not send hello; stderr={self._stderr_tail[-5:]}")
self._validate_hello()