ZIm/crates/assistant_tools/src
Mani Rash Ahmadi 68e0105627
Agent: Include partial output if terminal tool fails (#29115)
This PR addresses the behavior of the agent's terminal tool when the
executed command is interrupted or fails after producing some output.
Currently, if the command doesn't finish successfully, any partial
output captured before the interruption/failure is discarded, and only
an error message (or a generic cancellation message) is returned to the
LLM.

This change modifies the `run_command_limited` function in the terminal
tool to catch errors when awaiting the command's status (which includes
interruptions). In the case of such an error, it now includes any
partial stdout/stderr captured up to that point within the error message
returned to the `ToolUseState`. This ensures the LLM receives the
partial context even when the command doesn't complete cleanly, framed
appropriately as part of an error/interruption message.

Closes #29101

Release Notes:

- N/A
2025-04-28 12:25:11 -03:00
..
batch_tool Add Batch tool call for calling multiple tools (#27621) 2025-03-27 18:21:26 -04:00
code_action_tool Add code action tool and rename tool (#28453) 2025-04-09 22:38:01 -04:00
code_symbols_tool Add Code Symbols tool (#27733) 2025-03-31 05:13:13 +00:00
contents_tool Add contents_tool (#28738) 2025-04-15 00:54:25 -04:00
copy_path_tool Add copy-path tool (#27371) 2025-03-24 21:21:55 -04:00
create_directory_tool Add Create Directory Tool (#27505) 2025-03-26 11:59:03 -04:00
create_file_tool Add create-file-tool (#27381) 2025-03-25 10:56:41 -04:00
delete_path_tool Delete tool uses paths instead of globs (#26715) 2025-03-16 11:58:25 +01:00
diagnostics_tool Systematically optimize agentic editing performance (#28961) 2025-04-19 02:47:59 +00:00
edit_file_tool Systematically optimize agentic editing performance (#28961) 2025-04-19 02:47:59 +00:00
fetch_tool assistant_tools: Add fetch tool (#26999) 2025-03-18 16:25:51 +00:00
find_path_tool agent: Improve initial file search quality (#29317) 2025-04-23 21:24:41 -03:00
find_replace_tool Add code action tool and rename tool (#28453) 2025-04-09 22:38:01 -04:00
grep_tool Rename regex search tool to grep and accept an include glob pattern (#29100) 2025-04-20 00:53:30 +00:00
list_directory_tool agent: Improve initial file search quality (#29317) 2025-04-23 21:24:41 -03:00
move_path_tool Add move_path tool (#27366) 2025-03-24 14:45:19 +00:00
open_tool Add Open Tool (#27499) 2025-03-27 18:20:59 -04:00
read_file_tool Systematically optimize agentic editing performance (#28961) 2025-04-19 02:47:59 +00:00
rename_tool Add code action tool and rename tool (#28453) 2025-04-09 22:38:01 -04:00
symbol_info_tool Add symbol info tool (#27742) 2025-03-31 00:23:03 -04:00
terminal_tool agent: Use current shell (#28470) 2025-04-09 23:38:36 -06:00
thinking_tool Add thinking tool (#26675) 2025-03-14 16:26:22 -04:00
ui agent: Render path search results with ToolCard (#28894) 2025-04-25 14:42:51 -03:00
assistant_tools.rs Remove unnecessary fields from the tool schemas (#29381) 2025-04-24 18:09:25 -07:00
batch_tool.rs agent: Improve initial file search quality (#29317) 2025-04-23 21:24:41 -03:00
code_action_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
code_symbols_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
contents_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
copy_path_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
create_directory_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
create_file_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
delete_path_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
diagnostics_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
edit_file_tool.rs agent: Encourage model to include displayed fields first (#29308) 2025-04-23 20:16:15 -03:00
fetch_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
find_path_tool.rs agent: Render path search results with ToolCard (#28894) 2025-04-25 14:42:51 -03:00
grep_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
list_directory_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
move_path_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
now_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
open_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
read_file_tool.rs agent tools: Make read_file.end_line inclusive (#29524) 2025-04-28 09:37:13 +00:00
rename_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
replace.rs edit tool: Handle over-indentation in replace_with_flexible_indent (#29153) 2025-04-21 11:02:08 -03:00
schema.rs agent: Improve compatibility when using MCP servers with Gemini models (#28700) 2025-04-14 21:55:25 +02:00
symbol_info_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
terminal_tool.rs Agent: Include partial output if terminal tool fails (#29115) 2025-04-28 12:25:11 -03:00
thinking_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
ui.rs agent: Refine the web search tool call UI (#29190) 2025-04-22 09:51:57 -03:00
web_search_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00