From 6a9340d40abc6582497a3eb8da6c78eba5b4e66e Mon Sep 17 00:00:00 2001 From: webtecnica <75556242+webtecnica@users.noreply.github.com> Date: Wed, 22 Jul 2026 12:40:16 -0300 Subject: [PATCH] fix(agent): mark tool failures in the activity log (#69131) The last_activity field showed 'tool completed: read_file (120.7s)' identically whether the tool succeeded or failed, making post-mortem analysis of silent-hang reports (#69131) unnecessarily hard. Append ' (error)' to the activity description when the tool result is classified as a failure, in both the concurrent and sequential execution paths. (Salvaged from PR #69467; its conversation_loop.py activity-touch hunk is the same fix as PR #69577 and lands in the preceding commit.) --- agent/tool_executor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agent/tool_executor.py b/agent/tool_executor.py index d235de36c03d..a5729a2e8f50 100644 --- a/agent/tool_executor.py +++ b/agent/tool_executor.py @@ -964,7 +964,8 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe print(f" ✅ Tool {i+1} completed in {tool_duration:.2f}s - {response_preview}") agent._current_tool = None - agent._touch_activity(f"tool completed: {name} ({tool_duration:.1f}s)") + _status_suffix = " (error)" if is_error else "" + agent._touch_activity(f"tool completed: {name} ({tool_duration:.1f}s){_status_suffix}") if not blocked and agent.tool_complete_callback: try: @@ -1655,7 +1656,8 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe logging.debug(f"Tool progress callback error: {cb_err}") agent._current_tool = None - agent._touch_activity(f"tool completed: {function_name} ({tool_duration:.1f}s)") + _status_suffix = " (error)" if _is_error_result else "" + agent._touch_activity(f"tool completed: {function_name} ({tool_duration:.1f}s){_status_suffix}") if agent.verbose_logging: logging.debug(f"Tool {function_name} completed in {tool_duration:.2f}s")