Skip to content
Merged
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
15 changes: 14 additions & 1 deletion src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ use codex_protocol::{
config_types::TrustLevel,
custom_prompts::CustomPrompt,
dynamic_tools::{DynamicToolCallOutputContentItem, DynamicToolCallRequest},
items::TurnItem,
mcp::CallToolResult,
models::{ResponseItem, WebSearchAction},
openai_models::{ModelPreset, ReasoningEffort},
Expand Down Expand Up @@ -637,6 +638,11 @@ impl PromptState {
item,
}) => {
info!("Item completed: thread_id={}, turn_id={}, item={:?}", thread_id, turn_id, item);
// Notify the client when context compaction completes so users see
// a status message rather than silence during /compact.
if matches!(item, TurnItem::ContextCompaction(..)) {
client.send_agent_text("Context compacted".to_string()).await;
}
}
EventMsg::TurnComplete(TurnCompleteEvent { last_agent_message, turn_id }) => {
info!(
Expand Down Expand Up @@ -725,6 +731,9 @@ impl PromptState {
}
EventMsg::Warning(WarningEvent { message }) => {
warn!("Warning: {message}");
// Forward warnings to the client as agent messages so users see
// informational notices (e.g., the post-compact advisory message).
client.send_agent_text(message).await;
}
EventMsg::McpStartupUpdate(McpStartupUpdateEvent { server, status }) => {
info!("MCP startup update: server={server}, status={status:?}");
Expand All @@ -750,14 +759,18 @@ impl PromptState {
info!("Model reroute: from={from_model}, to={to_model}, reason={reason:?}");
}

EventMsg::ContextCompacted(..) => {
info!("Context compacted");
client.send_agent_text("Context compacted".to_string()).await;
}

// Ignore these events
EventMsg::AgentReasoningRawContent(..)
| EventMsg::ThreadRolledBack(..)
// we already have a way to diff the turn, so ignore
| EventMsg::TurnDiff(..)
// Revisit when we can emit status updates
| EventMsg::BackgroundEvent(..)
| EventMsg::ContextCompacted(..)
| EventMsg::SkillsUpdateAvailable
// Old events
| EventMsg::AgentMessageDelta(..)
Expand Down