fix: handle None value for a2a_task_ids_by_endpoint in config

Address Bugbot feedback - handle case where a2a_task_ids_by_endpoint
is explicitly set to None (e.g., from JSON/YAML config) to avoid
TypeError when calling dict() on None.

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2026-01-01 08:17:38 +00:00
parent f171805092
commit 4f13153483

View File

@@ -538,8 +538,10 @@ def _delegate_to_a2a(
# This fixes the issue where delegating to a second A2A agent fails because the task_id
# from the first agent is in "completed" state
# Make a defensive copy to avoid in-place mutation of task.config
a2a_task_ids_by_endpoint: dict[str, str] = dict(
task_config.get("a2a_task_ids_by_endpoint", {})
# Handle case where value is explicitly None (e.g., from JSON/YAML config)
existing_task_ids = task_config.get("a2a_task_ids_by_endpoint")
a2a_task_ids_by_endpoint: dict[str, str] = (
dict(existing_task_ids) if existing_task_ids else {}
)
task_id_config = a2a_task_ids_by_endpoint.get(agent_id)