The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tests): kanban wake drain helpers no longer busy-spin forever on Python 3.12+
teknium189937f86858a
diff --git a/evals/heartbeat_idle_wire.py b/evals/heartbeat_idle_wire.pyindex d1d97f00c73..7f74cc72eeb 100644--- a/evals/heartbeat_idle_wire.py+++ b/evals/heartbeat_idle_wire.py@@ -68,6 +68,10 @@ async def main(base_poller):async def drain():while adapter._background_tasks:await asyncio.gather(*list(adapter._background_tasks))+ # gather() over tasks that are ALL already done completes without yielding (3.12+), so a+ # finished task whose queued _background_tasks.discard callback has not run yet would spin+ # this loop forever; yield once so those done-callbacks run before re-checking.+ await asyncio.sleep(0)def snapshot():return {"turns": len(received), "queue_depth": runner._queue_depth(key, adapter=adapter),diff --git a/tests/gateway/test_completion_admission.py b/tests/gateway/test_completion_admission.pyindex e42afe7fdac..eabcc05c68b 100644--- a/tests/gateway/test_completion_admission.py+++ b/tests/gateway/test_completion_admission.py@@ -25,6 +25,10 @@ def pending(key, name):async def drain(adapter):while adapter._background_tasks:await asyncio.gather(*list(adapter._background_tasks))+ # gather() over tasks that are ALL already done completes without yielding (3.12+), so a+ # finished task whose queued _background_tasks.discard callback has not run yet would spin+ # this loop forever; yield once so those done-callbacks run before re-checking.+ await asyncio.sleep(0)@pytest.mark.asynciodiff --git a/tests/gateway/test_kanban_wake_acceptance.py b/tests/gateway/test_kanban_wake_acceptance.pyindex bf1834cdbd0..70893a05fd6 100644--- a/tests/gateway/test_kanban_wake_acceptance.py+++ b/tests/gateway/test_kanban_wake_acceptance.py@@ -35,6 +35,10 @@ def setup_route(raft=False):async def drain(adapter):while adapter._background_tasks:await asyncio.gather(*list(adapter._background_tasks))+ # gather() over tasks that are ALL already done completes without yielding (3.12+), so a+ # finished task whose queued _background_tasks.discard callback has not run yet would spin+ # this loop forever; yield once so those done-callbacks run before re-checking.+ await asyncio.sleep(0)@pytest.mark.asyncio