mirror of
https://github.com/openai/codex.git
synced 2026-06-01 19:02:59 +00:00
[codex] Remove unused event messages (#20511)
## Why Several legacy `EventMsg` variants were still emitted or mapped even though clients either ignored them or had moved to item/lifecycle events. `Op::Undo` had also degraded to an unavailable shim, so this removes that dead task path instead of preserving a command that cannot do useful work. `McpStartupComplete`, `WebSearchBegin`, and `ImageGenerationBegin` are intentionally kept because useful consumers still depend on them: MCP startup completion drives readiness behavior, and the begin events let app-server/core consumers surface in-progress web-search and image-generation items before the final payload arrives. ## What Changed - Removed weak legacy event variants and payloads from `codex-protocol`, including legacy agent deltas, background events, and undo lifecycle events. - Kept/restored `EventMsg::McpStartupComplete`, `EventMsg::WebSearchBegin`, and `EventMsg::ImageGenerationBegin` with serializer and emission coverage. - Updated core, rollout, MCP server, app-server thread history, review/delegate filtering, and tests to rely on the useful replacement events that remain. - Removed `Op::Undo`, `UndoTask`, the undo test module, and stale TUI slash-command comments. - Stopped agent job/background progress and compaction retry notices from emitting `BackgroundEvent` payloads. ## Verification - `cargo check -p codex-protocol -p codex-app-server-protocol -p codex-core -p codex-rollout -p codex-rollout-trace -p codex-mcp-server` - `cargo test -p codex-protocol -p codex-app-server-protocol -p codex-rollout -p codex-rollout-trace -p codex-mcp-server` - `cargo test -p codex-core --test all suite::items` - `just fix -p codex-protocol -p codex-app-server-protocol -p codex-core -p codex-rollout -p codex-rollout-trace -p codex-mcp-server` - Earlier coverage on this PR also included `codex-mcp`, `codex-tui`, core library tests, MCP/plugin/delegate/review/agent job tests, and MCP startup TUI tests.
This commit is contained in:
@@ -777,12 +777,6 @@ pub enum Op {
|
||||
/// model.
|
||||
SetThreadMemoryMode { mode: ThreadMemoryMode },
|
||||
|
||||
/// Legacy request to undo a turn.
|
||||
///
|
||||
/// The op is still accepted for compatibility, but ghost snapshots are no
|
||||
/// longer produced so the request reports unavailable.
|
||||
Undo,
|
||||
|
||||
/// Request Codex to drop the last N user turns from in-memory context.
|
||||
///
|
||||
/// This does not attempt to revert local filesystem changes. Clients are
|
||||
@@ -911,7 +905,6 @@ impl Op {
|
||||
Self::Compact => "compact",
|
||||
Self::SetThreadName { .. } => "set_thread_name",
|
||||
Self::SetThreadMemoryMode { .. } => "set_thread_memory_mode",
|
||||
Self::Undo => "undo",
|
||||
Self::ThreadRollback { .. } => "thread_rollback",
|
||||
Self::Review { .. } => "review",
|
||||
Self::ApproveGuardianDeniedAction { .. } => "approve_guardian_denied_action",
|
||||
@@ -1368,20 +1361,12 @@ pub enum EventMsg {
|
||||
/// User/system input message (what was sent to the model)
|
||||
UserMessage(UserMessageEvent),
|
||||
|
||||
/// Agent text output delta message
|
||||
AgentMessageDelta(AgentMessageDeltaEvent),
|
||||
|
||||
/// Reasoning event from agent.
|
||||
AgentReasoning(AgentReasoningEvent),
|
||||
|
||||
/// Agent reasoning delta event from agent.
|
||||
AgentReasoningDelta(AgentReasoningDeltaEvent),
|
||||
|
||||
/// Raw chain-of-thought from agent.
|
||||
AgentReasoningRawContent(AgentReasoningRawContentEvent),
|
||||
|
||||
/// Agent reasoning content delta event from agent.
|
||||
AgentReasoningRawContentDelta(AgentReasoningRawContentDeltaEvent),
|
||||
/// Signaled when the model begins a new reasoning summary section (e.g., a new titled block).
|
||||
AgentReasoningSectionBreak(AgentReasoningSectionBreakEvent),
|
||||
|
||||
@@ -1447,12 +1432,6 @@ pub enum EventMsg {
|
||||
/// deprecated and should be phased out.
|
||||
DeprecationNotice(DeprecationNoticeEvent),
|
||||
|
||||
BackgroundEvent(BackgroundEventEvent),
|
||||
|
||||
UndoStarted(UndoStartedEvent),
|
||||
|
||||
UndoCompleted(UndoCompletedEvent),
|
||||
|
||||
/// Notification that a model stream experienced an error or disconnect
|
||||
/// and the system is handling it (e.g., retrying with backoff).
|
||||
StreamError(StreamErrorEvent),
|
||||
@@ -1894,9 +1873,7 @@ pub struct AgentMessageContentDeltaEvent {
|
||||
|
||||
impl HasLegacyEvent for AgentMessageContentDeltaEvent {
|
||||
fn as_legacy_events(&self, _: bool) -> Vec<EventMsg> {
|
||||
vec![EventMsg::AgentMessageDelta(AgentMessageDeltaEvent {
|
||||
delta: self.delta.clone(),
|
||||
})]
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1921,9 +1898,7 @@ pub struct ReasoningContentDeltaEvent {
|
||||
|
||||
impl HasLegacyEvent for ReasoningContentDeltaEvent {
|
||||
fn as_legacy_events(&self, _: bool) -> Vec<EventMsg> {
|
||||
vec![EventMsg::AgentReasoningDelta(AgentReasoningDeltaEvent {
|
||||
delta: self.delta.clone(),
|
||||
})]
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1940,11 +1915,7 @@ pub struct ReasoningRawContentDeltaEvent {
|
||||
|
||||
impl HasLegacyEvent for ReasoningRawContentDeltaEvent {
|
||||
fn as_legacy_events(&self, _: bool) -> Vec<EventMsg> {
|
||||
vec![EventMsg::AgentReasoningRawContentDelta(
|
||||
AgentReasoningRawContentDeltaEvent {
|
||||
delta: self.delta.clone(),
|
||||
},
|
||||
)]
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2309,11 +2280,6 @@ pub struct UserMessageEvent {
|
||||
pub text_elements: Vec<crate::user_input::TextElement>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct AgentMessageDeltaEvent {
|
||||
pub delta: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct AgentReasoningEvent {
|
||||
pub text: String,
|
||||
@@ -2324,11 +2290,6 @@ pub struct AgentReasoningRawContentEvent {
|
||||
pub text: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct AgentReasoningRawContentDeltaEvent {
|
||||
pub delta: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct AgentReasoningSectionBreakEvent {
|
||||
// load with default value so it's backward compatible with the old format.
|
||||
@@ -2338,11 +2299,6 @@ pub struct AgentReasoningSectionBreakEvent {
|
||||
pub summary_index: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct AgentReasoningDeltaEvent {
|
||||
pub delta: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS, PartialEq)]
|
||||
pub struct McpInvocation {
|
||||
/// Name of the MCP server as defined in the config.
|
||||
@@ -3188,11 +3144,6 @@ pub struct TerminalInteractionEvent {
|
||||
pub stdin: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct BackgroundEventEvent {
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct DeprecationNoticeEvent {
|
||||
/// Concise summary of what is deprecated.
|
||||
@@ -3202,19 +3153,6 @@ pub struct DeprecationNoticeEvent {
|
||||
pub details: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct UndoStartedEvent {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct UndoCompletedEvent {
|
||||
pub success: bool,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct ThreadRolledBackEvent {
|
||||
/// Number of user turns that were removed from context.
|
||||
|
||||
Reference in New Issue
Block a user