test(cron): allow durable late-result routing under CI load

This commit is contained in:
Xubin Ren committed 2026-11-05 12:13:58 +08:00
1 parent 9e161673bb
commit 955b1edd99
1 file changed
+5 -3
+5 -3
View File
@@ -358,6 +358,8 @@ async def test_real_gateway_move_run_reload_and_previous_result(tmp_path, target
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_late_subagent_result_stays_with_moved_task(tmp_path, monkeypatch): async def test_late_subagent_result_stays_with_moved_task(tmp_path, monkeypatch):
monkeypatch.setattr("nanobot.agent.loop._SUBAGENT_TERMINAL_WAIT_SECONDS", 0.02) monkeypatch.setattr("nanobot.agent.loop._SUBAGENT_TERMINAL_WAIT_SECONDS", 0.02)
# Real session writes are part of this routing check, not a latency requirement.
timeout = 30
sessions, cron, job = seed(tmp_path) sessions, cron, job = seed(tmp_path)
release = asyncio.Event() release = asyncio.Event()
entered = asyncio.Event() entered = asyncio.Event()
@@ -395,11 +397,11 @@ async def test_late_subagent_result_stays_with_moved_task(tmp_path, monkeypatch)
try: try:
moved = cron.change_binding(job.id, revision=binding_revision(job), moved = cron.change_binding(job.id, revision=binding_revision(job),
binding=target_binding(), message="Prepare the report") binding=target_binding(), message="Prepare the report")
await asyncio.wait_for(run_bound_cron_job(moved, agent=agent, cron=cron), 5) await asyncio.wait_for(run_bound_cron_job(moved, agent=agent, cron=cron), timeout)
await asyncio.wait_for(entered.wait(), 5) await asyncio.wait_for(entered.wait(), timeout)
release.set() release.set()
delivered = [] delivered = []
async with asyncio.timeout(5): async with asyncio.timeout(timeout):
while not any(msg.content.startswith("Final report:") for msg in delivered): while not any(msg.content.startswith("Final report:") for msg in delivered):
msg = await bus.consume_outbound() msg = await bus.consume_outbound()
if msg.event is None and msg.content: if msg.event is None and msg.content: