From f30effaadd1c6209301b82df2fff63b37acb696d Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 8 Mar 2026 22:12:54 -0400 Subject: [PATCH] Truncate stage failure error display to last line in `arc run` output The full failure message (including entire stdout/stderr) was shown inline, making terminal output very noisy. Now only the last non-empty line is displayed, truncated to 120 chars. The full error remains in the log file. Co-Authored-By: Claude Opus 4.6 --- crates/arc-workflows/src/cli/progress.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/arc-workflows/src/cli/progress.rs b/crates/arc-workflows/src/cli/progress.rs index 0b03e1ebf..0d4a9d0a8 100644 --- a/crates/arc-workflows/src/cli/progress.rs +++ b/crates/arc-workflows/src/cli/progress.rs @@ -102,6 +102,23 @@ fn truncate(s: &str, max: usize) -> String { } } +fn last_line_truncated(s: &str, max: usize) -> String { + let line = s + .trim() + .lines() + .filter(|l| !l.trim().is_empty()) + .next_back() + .unwrap_or("") + .trim(); + if line.len() > max { + let mut t: String = line.chars().take(max - 3).collect(); + t.push_str("..."); + t + } else { + line.to_string() + } +} + fn shorten_path(path: &str) -> String { if let Ok(cwd) = std::env::current_dir() { if let Ok(rel) = std::path::Path::new(path).strip_prefix(&cwd) { @@ -338,7 +355,8 @@ impl ProgressUI { } => { self.finish_stage(node_id, name, red_cross(), ""); let red = Style::new().red(); - self.insert_info_line(&format!("{} {}", red.apply_to("Error:"), failure.message,)); + let summary = last_line_truncated(&failure.message, 120); + self.insert_info_line(&format!("{} {}", red.apply_to("Error:"), summary)); } WorkflowRunEvent::ParallelStarted { .. } => { // The fork stage is the (only) active stage at this point.