From 8fe47bd9991752aba7ab85723fe724f52413c20e Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Mon, 16 Feb 2026 16:49:45 +0100 Subject: [PATCH] add workspace storage shutdown to `CoPilotExecutor.cleanup()` --- .../backend/backend/copilot/executor/manager.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/autogpt_platform/backend/backend/copilot/executor/manager.py b/autogpt_platform/backend/backend/copilot/executor/manager.py index f67e339627..7d9943cc15 100644 --- a/autogpt_platform/backend/backend/copilot/executor/manager.py +++ b/autogpt_platform/backend/backend/copilot/executor/manager.py @@ -4,6 +4,7 @@ This module contains the CoPilotExecutor class that consumes chat tasks from RabbitMQ and processes them using a thread pool, following the graph executor pattern. """ +import asyncio import logging import os import threading @@ -168,6 +169,16 @@ class CoPilotExecutor(AppProcess): logger.info(f"[cleanup {pid}] Shutting down executor...") self._executor.shutdown(wait=False) + # Close async resources (workspace storage aiohttp session, etc.) + try: + from backend.util.workspace_storage import shutdown_workspace_storage + + loop = asyncio.new_event_loop() + loop.run_until_complete(shutdown_workspace_storage()) + loop.close() + except Exception as e: + logger.warning(f"[cleanup {pid}] Error closing workspace storage: {e}") + # Release any remaining locks for task_id, lock in list(self._task_locks.items()): try: