chore: rework unified exec events (#7775)

This commit is contained in:
jif-oai
2025-12-10 10:30:38 +00:00
committed by GitHub
parent d1c5db5796
commit 0ad54982ae
20 changed files with 876 additions and 174 deletions

View File

@@ -1175,6 +1175,49 @@ fn exec_history_cell_shows_working_then_failed() {
assert!(blob.to_lowercase().contains("bloop"), "expected error text");
}
#[test]
fn exec_end_without_begin_uses_event_command() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None);
let command = vec![
"bash".to_string(),
"-lc".to_string(),
"echo orphaned".to_string(),
];
let parsed_cmd = codex_core::parse_command::parse_command(&command);
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
chat.handle_codex_event(Event {
id: "call-orphan".to_string(),
msg: EventMsg::ExecCommandEnd(ExecCommandEndEvent {
call_id: "call-orphan".to_string(),
process_id: None,
turn_id: "turn-1".to_string(),
command,
cwd,
parsed_cmd,
source: ExecCommandSource::Agent,
interaction_input: None,
stdout: "done".to_string(),
stderr: String::new(),
aggregated_output: "done".to_string(),
exit_code: 0,
duration: std::time::Duration::from_millis(5),
formatted_output: "done".to_string(),
}),
});
let cells = drain_insert_history(&mut rx);
assert_eq!(cells.len(), 1, "expected finalized exec cell to flush");
let blob = lines_to_single_string(&cells[0]);
assert!(
blob.contains("• Ran echo orphaned"),
"expected command text to come from event: {blob:?}"
);
assert!(
!blob.contains("call-orphan"),
"call id should not be rendered when event has the command: {blob:?}"
);
}
#[test]
fn exec_history_shows_unified_exec_startup_commands() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None);