The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: simulate contended wait for resolve+reload path
kshitijc925b523a11b
diff --git a/tests/run_agent/test_cross_process_turn_lease.py b/tests/run_agent/test_cross_process_turn_lease.pyindex 252e92d6edf..847a888abd5 100644--- a/tests/run_agent/test_cross_process_turn_lease.py+++ b/tests/run_agent/test_cross_process_turn_lease.py@@ -133,6 +133,16 @@ def test_run_conversation_acquires_lease_when_session_probe_raises(monkeypatch):db.get_session = locked_get_sessionagent = _agent_with_db(db)+ # Simulate a contended wait so the resolve+reload path is exercised.+ def acquire_with_wait(session_id, holder, **kwargs):+ db.events.append(("acquire", session_id, holder))+ on_wait = kwargs.get("on_wait")+ if on_wait is not None:+ on_wait(0.0)+ return True++ db.acquire_session_turn_lease = acquire_with_wait+observed = {}def fake_run(_agent, _message, _system, history, *_args, **_kwargs):@@ -508,6 +518,16 @@ def test_run_conversation_exposes_holder_for_fenced_flush(monkeypatch):agent._pending_cli_user_message = Noneagent._session_persist_lock = None+ # Simulate a contended wait so the resolve+reload path is exercised.+ def acquire_with_wait(session_id, holder, **kwargs):+ db.events.append(("acquire", session_id, holder))+ on_wait = kwargs.get("on_wait")+ if on_wait is not None:+ on_wait(0.0)+ return True++ db.acquire_session_turn_lease = acquire_with_wait+def fake_run(_agent, _message, _system, history, *_args, **_kwargs):captured["active"] = getattr(_agent, "_active_session_turn_lease_holder", None