The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(wake): wait for bounded recovery before checking lease release
funky-xamarin9251ff4b7e01
diff --git a/tests/tools/test_wake_word.py b/tests/tools/test_wake_word.pyindex 88e08fce37f..51b1f564acb 100644--- a/tests/tools/test_wake_word.py+++ b/tests/tools/test_wake_word.py@@ -761,15 +761,19 @@ def test_stream_failure_releases_owner_and_machine_lock(monkeypatch, tmp_path):monkeypatch.setattr(ww, "_lock_path", lambda: lock_path)owner = object()- ww.start_listening(lambda: None, owner=owner, config={})- deadline = time.time() + 2- while ww.owns_listener(owner) and time.time() < deadline:- time.sleep(0.01)-- assert ww.owns_listener(owner) is False- assert engine.closed is True- handle = ww._acquire_machine_lock(lock_path)- ww._release_machine_lock(handle)+ detector = ww.start_listening(lambda: None, owner=owner, config={})+ try:+ # The reader owns the bounded recovery budget and releases the lease+ # only after exhausting it. Join completion rather than assuming an+ # immediate release within the old two-second polling window.+ detector._thread.join(timeout=10)+ assert not detector.running+ assert ww.owns_listener(owner) is False+ assert engine.closed is True+ handle = ww._acquire_machine_lock(lock_path)+ ww._release_machine_lock(handle)+ finally:+ ww.stop_listening(owner=owner)def _hold_machine_lock(path: str, ready, release) -> None: