diff --git a/src/daemon/spawner.py b/src/daemon/spawner.py index 68868f8..2942edb 100644 --- a/src/daemon/spawner.py +++ b/src/daemon/spawner.py @@ -338,7 +338,10 @@ curl -X POST http://{self.api_host}:{self.api_port}/api/projects/{project_id}/ta # 完成回调(释放 counter 等) if on_complete: try: - await on_complete(agent_id, outcome) + result = on_complete(agent_id, outcome) + import asyncio + if asyncio.iscoroutine(result): + await result except Exception: logger.warning("on_complete callback failed for %s", agent_id, exc_info=True)