From 2008d27e98d7b46170d2d464b36dbf97008611b8 Mon Sep 17 00:00:00 2001 From: Krish Chainani Date: Fri, 28 Aug 2026 21:16:28 +0000 Subject: [PATCH] Filter media from function call output notifications (#41427) ## What changed Strip inline image and audio content from function call output thread items when filtering app-server notifications. Preserve text and encrypted content, and leave text-only function call outputs unchanged. GitOrigin-RevId: ca3ad70e843aafbed49c693aa8963bea86cf95dc --- codex-rs/app-server/src/notification_media.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/codex-rs/app-server/src/notification_media.rs b/codex-rs/app-server/src/notification_media.rs index f6e291bf7f..844a312705 100644 --- a/codex-rs/app-server/src/notification_media.rs +++ b/codex-rs/app-server/src/notification_media.rs @@ -3,6 +3,7 @@ use codex_app_server_protocol::ServerNotification; use codex_app_server_protocol::ThreadItem; use codex_app_server_protocol::UserInput; use codex_protocol::models::ContentItem; +use codex_protocol::models::FunctionCallOutputBody; use codex_protocol::models::FunctionCallOutputContentItem; use codex_protocol::models::ResponseItem; @@ -108,6 +109,8 @@ pub(crate) fn without_notification_media(notification: ServerNotification) -> Se | ServerNotification::ContextCompacted(_) | ServerNotification::ModelRerouted(_) | ServerNotification::ModelVerification(_) + | ServerNotification::AuthRecoveryStarted(_) + | ServerNotification::AuthRecoveryCompleted(_) | ServerNotification::TurnModerationMetadata(_) | ServerNotification::ModelSafetyBufferingUpdated(_) | ServerNotification::Warning(_) @@ -155,6 +158,17 @@ fn without_thread_item_media(mut item: ThreadItem) -> ThreadItem { DynamicToolCallOutputContentItem::InputText { .. } => true, }); } + ThreadItem::FunctionCallOutput { + output: FunctionCallOutputBody::ContentItems(items), + .. + } => { + items.retain(|item| match item { + FunctionCallOutputContentItem::InputImage { .. } + | FunctionCallOutputContentItem::InputAudio { .. } => false, + FunctionCallOutputContentItem::InputText { .. } + | FunctionCallOutputContentItem::EncryptedContent { .. } => true, + }); + } ThreadItem::McpToolCall { result: Some(result), .. @@ -176,6 +190,10 @@ fn without_thread_item_media(mut item: ThreadItem) -> ThreadItem { | ThreadItem::AgentMessage { .. } | ThreadItem::Plan { .. } | ThreadItem::Reasoning { .. } + | ThreadItem::FunctionCallOutput { + output: FunctionCallOutputBody::Text(_), + .. + } | ThreadItem::CommandExecution { .. } | ThreadItem::FileChange { .. } | ThreadItem::McpToolCall { result: None, .. }