diff --git a/.beads/daemon.lock b/.beads/daemon.lock new file mode 100644 index 00000000..a7e761ef --- /dev/null +++ b/.beads/daemon.lock @@ -0,0 +1 @@ +92502 diff --git a/integrations/beads-mcp/src/beads_mcp/bd_daemon_client.py b/integrations/beads-mcp/src/beads_mcp/bd_daemon_client.py index 03f3a004..e69b5a8b 100644 --- a/integrations/beads-mcp/src/beads_mcp/bd_daemon_client.py +++ b/integrations/beads-mcp/src/beads_mcp/bd_daemon_client.py @@ -431,7 +431,7 @@ class BdDaemonClient(BdClientBase): except (DaemonNotRunningError, DaemonConnectionError, DaemonError): return False - def close(self) -> None: + def cleanup(self) -> None: """Close daemon client connections and cleanup resources. This is called during MCP server shutdown to ensure clean termination. diff --git a/integrations/beads-mcp/src/beads_mcp/server.py b/integrations/beads-mcp/src/beads_mcp/server.py index 9ca28d1f..1a246db7 100644 --- a/integrations/beads-mcp/src/beads_mcp/server.py +++ b/integrations/beads-mcp/src/beads_mcp/server.py @@ -70,8 +70,8 @@ def cleanup() -> None: # Close all daemon client connections for client in _daemon_clients: try: - if hasattr(client, 'close'): - client.close() + if hasattr(client, 'cleanup'): + client.cleanup() logger.debug(f"Closed daemon client: {client}") except Exception as e: logger.warning(f"Error closing daemon client: {e}") diff --git a/integrations/beads-mcp/tests/test_lifecycle.py b/integrations/beads-mcp/tests/test_lifecycle.py index d6c3cc08..a2f7c125 100644 --- a/integrations/beads-mcp/tests/test_lifecycle.py +++ b/integrations/beads-mcp/tests/test_lifecycle.py @@ -40,8 +40,8 @@ def test_cleanup_function_safe_to_call_multiple_times(): cleanup() cleanup() - # Client should only be closed once - assert mock_client.close.call_count == 1 + # Client should only be cleaned up once + assert mock_client.cleanup.call_count == 1 assert len(_daemon_clients) == 0 @@ -55,7 +55,7 @@ def test_cleanup_handles_client_errors_gracefully(): # Create mock clients - one that raises, one that doesn't failing_client = MagicMock() - failing_client.close.side_effect = Exception("Connection failed") + failing_client.cleanup.side_effect = Exception("Connection failed") good_client = MagicMock() @@ -66,8 +66,8 @@ def test_cleanup_handles_client_errors_gracefully(): cleanup() # Both clients should have been attempted - assert failing_client.close.called - assert good_client.close.called + assert failing_client.cleanup.called + assert good_client.cleanup.called assert len(_daemon_clients) == 0