From 420c8cd2d39025e4c214fe668d6cdb81e552a66a Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Fri, 19 Jun 2026 10:27:18 +0200 Subject: [PATCH] docs(vector): correct _drive_local_coroutine suspension-guard comment (#926) The prior comment claimed anyio.lowlevel.checkpoint() yields None and is re-driven, but checkpoint() yields a non-None backend object (asyncio Future / trio checkpoint) and so trips the RuntimeError guard. Clarify that only a literal bare yield/yield None is re-driven; any real awaitable is caught by the non-None guard. Comment-only; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) --- nextcloud_mcp_server/vector/qdrant_client.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/nextcloud_mcp_server/vector/qdrant_client.py b/nextcloud_mcp_server/vector/qdrant_client.py index 29e760d3..00112fe9 100644 --- a/nextcloud_mcp_server/vector/qdrant_client.py +++ b/nextcloud_mcp_server/vector/qdrant_client.py @@ -126,14 +126,15 @@ def _drive_local_coroutine(coro: Coroutine[Any, Any, Any]) -> Any: thread dispatched by :func:`anyio.to_thread.run_sync` — is what moves that CPU work off the event loop. - A genuine suspension (a non-``None`` yield) would mean the backend started - doing real async I/O, which a plain thread cannot drive correctly. Fail - loudly in that case rather than spin or silently mis-drive the coroutine. - A bare ``yield None`` (e.g. a hand-inserted ``anyio.lowlevel.checkpoint()``) - is deliberately treated as a non-suspension and re-driven — consistent with - the local backend being purely synchronous. If a qdrant adapter ever starts - inserting real checkpoints, prefer wrapping it in network mode over relaxing - this guard. + A genuine suspension would mean the backend started doing real async I/O, + which a plain thread cannot drive correctly. Any real awaitable yields a + non-``None`` object (an asyncio ``Future`` / a trio checkpoint), so the + ``yielded is not None`` guard catches it and fails loudly rather than + spinning or silently mis-driving the coroutine. Only a literal bare + ``yield`` / ``yield None`` is treated as a non-suspension and re-driven — + consistent with the local backend being purely synchronous. If a qdrant + adapter ever starts inserting real checkpoints, prefer wrapping it in + network mode over relaxing this guard. """ try: while True: