Compare commits

...

3 Commits

Author SHA1 Message Date
easong-openai
6d57d838bd return to prompt 2025-08-04 21:59:41 -07:00
easong-openai
36a65b445f merge 2025-08-04 19:14:02 -07:00
easong-openai
060fc3598f get rid of unnecessary ERROR messages when interrupting model and at end of exec. 2025-08-04 14:31:47 -07:00
4 changed files with 17 additions and 7 deletions

View File

@@ -627,8 +627,8 @@ impl AgentTask {
self.handle.abort();
let event = Event {
id: self.sub_id,
msg: EventMsg::Error(ErrorEvent {
message: "Turn interrupted".to_string(),
msg: EventMsg::BackgroundEvent(BackgroundEventEvent {
message: "Response interrupted.".to_string(),
}),
};
let tx_event = self.sess.tx_event.clone();

View File

@@ -181,20 +181,22 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
)
.await;
// Exit the inner loop and return to the main input prompt. The codex
// will emit a `TurnInterrupted` (Error) event which is drained later.
break;
}
res = codex.next_event() => match res {
Ok(event) => {
let is_shutdown = matches!(event.msg, EventMsg::ShutdownComplete);
debug!("Received event: {event:?}");
if let Err(e) = tx.send(event) {
error!("Error sending event: {e:?}");
break;
}
if is_shutdown {
break;
}
},
Err(e) => {
error!("Error receiving event: {e:?}");
debug!("Event stream ended: {e:?}");
break;
}
}

View File

@@ -286,8 +286,8 @@ impl BottomPane<'_> {
impl WidgetRef for &BottomPane<'_> {
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
// Show BottomPaneView if present.
if let Some(ov) = &self.active_view {
ov.render(area, buf);
if let Some(active_view) = &self.active_view {
active_view.render(area, buf);
} else {
(&self.composer).render_ref(area, buf);
}

View File

@@ -10,6 +10,7 @@ use codex_core::protocol::AgentMessageEvent;
use codex_core::protocol::AgentReasoningDeltaEvent;
use codex_core::protocol::AgentReasoningEvent;
use codex_core::protocol::ApplyPatchApprovalRequestEvent;
use codex_core::protocol::BackgroundEventEvent;
use codex_core::protocol::ErrorEvent;
use codex_core::protocol::Event;
use codex_core::protocol::EventMsg;
@@ -220,6 +221,13 @@ impl ChatWidget<'_> {
pub(crate) fn handle_codex_event(&mut self, event: Event) {
let Event { id, msg } = event;
match msg {
EventMsg::BackgroundEvent(BackgroundEventEvent { message }) => {
self.add_to_history(HistoryCell::new_background_event(message.clone()));
if message.contains("Turn interrupted") {
self.bottom_pane.set_task_running(false);
}
self.request_redraw();
}
EventMsg::SessionConfigured(event) => {
self.bottom_pane
.set_history_metadata(event.history_log_id, event.history_entry_count);