DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
test: wait for persisted cancellation done event
Bingxi Zhao (Frank)f2b433adb8f2
diff --git a/tests/app/test_multiworker_turn_reply_after_queue_drop.py b/tests/app/test_multiworker_turn_reply_after_queue_drop.pyindex 21be52735..0537dd451 100644--- a/tests/app/test_multiworker_turn_reply_after_queue_drop.py+++ b/tests/app/test_multiworker_turn_reply_after_queue_drop.py@@ -9,6 +9,7 @@ import pytestfrom deeptutor.app.service import TurnApplicationServicefrom deeptutor.core.stream import StreamEvent, StreamEventTypefrom deeptutor.runtime.coordination import MemoryCoordinator+from deeptutor.services.path_service import PathServicefrom deeptutor.services.session.sqlite_store import SQLiteSessionStorefrom deeptutor.services.session.turn_runtime import TurnRuntimeManager@@ -50,6 +51,13 @@ def _payload() -> dict:@pytest.fixture(autouse=True)def _workspace_root(tmp_path, monkeypatch: pytest.MonkeyPatch):"""Keep the runtime workspace binding local to the test process."""+ paths = PathService(workspace_root=tmp_path / "data")+ paths.ensure_all_directories()+ monkeypatch.setattr("deeptutor.multi_user.paths.get_account_path_service", lambda: paths)+ monkeypatch.setattr("deeptutor.services.workspace.service.get_path_service", lambda: paths)+ monkeypatch.setattr(+ "deeptutor.services.workspace.data_migration.get_account_path_service", lambda: paths+ )root = tmp_path / "workspace"root.mkdir()monkeypatch.setenv("DEEPTUTOR_WORKSPACE_ROOT", str(root))@@ -125,9 +133,17 @@ async def test_reply_accepted_after_local_queue_dropped_is_never_delivered(assert persisted is not Noneassert persisted["status"] == "cancelled"- events = await store_b.get_turn_events(turn["id"])+ # The status transition precedes publishing and persisting DONE. Wait for+ # the event itself before asserting the complete terminal stream.+ for _ in range(100):+ events = await store_b.get_turn_events(turn["id"])+ if events and events[-1]["type"] == "done":+ break+ await asyncio.sleep(0.02)event_types = [event["type"] for event in events]assert "error" in event_types+ assert event_types.count("done") == 1+ assert event_types.index("error") < event_types.index("done")assert event_types[-1] == "done"_fresh_session, following = await app_b.start_turn(_payload())