From 6f3530544ded915643be9f700dfd5f6d39c123c5 Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Mon, 12 Jan 2026 20:02:08 +0530 Subject: [PATCH] Fix compact tool failure display to use single-line format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- crates/g3-core/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/g3-core/src/lib.rs b/crates/g3-core/src/lib.rs index c9c94a9..1615211 100644 --- a/crates/g3-core/src/lib.rs +++ b/crates/g3-core/src/lib.rs @@ -2194,7 +2194,12 @@ impl Agent { 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 Agent { } _ => Some(format!("✅ completed")) } + } } else if is_todo_tool { // Skip - todo tools print their own content None