The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: reap truncation fixture worker before restoring bindings
Tekniumd6d8af931c8d
diff --git a/tests/test_tui_gateway_server.py b/tests/test_tui_gateway_server.pyindex 8b2ece07b89..1450910bd42 100644--- a/tests/test_tui_gateway_server.py+++ b/tests/test_tui_gateway_server.py@@ -6517,6 +6517,9 @@ def test_prompt_submit_truncation_falls_back_to_sid_when_session_key_null(monkeymonkeypatch.setattr(server, "_get_db", lambda: _FakeDB())monkeypatch.setattr(server, "_start_agent_build", lambda *a, **k: None)monkeypatch.setattr(server, "_start_inflight_turn", lambda *a, **k: None)+ # This invariant ends at durable truncation; no model turn is requested by+ # the fixture. Keep its asynchronous continuation inside this test's scope.+ monkeypatch.setattr(server, "_run_prompt_submit", lambda *a, **k: None)try:resp = server.handle_request(@@ -6538,6 +6541,13 @@ def test_prompt_submit_truncation_falls_back_to_sid_when_session_key_null(monkeyassert replaced[0][0] == "null-key-trunc-sid"assert replaced[0][1] == history[:2]finally:+ # The prompt worker resolves server bindings when it runs. Reap it before+ # monkeypatch teardown or it can consume the next test's notification.+ session = server._sessions.get("null-key-trunc-sid")+ worker = session.get("_run_thread") if session else None+ if worker is not None:+ worker.join(timeout=5)+ assert not worker.is_alive()server._sessions.pop("null-key-trunc-sid", None)