fix(builtin_tools): remove duplicate unreachable error-handling block

Issue #350: staging commit bea89ce4 inserted a correct error-handling
block for string-form errors but left the pre-existing block after
the return, creating unreachable dead code. Fix: keep only the first
block (which includes the explanatory comment added in PR #367).

Main already has the correct single-block version. This change
aligns staging's builtin_tools/a2a_tools.py with main.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Molecule AI · infra-runtime-be 2026-05-11 06:31:32 +00:00
parent b1e42ac1da
commit 449614a764

View File

@ -87,14 +87,6 @@ async def delegate_task(workspace_id: str, task: str) -> str:
else:
msg = str(err)
return f"Error: {msg}"
msg = ""
if isinstance(err, dict):
msg = err.get("message", "")
elif isinstance(err, str):
msg = err
else:
msg = str(err)
return f"Error: {msg}"
return str(data)
except Exception as e:
return f"Error sending A2A message: {e}"