The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: restore dashboard event-loop and kanban tip guards dropped by #120071
teknium173ea611c233c
diff --git a/tests/hermes_cli/test_kanban_db.py b/tests/hermes_cli/test_kanban_db.pyindex c13b0bcbdb2..08520370978 100644--- a/tests/hermes_cli/test_kanban_db.py+++ b/tests/hermes_cli/test_kanban_db.py@@ -1781,6 +1781,36 @@ def test_locked_healthy_db_does_not_classify_as_corrupt(tmp_path, monkeypatch):# First-use tip for scratch workspaces# ---------------------------------------------------------------------------+def test_maybe_emit_scratch_tip_fires_once_per_install(kanban_home):+ """The first scratch workspace materialized on an install appends a+ ``tip_scratch_workspace`` event; later scratch tasks on the same install+ stay silent, and non-scratch workspaces never trigger it."""+ with kbc.connect() as conn:+ wt = kb.create_task(conn, title="worktree task")+ t1 = kb.create_task(conn, title="first scratch")+ t2 = kb.create_task(conn, title="second scratch")++ def _kinds(task_id):+ with kbc.connect() as conn:+ rows = conn.execute(+ "SELECT kind FROM task_events WHERE task_id = ? ORDER BY id",+ (task_id,),+ ).fetchall()+ return [r["kind"] for r in rows]++ with kbc.connect() as conn:+ kbw._maybe_emit_scratch_tip(conn, wt, "worktree")+ assert "tip_scratch_workspace" not in _kinds(wt)++ with kbc.connect() as conn:+ kbw._maybe_emit_scratch_tip(conn, t1, "scratch")+ assert _kinds(t1).count("tip_scratch_workspace") == 1++ with kbc.connect() as conn:+ kbw._maybe_emit_scratch_tip(conn, t2, "scratch")+ assert "tip_scratch_workspace" not in _kinds(t2), (+ "scratch tip re-fired on the same install"+ )diff --git a/tests/hermes_cli/test_web_server_boot_handshake.py b/tests/hermes_cli/test_web_server_boot_handshake.pyindex 7f0e9aacb74..dec7829e636 100644--- a/tests/hermes_cli/test_web_server_boot_handshake.py+++ b/tests/hermes_cli/test_web_server_boot_handshake.py@@ -5,7 +5,8 @@ Simulates a slow hermes_cli.gateway import (15-30 s on a fresh Windows installwith Defender scanning every new .pyc) by patching the two helpers that touchthe blocking import and measuring response latency.-Covered: backend startup is not blocked by hosted-room recovery, shutdown joins the+Covered: the gateway warmup import completes before the lifespan yields+(#73083/#73291), backend startup is not blocked by hosted-room recovery, shutdown joins thestate.db reconcile worker, and /api/status runs its slow drain-timeout resolution offthe event loop so a concurrent fast endpoint (/api/version) still responds."""@@ -35,6 +36,33 @@ def _make_slow_drain(seconds: float):return _slow+def test_lifespan_warmup_is_synchronous(monkeypatch):+ """_warm_gateway_module must finish on the event-loop thread before the+ lifespan yields (#73083/#73291). On Windows + Python 3.11 the heavy import+ holds the GIL, so moving it to run_in_executor / a background task froze+ the loop after the socket opened and the Desktop's ready-probe timed out.+ Running it before the yield means no request is served until it is done."""+ from fastapi.testclient import TestClient++ warm: dict[str, object] = {}++ def _record_warm():+ try:+ asyncio.get_running_loop()+ warm["on_loop_thread"] = True+ except RuntimeError:+ warm["on_loop_thread"] = False+ warm["done"] = True++ monkeypatch.setattr(web_server_mod, "_warm_gateway_module", _record_warm)+ with TestClient(web_server_mod.app, raise_server_exceptions=False):+ assert warm.get("done") is True, "startup completed before the gateway warmup ran"+ assert warm.get("on_loop_thread") is True, (+ "gateway warmup was moved off the lifespan (executor/background) — "+ "the socket now accepts probes while the GIL-holding import runs"+ )++def test_hosted_room_recovery_cannot_block_or_abort_backend_startup(monkeypatch):from fastapi.testclient import TestClientfrom tui_gateway import methods_groups