From 3758361d7435e62fbcd0d6b13e2cf4cf809475ff Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 9 Apr 2026 03:49:41 +0000 Subject: [PATCH] fix: address review comments - remove unused import and deduplicate log messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: João --- .../src/crewai/flow/persistence/decorators.py | 18 +++--------------- lib/crewai/tests/test_flow_persistence.py | 1 - 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/crewai/src/crewai/flow/persistence/decorators.py b/lib/crewai/src/crewai/flow/persistence/decorators.py index edc17bef2..c8494a1db 100644 --- a/lib/crewai/src/crewai/flow/persistence/decorators.py +++ b/lib/crewai/src/crewai/flow/persistence/decorators.py @@ -46,8 +46,7 @@ T = TypeVar("T") # Constants for log messages LOG_MESSAGES: Final[dict[str, str]] = { - "save_state": "Saving flow state for ID: {}", - "save_state_location": "Saving flow state for ID: {} (storage: {})", + "save_state": "Saving flow state for ID: {} (storage: {})", "save_error": "Failed to persist state for method {}: {}", "state_missing": "Flow instance has no state", "id_missing": "Flow state must have an 'id' field for persistence", @@ -101,13 +100,6 @@ class PersistenceDecorator: if not flow_uuid: raise ValueError("Flow state must have an 'id' field for persistence") - # Log state saving only if verbose is True - if verbose: - PRINTER.print( - LOG_MESSAGES["save_state"].format(flow_uuid), color="cyan" - ) - logger.info(LOG_MESSAGES["save_state"].format(flow_uuid)) - try: state_data = state._unwrap() if hasattr(state, "_unwrap") else state persistence_instance.save_state( @@ -126,14 +118,10 @@ class PersistenceDecorator: storage_location = getattr( persistence_instance, "db_path", type(persistence_instance).__name__ ) + msg = LOG_MESSAGES["save_state"].format(flow_uuid, storage_location) if verbose: - msg = LOG_MESSAGES["save_state_location"].format( - flow_uuid, storage_location - ) PRINTER.print(msg, color="cyan") - logger.info( - LOG_MESSAGES["save_state_location"].format(flow_uuid, storage_location) - ) + logger.info(msg) except AttributeError as e: error_msg = LOG_MESSAGES["state_missing"] if verbose: diff --git a/lib/crewai/tests/test_flow_persistence.py b/lib/crewai/tests/test_flow_persistence.py index 7a81e9c58..1dd33a86d 100644 --- a/lib/crewai/tests/test_flow_persistence.py +++ b/lib/crewai/tests/test_flow_persistence.py @@ -1,6 +1,5 @@ """Test flow state persistence functionality.""" -import logging import os from typing import Dict, List