Fix compact tool failure display to use single-line format
When compact tools (read_file, write_file, str_replace, etc.) failed,
they would fall through to the non-compact output path, causing:
- Missing or incorrect headers
- Stray footers with wrong formatting
- State leakage (is_shell_compact) between tool calls
Now failed compact tools display in the same single-line format as
successful ones, just with a truncated error message instead of the
success summary:
● read_file | path/to/file.txt | ❌ Failed to read file... | 123 ◉ 0ms
This keeps the UI consistent and avoids the "stray footer" bug.
This commit is contained in:
@@ -2194,7 +2194,12 @@ impl<W: UiWriter> Agent<W> {
|
||||
let is_todo_tool =
|
||||
tool_call.tool == "todo_read" || tool_call.tool == "todo_write";
|
||||
|
||||
if is_compact_tool && tool_success {
|
||||
if is_compact_tool {
|
||||
// For failed compact tools, show truncated error message
|
||||
if !tool_success {
|
||||
let error_msg = streaming::truncate_for_display(&tool_result, 60);
|
||||
Some(error_msg)
|
||||
} else {
|
||||
// Generate appropriate summary based on tool type
|
||||
match tool_call.tool.as_str() {
|
||||
"read_file" => Some(streaming::format_read_file_summary(output_len, tool_result.len())),
|
||||
@@ -2227,6 +2232,7 @@ impl<W: UiWriter> Agent<W> {
|
||||
}
|
||||
_ => Some(format!("✅ completed"))
|
||||
}
|
||||
}
|
||||
} else if is_todo_tool {
|
||||
// Skip - todo tools print their own content
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user