mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Track TUI command completion separately from output (#34218)
## Why App-server command output deltas populate an exec cell before the command finishes. Treating the presence of output as completion can therefore mark a streaming command inactive too early and mishandle it when the turn is interrupted. ## What changed - Use the recorded duration, which is set when a command ends, as the exec call's completion marker. - Preserve streamed output when marking unfinished calls as failed and render status lines only after completion. - Keep a single aggregated output representation and render truncated output without collecting every line first. - Append grouped exploration calls in place and coalesce adjacent reads while rendering without cloning the calls. ## Testing - Add snapshots covering active streamed output, transcript output, and the resulting history entry after interruption. - Add coverage for truncating newline-dense output. GitOrigin-RevId: 420ac1e5fe1b9fcdbdaa5a8998f3e43a5b720254
This commit is contained in:
1 parent
74bfbda9b5
commit
854a82dbfd
10 files changed
+179
-109
No files matched your search
@@ -45,7 +45,6 @@ pub(crate) fn new_patch_apply_failure(stderr: String) -> PlainHistoryCell {
|
||||
let output = output_lines(
|
||||
Some(&CommandOutput {
|
||||
exit_code: 1,
|
||||
formatted_output: String::new(),
|
||||
aggregated_output: stderr,
|
||||
}),
|
||||
OutputLinesParams {
|
||||
|
||||
@@ -1699,34 +1699,30 @@ fn coalesces_reads_across_multiple_calls() {
|
||||
// Call 1: Search only
|
||||
cell.complete_call("c1", CommandOutput::default(), Duration::from_millis(1));
|
||||
// Call 2: Read A
|
||||
cell = cell
|
||||
.with_added_call(
|
||||
"c2".into(),
|
||||
vec!["bash".into(), "-lc".into(), "echo".into()],
|
||||
vec![ParsedCommand::Read {
|
||||
name: "shimmer.rs".into(),
|
||||
cmd: "cat shimmer.rs".into(),
|
||||
path: "shimmer.rs".into(),
|
||||
}],
|
||||
ExecCommandSource::Agent,
|
||||
/*interaction_input*/ None,
|
||||
)
|
||||
.unwrap();
|
||||
assert!(cell.add_call(
|
||||
"c2".into(),
|
||||
vec!["bash".into(), "-lc".into(), "echo".into()],
|
||||
vec![ParsedCommand::Read {
|
||||
name: "shimmer.rs".into(),
|
||||
cmd: "cat shimmer.rs".into(),
|
||||
path: "shimmer.rs".into(),
|
||||
}],
|
||||
ExecCommandSource::Agent,
|
||||
/*interaction_input*/ None,
|
||||
));
|
||||
cell.complete_call("c2", CommandOutput::default(), Duration::from_millis(1));
|
||||
// Call 3: Read B
|
||||
cell = cell
|
||||
.with_added_call(
|
||||
"c3".into(),
|
||||
vec!["bash".into(), "-lc".into(), "echo".into()],
|
||||
vec![ParsedCommand::Read {
|
||||
name: "status_indicator_widget.rs".into(),
|
||||
cmd: "cat status_indicator_widget.rs".into(),
|
||||
path: "status_indicator_widget.rs".into(),
|
||||
}],
|
||||
ExecCommandSource::Agent,
|
||||
/*interaction_input*/ None,
|
||||
)
|
||||
.unwrap();
|
||||
assert!(cell.add_call(
|
||||
"c3".into(),
|
||||
vec!["bash".into(), "-lc".into(), "echo".into()],
|
||||
vec![ParsedCommand::Read {
|
||||
name: "status_indicator_widget.rs".into(),
|
||||
cmd: "cat status_indicator_widget.rs".into(),
|
||||
path: "status_indicator_widget.rs".into(),
|
||||
}],
|
||||
ExecCommandSource::Agent,
|
||||
/*interaction_input*/ None,
|
||||
));
|
||||
cell.complete_call("c3", CommandOutput::default(), Duration::from_millis(1));
|
||||
|
||||
let lines = cell.display_lines(/*width*/ 80);
|
||||
@@ -1918,7 +1914,6 @@ fn stderr_tail_more_than_five_lines_snapshot() {
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 1,
|
||||
formatted_output: String::new(),
|
||||
aggregated_output: stderr,
|
||||
},
|
||||
Duration::from_millis(1),
|
||||
@@ -1966,7 +1961,6 @@ fn ran_cell_multiline_with_stderr_snapshot() {
|
||||
&call_id,
|
||||
CommandOutput {
|
||||
exit_code: 1,
|
||||
formatted_output: String::new(),
|
||||
aggregated_output: stderr,
|
||||
},
|
||||
Duration::from_millis(5),
|
||||
|
||||
Reference in new issue
Block a user