From f3edebea20671681a2ee8e25a00ba0387207f8c1 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 1 Apr 2026 14:35:20 -0700 Subject: [PATCH] fix: guard lazy executor in test utils + convert delegation logging to permanent debug level Co-Authored-By: Claude Opus 4.5 --- .../src/crewai/tools/agent_tools/base_agent_tools.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/crewai/src/crewai/tools/agent_tools/base_agent_tools.py b/lib/crewai/src/crewai/tools/agent_tools/base_agent_tools.py index 40fdb0f1a..cd3d0d8da 100644 --- a/lib/crewai/src/crewai/tools/agent_tools/base_agent_tools.py +++ b/lib/crewai/src/crewai/tools/agent_tools/base_agent_tools.py @@ -127,18 +127,16 @@ class BaseAgentTool(BaseTool): logger.debug( f"Created task for agent '{self.sanitize_agent_name(selected_agent.role)}': {task}" ) - # DEBUG: Verify parent event ID propagation during delegation parent_id_before = get_current_parent_id() logger.debug( - f"[DELEGATION SCOPE] Before execute_task - parent_event_id: {parent_id_before}, " - f"delegating to agent: {self.sanitize_agent_name(selected_agent.role)}" + f"Delegation starting: parent_event_id={parent_id_before}, " + f"target_agent={self.sanitize_agent_name(selected_agent.role)}" ) result = selected_agent.execute_task(task_with_assigned_agent, context) - # DEBUG: Verify scope chain after delegation completes parent_id_after = get_current_parent_id() logger.debug( - f"[DELEGATION SCOPE] After execute_task - parent_event_id: {parent_id_after}, " - f"delegation complete for agent: {self.sanitize_agent_name(selected_agent.role)}" + f"Delegation complete: parent_event_id={parent_id_after}, " + f"target_agent={self.sanitize_agent_name(selected_agent.role)}" ) return result except Exception as e: