Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Use neutral labels for nonzero exits in compact TUI output (#54433)

Benjamin Carlsson98fd26206d96
diff --git a/codex-rs/tui/src/chatwidget/tests/snapshots/codex_tui__chatwidget__tests__exec_flow__compact_exploration_with_failures.snap b/codex-rs/tui/src/chatwidget/tests/snapshots/codex_tui__chatwidget__tests__exec_flow__compact_exploration_with_failures.snap
index ced32ee62f..0839335711 100644
--- a/codex-rs/tui/src/chatwidget/tests/snapshots/codex_tui__chatwidget__tests__exec_flow__compact_exploration_with_failures.snap
+++ b/codex-rs/tui/src/chatwidget/tests/snapshots/codex_tui__chatwidget__tests__exec_flow__compact_exploration_with_failures.snap
@@ -3,7 +3,7 @@ source: tui/src/chatwidget/tests/exec_flow.rs
assertion_line: 175
expression: "chat.transcript.active_cell.as_ref().unwrap().compact_hyperlink_lines(24).iter().map(|line|\nline.line.to_string()).collect::<Vec<_>>().join(\"\\n\")"
---
-• Explored · 4 failed
+• Explored · 4 nonzero …
└ Read first.txt
Read missing.txt (e…
1)
diff --git a/codex-rs/tui/src/exec_cell/compact.rs b/codex-rs/tui/src/exec_cell/compact.rs
index f8fe1bb9df..c4dcf63c33 100644
--- a/codex-rs/tui/src/exec_cell/compact.rs
+++ b/codex-rs/tui/src/exec_cell/compact.rs
@@ -77,9 +77,9 @@ impl ExecCell {
{
return Vec::new();
}
- let failed = call.output.as_ref().filter(|output| output.exit_code != 0);
- let marker = if failed.is_some() {
- "•".red().bold()
+ let nonzero_exit = call.output.as_ref().filter(|output| output.exit_code != 0);
+ let marker = if nonzero_exit.is_some() {
+ "•".bold()
} else if self.is_active() {
activity_indicator(
call.start_time,
@@ -90,8 +90,8 @@ impl ExecCell {
} else {
"•".green().bold()
};
- let title = if let Some(output) = failed {
- format!("Failed (exit {})", output.exit_code)
+ let title = if let Some(output) = nonzero_exit {
+ format!("Exited (status {})", output.exit_code)
} else if self.is_active() {
"Running".to_owned()
} else if call.is_unified_exec_interaction() {
diff --git a/codex-rs/tui/src/exec_cell/render.rs b/codex-rs/tui/src/exec_cell/render.rs
index bae014ea15..22a0ea7d32 100644
--- a/codex-rs/tui/src/exec_cell/render.rs
+++ b/codex-rs/tui/src/exec_cell/render.rs
@@ -241,7 +241,7 @@ impl HistoryCell for ExecCell {
if self.is_exploring_cell() {
let mut lines = self.exploring_display_lines(width);
lines.truncate(1 + crate::history_cell::activity_preview::DETAIL_PREVIEW_LINES);
- let failures = self
+ let nonzero_exits = self
.group
.calls
.iter()
@@ -251,12 +251,17 @@ impl HistoryCell for ExecCell {
.is_some_and(|output| output.exit_code != 0)
})
.count();
- if failures > 0
+ if nonzero_exits > 0
&& let Some(header) = lines.first_mut()
{
+ let exit_label = if nonzero_exits == 1 {
+ "nonzero exit"
+ } else {
+ "nonzero exits"
+ };
header
.line
- .push_span(format!(" · {failures} failed").red().bold());
+ .push_span(format!(" · {nonzero_exits} {exit_label}").bold());
}
lines
.into_iter()
diff --git a/codex-rs/tui/src/exec_cell/snapshots/codex_tui__exec_cell__render__tests__truncated_live_output_preview_and_transcript.snap b/codex-rs/tui/src/exec_cell/snapshots/codex_tui__exec_cell__render__tests__truncated_live_output_preview_and_transcript.snap
index bc536ac0d3..443fe2a85e 100644
--- a/codex-rs/tui/src/exec_cell/snapshots/codex_tui__exec_cell__render__tests__truncated_live_output_preview_and_transcript.snap
+++ b/codex-rs/tui/src/exec_cell/snapshots/codex_tui__exec_cell__render__tests__truncated_live_output_preview_and_transcript.snap
@@ -26,9 +26,9 @@ expression: "(preview, compact, transcript)"
],
[
Line::from_iter([
- Span::from("•").red().bold(),
+ Span::from("•").bold(),
Span::from(" "),
- Span::from("Failed (exit 1)").bold(),
+ Span::from("Exited (status 1)").bold(),
Span::from(" "),
Span::from("echo").fg(Color::Rgb(137, 180, 250)),
Span::from(" output").fg(Color::Rgb(205, 214, 244)),