fix: preserve tool failures under noisy output

This commit is contained in:
wuyang
2026-07-26 16:14:26 +08:00
parent af141845ed
commit 87689931b5
6 changed files with 110 additions and 4 deletions
+2 -3
View File
@@ -10,6 +10,7 @@ from agent_platform.auth import UserIdentity
from agent_platform.config import Settings
from agent_platform.runtime.schemas import PlanItem
from agent_platform.store import RuntimeStore
from agent_platform.text import truncate_middle
@dataclass(frozen=True, slots=True)
@@ -337,6 +338,4 @@ class ToolRegistry:
def tool_result_text(result: Any, limit: int) -> str:
text = json.dumps(result, ensure_ascii=False, separators=(",", ":"), default=str)
if len(text) <= limit:
return text
return text[:limit] + ""
return truncate_middle(text, limit)