tui: show aggregated output in display (#5539)
This shows the aggregated (stdout + stderr) buffer regardless of exit code. Many commands output useful / relevant info on stdout when returning a non-zero exit code, or the same on stderr when returning an exit code of 0. Often, useful info is present on both stdout AND stderr. Also, the model sees both. So it is confusing to see commands listed as "(no output)" that in fact do have output, just on the stream that doesn't match the exit status, or to see some sort of trivial output like "Tests failed" but lacking any information about the actual failure. As such, always display the aggregated output in the display. Transcript mode remains unchanged as it was already displaying the text that the model sees, which seems correct for transcript mode.
This commit is contained in:
@@ -1293,12 +1293,10 @@ pub(crate) fn new_patch_apply_failure(stderr: String) -> PlainHistoryCell {
|
||||
let output = output_lines(
|
||||
Some(&CommandOutput {
|
||||
exit_code: 1,
|
||||
stdout: String::new(),
|
||||
stderr,
|
||||
formatted_output: String::new(),
|
||||
aggregated_output: stderr,
|
||||
}),
|
||||
OutputLinesParams {
|
||||
only_err: true,
|
||||
include_angle_pipe: true,
|
||||
include_prefix: true,
|
||||
},
|
||||
@@ -1739,16 +1737,7 @@ mod tests {
|
||||
duration: None,
|
||||
});
|
||||
// Mark call complete so markers are ✓
|
||||
cell.complete_call(
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call(&call_id, CommandOutput::default(), Duration::from_millis(1));
|
||||
|
||||
let lines = cell.display_lines(80);
|
||||
let rendered = render_lines(&lines).join("\n");
|
||||
@@ -1770,16 +1759,7 @@ mod tests {
|
||||
duration: None,
|
||||
});
|
||||
// Call 1: Search only
|
||||
cell.complete_call(
|
||||
"c1",
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call("c1", CommandOutput::default(), Duration::from_millis(1));
|
||||
// Call 2: Read A
|
||||
cell = cell
|
||||
.with_added_call(
|
||||
@@ -1792,16 +1772,7 @@ mod tests {
|
||||
}],
|
||||
)
|
||||
.unwrap();
|
||||
cell.complete_call(
|
||||
"c2",
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call("c2", CommandOutput::default(), Duration::from_millis(1));
|
||||
// Call 3: Read B
|
||||
cell = cell
|
||||
.with_added_call(
|
||||
@@ -1814,16 +1785,7 @@ mod tests {
|
||||
}],
|
||||
)
|
||||
.unwrap();
|
||||
cell.complete_call(
|
||||
"c3",
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call("c3", CommandOutput::default(), Duration::from_millis(1));
|
||||
|
||||
let lines = cell.display_lines(80);
|
||||
let rendered = render_lines(&lines).join("\n");
|
||||
@@ -1856,16 +1818,7 @@ mod tests {
|
||||
start_time: Some(Instant::now()),
|
||||
duration: None,
|
||||
});
|
||||
cell.complete_call(
|
||||
"c1",
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call("c1", CommandOutput::default(), Duration::from_millis(1));
|
||||
let lines = cell.display_lines(80);
|
||||
let rendered = render_lines(&lines).join("\n");
|
||||
insta::assert_snapshot!(rendered);
|
||||
@@ -1885,16 +1838,7 @@ mod tests {
|
||||
duration: None,
|
||||
});
|
||||
// Mark call complete so it renders as "Ran"
|
||||
cell.complete_call(
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call(&call_id, CommandOutput::default(), Duration::from_millis(1));
|
||||
|
||||
// Small width to force wrapping on both lines
|
||||
let width: u16 = 28;
|
||||
@@ -1914,16 +1858,7 @@ mod tests {
|
||||
start_time: Some(Instant::now()),
|
||||
duration: None,
|
||||
});
|
||||
cell.complete_call(
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call(&call_id, CommandOutput::default(), Duration::from_millis(1));
|
||||
// Wide enough that it fits inline
|
||||
let lines = cell.display_lines(80);
|
||||
let rendered = render_lines(&lines).join("\n");
|
||||
@@ -1942,16 +1877,7 @@ mod tests {
|
||||
start_time: Some(Instant::now()),
|
||||
duration: None,
|
||||
});
|
||||
cell.complete_call(
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call(&call_id, CommandOutput::default(), Duration::from_millis(1));
|
||||
let lines = cell.display_lines(24);
|
||||
let rendered = render_lines(&lines).join("\n");
|
||||
insta::assert_snapshot!(rendered);
|
||||
@@ -1969,16 +1895,7 @@ mod tests {
|
||||
start_time: Some(Instant::now()),
|
||||
duration: None,
|
||||
});
|
||||
cell.complete_call(
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call(&call_id, CommandOutput::default(), Duration::from_millis(1));
|
||||
let lines = cell.display_lines(80);
|
||||
let rendered = render_lines(&lines).join("\n");
|
||||
insta::assert_snapshot!(rendered);
|
||||
@@ -1997,16 +1914,7 @@ mod tests {
|
||||
start_time: Some(Instant::now()),
|
||||
duration: None,
|
||||
});
|
||||
cell.complete_call(
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 0,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
formatted_output: String::new(),
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
cell.complete_call(&call_id, CommandOutput::default(), Duration::from_millis(1));
|
||||
let lines = cell.display_lines(28);
|
||||
let rendered = render_lines(&lines).join("\n");
|
||||
insta::assert_snapshot!(rendered);
|
||||
@@ -2033,9 +1941,8 @@ mod tests {
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 1,
|
||||
stdout: String::new(),
|
||||
stderr,
|
||||
formatted_output: String::new(),
|
||||
aggregated_output: stderr,
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
@@ -2077,9 +1984,8 @@ mod tests {
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 1,
|
||||
stdout: String::new(),
|
||||
stderr,
|
||||
formatted_output: String::new(),
|
||||
aggregated_output: stderr,
|
||||
},
|
||||
Duration::from_millis(5),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user