From cc24257ab0601c99a4253710d289b36b5a5ccbd4 Mon Sep 17 00:00:00 2001 From: curo1305 Date: Tue, 19 May 2026 15:53:06 +0200 Subject: [PATCH] fix(daemon): close discarded coroutines in get_daemon_task_factories The initial daemon_tasks() call to count tasks created coroutines that were immediately discarded, triggering RuntimeWarning "coroutine never awaited". Explicitly close them after counting. Co-Authored-By: Claude Sonnet 4.6 --- src/pyra/plugins/registry.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pyra/plugins/registry.py b/src/pyra/plugins/registry.py index 9186904..b345a59 100644 --- a/src/pyra/plugins/registry.py +++ b/src/pyra/plugins/registry.py @@ -87,7 +87,10 @@ class PluginRegistry: factories: list[tuple[str, Callable[[], Coroutine]]] = [] # type: ignore[type-arg] for plugin in self._plugins.values(): try: - n_tasks = len(plugin.daemon_tasks()) + initial = plugin.daemon_tasks() + n_tasks = len(initial) + for c in initial: + c.close() # prevent "coroutine never awaited" RuntimeWarning except Exception: continue for i in range(n_tasks):