auto-sync: 2026-06-01 22:46:37

This commit is contained in:
cfdaily
2026-06-01 22:46:37 +08:00
parent 66d0b30088
commit 3771ae9b95
+4 -3
View File
@@ -219,10 +219,11 @@ class TestAcquireFirst:
def test_phase1_counter_acquire_exclusive(self, spawner):
"""E11.3 Phase 1: counter acquire 互斥
同一 agent 并发 spawn → 第二个 AgentBusyError(reason=counter_blocked)。
同一 agent 并发 spawn → 第二个 AgentBusyError(reasoncounter)。
使用 max_concurrent_sessions=1 确保同 agent 第二次 acquire 失败。
"""
from src.daemon.counter import ActiveAgentCounter
counter = ActiveAgentCounter(max_global=5, max_per_agent=1)
counter = ActiveAgentCounter(max_global=5, max_concurrent_sessions=1)
spawner.counter = counter
# 第一次 acquire 成功
@@ -231,7 +232,7 @@ class TestAcquireFirst:
)
assert session_id
# 第二次 acquire → counter_blocked
# 第二次 acquire → counter blocked(同 agent 已有活跃 session
with pytest.raises(AgentBusyError) as exc_info:
asyncio.run(
spawner.spawn_full_agent("test-agent", "task2", task_id="t2")