sync update from LAN repo (source dhk-1 @ 3b1ec5b4)
This commit is contained in:
1 parent
da6521b6cb
commit
264e2200d6
995 files changed
+148105
-13399
No files matched your search
@@ -1648,32 +1648,32 @@ class _FailingCheckpointer:
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_direct_thread_creation_cleans_failed_checkpoint(monkeypatch):
|
||||
async def test_direct_thread_creation_defers_unavailable_checkpoint(monkeypatch):
|
||||
store = _ThreadStoreProbe()
|
||||
checkpointer = _FailingCheckpointer(RuntimeError("checkpoint unavailable"))
|
||||
monkeypatch.setattr(gateway_deps, "get_thread_store", lambda request: store)
|
||||
monkeypatch.setattr(gateway_deps, "get_checkpointer", lambda request: checkpointer)
|
||||
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
await multi_agent._create_thread_direct(
|
||||
SimpleNamespace(),
|
||||
metadata={"thread_type": "roundtable"},
|
||||
)
|
||||
thread_id = await multi_agent._create_thread_direct(
|
||||
SimpleNamespace(), metadata={"thread_type": "roundtable"},
|
||||
)
|
||||
|
||||
assert exc_info.value.status_code == 500
|
||||
assert len(store.created) == 1
|
||||
thread_id, create_kwargs = store.created[0]
|
||||
created_id, create_kwargs = store.created[0]
|
||||
assert created_id == thread_id
|
||||
assert create_kwargs["metadata"] == {"thread_type": "roundtable"}
|
||||
assert store.deleted == [thread_id]
|
||||
assert checkpointer.deleted == [thread_id]
|
||||
assert store.deleted == []
|
||||
assert checkpointer.deleted == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_direct_thread_creation_cleans_metadata_when_cancelled(monkeypatch):
|
||||
async def test_direct_thread_creation_propagates_metadata_cancellation(monkeypatch):
|
||||
store = _ThreadStoreProbe()
|
||||
checkpointer = _FailingCheckpointer(asyncio.CancelledError())
|
||||
async def cancelled_create(*args, **kwargs):
|
||||
raise asyncio.CancelledError()
|
||||
|
||||
monkeypatch.setattr(store, "create", cancelled_create)
|
||||
monkeypatch.setattr(gateway_deps, "get_thread_store", lambda request: store)
|
||||
monkeypatch.setattr(gateway_deps, "get_checkpointer", lambda request: checkpointer)
|
||||
|
||||
with pytest.raises(asyncio.CancelledError):
|
||||
await multi_agent._create_thread_direct(
|
||||
@@ -1681,6 +1681,4 @@ async def test_direct_thread_creation_cleans_metadata_when_cancelled(monkeypatch
|
||||
metadata={"thread_type": "roundtable"},
|
||||
)
|
||||
|
||||
thread_id, _ = store.created[0]
|
||||
assert store.deleted == [thread_id]
|
||||
assert checkpointer.deleted == [thread_id]
|
||||
assert store.created == []
|
||||
Reference in new issue
Block a user