Merge pull request #2091 from Molecule-AI/fix/bare-except-a2a-executor-1787

fix(a2a): document the metadata-attach except-pass in a2a_executor (closes #1787)
This commit is contained in:
Hongming Wang 2026-04-26 12:25:07 +00:00 committed by GitHub
commit dff14c010e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -422,7 +422,14 @@ class LangGraphA2AExecutor(AgentExecutor):
try:
msg.metadata = {"tool_trace": tool_trace}
except (AttributeError, TypeError):
pass
# `new_agent_text_message()` returns a plain string in
# MagicMock paths in tests, where assignment to
# .metadata raises despite hasattr being true (the
# mock has the attribute as a property). Suppression
# is intentional — production Message objects always
# accept the assignment. See #1787 + commit dcbcf19
# for the original test-mock motivation.
logger.debug("metadata attach skipped (non-Message return from new_agent_text_message)")
await event_queue.enqueue_event(msg)
_result = final_text