Skip to content

The agent that grows with you

test(tui_gateway): hosted-room suites stop waiting on 0.5-2s thread joins under a loaded runner

teknium1eabf2e46f937
diff --git a/tests/tui_gateway/test_hosted_room_driver_runtime.py b/tests/tui_gateway/test_hosted_room_driver_runtime.py
index bdf5fe77981..92a35b44cb1 100644
--- a/tests/tui_gateway/test_hosted_room_driver_runtime.py
+++ b/tests/tui_gateway/test_hosted_room_driver_runtime.py
@@ -422,7 +422,7 @@ def _runtime(
)
-def _wait_for(predicate, *, timeout: float = 2.0) -> None:
+def _wait_for(predicate, *, timeout: float = 5.0) -> None:
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
if predicate():
@@ -2092,11 +2092,12 @@ def test_stop_is_bounded_and_does_not_interrupt_active_turn(db: Path):
runtime = _runtime(db, rpc, poll_interval_seconds=0.01)
runtime.start()
- assert rpc.submitted.wait(1.0)
+ assert rpc.submitted.wait(5.0)
started = time.monotonic()
- stopped = runtime.stop(timeout=0.5)
+ stopped = runtime.stop(timeout=5.0)
assert stopped is True
- assert time.monotonic() - started < 0.5
+ # Bounded: returns well before its own timeout and without waiting for the active turn (which never completes).
+ assert time.monotonic() - started < 2.0
assert state.get_task(db, identity)["status"] == "running"
assert not [call for call in rpc.calls if call[0] == "interrupt"]
diff --git a/tests/tui_gateway/test_hosted_room_service.py b/tests/tui_gateway/test_hosted_room_service.py
index 9eb7fcad375..7ff4c95cc19 100644
--- a/tests/tui_gateway/test_hosted_room_service.py
+++ b/tests/tui_gateway/test_hosted_room_service.py
@@ -384,7 +384,7 @@ def test_create_send_drive_publish_and_replay_without_client_transport(tmp_path:
event["kind"] == "message.member" for event in service._events("room-1")
)
)
- assert service.stop(timeout=1.0)
+ assert service.stop(timeout=5.0)
events = service._events("room-1")
assert [event["kind"] for event in events][:3] == [
@@ -606,7 +606,7 @@ def test_same_thread_followup_migrates_and_delivers_committed_peer_reply(
payload={"text": "@hermes continue", "thread_id": "thread-1"},
)
_wait_for(lambda: len(service.rpc.prompts) == 2)
- assert service.stop(timeout=1.0)
+ assert service.stop(timeout=5.0)
profile, prompt = service.rpc.prompts[1]
assert profile == "default"
@@ -651,7 +651,7 @@ def test_active_same_thread_followup_waits_for_current_task(tmp_path: Path):
for event in service._events("room-1")
)
)
- assert service.stop(timeout=1.0)
+ assert service.stop(timeout=5.0)
assert "User (user): @hermes follow up" in service.rpc.prompts[1][1]
@@ -683,7 +683,7 @@ def test_thread_transcript_prunes_committed_message_and_settlement_together(
for event in service._events("room-1")
)
)
- assert service.stop(timeout=1.0)
+ assert service.stop(timeout=5.0)
for index in range(24):
_append_room_event(
db,
@@ -1048,7 +1048,7 @@ def test_headless_room_publishes_peer_member_reply_without_desktop_transport(
event["kind"] == "message.member" for event in service._events("room-1")
)
)
- assert service.stop(timeout=1.0)
+ assert service.stop(timeout=5.0)
events = service._events("room-1")
reply = next(event for event in events if event["kind"] == "message.member")
@@ -1114,7 +1114,7 @@ def test_unadmitted_peer_failure_does_not_block_next_healthy_member(
for event in service._events("room-1")
)
)
- assert service.stop(timeout=1.0)
+ assert service.stop(timeout=5.0)
events = service._events("room-1")
assert any(
diff --git a/tests/tui_gateway/test_hosted_room_two_gateway_scoped.py b/tests/tui_gateway/test_hosted_room_two_gateway_scoped.py
index 72d47507259..1b33366fb9c 100644
--- a/tests/tui_gateway/test_hosted_room_two_gateway_scoped.py
+++ b/tests/tui_gateway/test_hosted_room_two_gateway_scoped.py
@@ -166,7 +166,7 @@ async def test_in_process_scoped_transport_contract_finishes_headlessly(
"peer reply was not published: "
f"status={home.runtime.status()} events={home._events('room-1')}"
)
- assert home.stop(timeout=1.0)
+ assert home.stop(timeout=5.0)
reply = next(
event