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 -1
View File
@@ -19,6 +19,7 @@ from docker.errors import ImageNotFound, NotFound
import docker
from agent_platform.config import Settings
from agent_platform.gateway.schemas import ToolResult, WorkspaceListing, WorkspaceStatus
from agent_platform.text import truncate_middle
def normalize_workspace_path(raw_path: str) -> PurePosixPath:
@@ -208,7 +209,7 @@ class DockerExecutionProvider:
output = ((stdout or b"") + (stderr or b"")).decode("utf-8", errors="replace")
truncated = len(output) > max_output
if truncated:
output = output[:max_output] + "\n… output truncated"
output = truncate_middle(output, max_output, "\n… output truncated; middle omitted …\n")
return ToolResult(
ok=result.exit_code == 0,
output=output,