mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-26 13:33:03 +00:00
复核 R-b8(隔离时 asyncio 记一条回调异常):断点写入的守卫改成协程包装、在协程里查 fence——LangGraph 在节点的完成回调里调 aput_writes 拿协程交给后台任务,以前同步包装在回调里就抛 Fenced,每次隔离都打一条「Exception in callback … FuturesDict.on_done」加 traceback;现在异常留在写断点的那个任务里,由 LangGraph 照常收走。补测试:卡住被接手那一条里 asyncio 不记回调异常、不记没人取的任务异常(改前的写法这条不过)
This commit is contained in:
@@ -111,8 +111,17 @@ async def _stall_and_take_over(slow) -> str:
|
||||
return run.id
|
||||
|
||||
|
||||
async def test_a_stalled_executor_does_not_overwrite_the_takeover(slow):
|
||||
async def test_a_stalled_executor_does_not_overwrite_the_takeover(slow, caplog):
|
||||
import gc
|
||||
import logging
|
||||
|
||||
caplog.set_level(logging.ERROR, logger="asyncio")
|
||||
run_id = await _stall_and_take_over(slow)
|
||||
await asyncio.sleep(0.1)
|
||||
gc.collect()
|
||||
await asyncio.sleep(0)
|
||||
noisy = [r.getMessage() for r in caplog.records if r.name == "asyncio"]
|
||||
assert noisy == [], f"隔离时 asyncio 不该记回调异常、没人取的任务异常(复核 R-b8):{noisy}"
|
||||
async with SessionLocal() as session:
|
||||
row = await session.get(Run, run_id)
|
||||
assert row.status == "interrupted" and row.owner is None, "接手之后的样子没被盖掉"
|
||||
|
||||
Reference in New Issue
Block a user