JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix: skill自演进后台任务逻辑优化
w1101627533450b1cd25a56
diff --git a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.pyindex 59243730b6..2b71be4631 100644--- a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py+++ b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py@@ -13990,11 +13990,17 @@ class JiuWenSwarmDeepAdapter:build_server_push_message,)- async def _cleanup_evolution_rail() -> None:+ async def _cleanup_evolution_rail(*, cancel: bool = False) -> None:if self._skill_evolution_rail is None:returntry:- await self._skill_evolution_rail.cleanup_background_tasks()+ rail = self._skill_evolution_rail+ if cancel:+ cancel_fn = getattr(rail, "cancel_pending_evolution", None)+ if cancel_fn is not None:+ await cancel_fn()+ return+ await rail.cleanup_background_tasks()except Exception as exc:logger.warning("[JiuWenSwarmDeepAdapter] evolution cleanup failed: request_id=%s "@@ -14036,7 +14042,7 @@ class JiuWenSwarmDeepAdapter:f"{event_timeout_sec:.0f}s without host events")await _push_status("end", "hidden", message)- await _cleanup_evolution_rail()+ await _cleanup_evolution_rail(cancel=True)returnawait asyncio.sleep(TEAM_EVOLUTION_IDLE_SLEEP_SEC)continue@@ -14182,7 +14188,7 @@ class JiuWenSwarmDeepAdapter:returnexcept asyncio.CancelledError:try:- await _cleanup_evolution_rail()+ await _cleanup_evolution_rail(cancel=True)finally:raiseexcept Exception as exc:diff --git a/jiuwenswarm/server/runtime/agent_adapter/team_helpers.py b/jiuwenswarm/server/runtime/agent_adapter/team_helpers.pyindex 0a49769e95..2d96055b49 100644--- a/jiuwenswarm/server/runtime/agent_adapter/team_helpers.py+++ b/jiuwenswarm/server/runtime/agent_adapter/team_helpers.py@@ -2702,11 +2702,18 @@ async def _watch_team_evolution_and_push(fallback_cycle_index = 0active_cycle_request_id: str | None = None- async def _cleanup_evolution_rail() -> None:- cleanup = getattr(rail, "cleanup_background_tasks", None)- if cleanup is None:- return+ async def _cleanup_evolution_rail(*, cancel: bool = True) -> None:try:+ if cancel:+ cancel_fn = getattr(rail, "cancel_pending_evolution", None)+ if cancel_fn is not None:+ result = cancel_fn()+ if asyncio.iscoroutine(result):+ await result+ return+ cleanup = getattr(rail, "cleanup_background_tasks", None)+ if cleanup is None:+ returnresult = cleanup()if asyncio.iscoroutine(result):await result