From 1e7dab7e223b59aad3791b1691f569044d440a94 Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Thu, 29 Jan 2026 01:43:32 -0800 Subject: [PATCH] Clean up todo update notification serialization --- .../app-server-protocol/src/protocol/v2.rs | 32 ++++--------------- .../app-server/src/bespoke_event_handling.rs | 1 - 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index c46d09f5c2..cb98023bbb 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -2256,7 +2256,7 @@ pub struct TurnDiffUpdatedNotification { } #[derive(Debug, Clone, PartialEq, JsonSchema, TS)] -#[schemars(schema_with = "turn_todos_updated_schema")] +#[schemars(schema_with = "TurnTodosUpdatedNotificationWire::json_schema")] #[ts(export_to = "v2/")] #[ts(as = "TurnTodosUpdatedNotificationWire")] /// Todo list update from the todo_write tool. `todo` is preferred; `plan` is a legacy alias. @@ -2268,7 +2268,6 @@ pub struct TurnTodosUpdatedNotification { pub todo: Vec, } -#[allow(dead_code)] #[derive(Serialize, Deserialize, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] @@ -2283,35 +2282,18 @@ struct TurnTodosUpdatedNotificationWire { plan: Vec, } -#[allow(dead_code)] -fn turn_todos_updated_schema( - generator: &mut schemars::r#gen::SchemaGenerator, -) -> schemars::schema::Schema { - TurnTodosUpdatedNotificationWire::json_schema(generator) -} - impl Serialize for TurnTodosUpdatedNotification { fn serialize(&self, serializer: S) -> Result where S: Serializer, { - #[derive(Serialize)] - #[serde(rename_all = "camelCase")] - struct Wire<'a> { - thread_id: &'a str, - turn_id: &'a str, - explanation: Option<&'a str>, - todo: &'a [TurnTodoStep], - plan: &'a [TurnTodoStep], - } - // Emit both `todo` and the legacy `plan` alias with identical data. - Wire { - thread_id: &self.thread_id, - turn_id: &self.turn_id, - explanation: self.explanation.as_deref(), - todo: &self.todo, - plan: &self.todo, + TurnTodosUpdatedNotificationWire { + thread_id: self.thread_id.clone(), + turn_id: self.turn_id.clone(), + explanation: self.explanation.clone(), + todo: self.todo.clone(), + plan: self.todo.clone(), } .serialize(serializer) } diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index f8754bd411..7982f6b00d 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -1148,7 +1148,6 @@ async fn handle_turn_todo_update( outgoing: &OutgoingMessageSender, ) { if let ApiVersion::V2 = api_version { - // NOTE: The protocol keeps legacy plan aliases for compatibility; this is the todo list update. let (explanation, todo_items) = todo_update_event.into_parts(); let steps: Vec = todo_items.into_iter().map(TurnTodoStep::from).collect(); let notification = TurnTodoUpdatedNotification {