Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions codex-rs/app-server/src/bespoke_event_handling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,11 @@ pub(crate) async fn apply_bespoke_event_handling(
.await;
}
EventMsg::ContextCompacted(..) => {
// Core still fans out this deprecated event for legacy clients;
// v2 clients receive the canonical ContextCompaction item instead.
if matches!(api_version, ApiVersion::V2) {
return;
}
let notification = ContextCompactedNotification {
thread_id: conversation_id.to_string(),
turn_id: event_turn_id.clone(),
Expand Down Expand Up @@ -1599,6 +1604,17 @@ pub(crate) async fn apply_bespoke_event_handling(
.await;
}
EventMsg::ExecCommandBegin(exec_command_begin_event) => {
if matches!(api_version, ApiVersion::V2)
&& matches!(
exec_command_begin_event.source,
codex_protocol::protocol::ExecCommandSource::UnifiedExecInteraction
)
{
// TerminalInteraction is the v2 surface for unified exec
// stdin/poll events. Suppress the legacy CommandExecution
// item so clients do not render the same wait twice.
return;
}
let item_id = exec_command_begin_event.call_id.clone();
let command_actions = exec_command_begin_event
.parsed_cmd
Expand Down Expand Up @@ -1702,6 +1718,17 @@ pub(crate) async fn apply_bespoke_event_handling(
.command_execution_started
.remove(&call_id);
}
if matches!(api_version, ApiVersion::V2)
&& matches!(
exec_command_end_event.source,
codex_protocol::protocol::ExecCommandSource::UnifiedExecInteraction
)
{
// The paired begin event is suppressed above; keep the
// completion out of v2 as well so no orphan legacy item is
// emitted for unified exec interactions.
return;
}

let item = build_command_execution_end_item(&exec_command_end_event);

Expand Down
3 changes: 2 additions & 1 deletion codex-rs/tui/src/chatwidget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2193,6 +2193,7 @@ impl ChatWidget {
self.request_redraw();
}

#[cfg(test)]
fn on_agent_message(&mut self, message: String) {
self.finalize_completed_assistant_message(Some(&message));
}
Expand Down Expand Up @@ -5930,7 +5931,7 @@ impl ChatWidget {
self.exit_review_mode_after_item();
}
ThreadItem::ContextCompaction { .. } => {
self.on_agent_message("Context compacted".to_owned());
self.on_context_compacted();
}
ThreadItem::HookPrompt { .. } => {}
ThreadItem::CollabAgentToolCall {
Expand Down
Loading