From fe556c4b6cbce64f508037f8ea2b9b071b0172bd Mon Sep 17 00:00:00 2001 From: "Adam Perry @ OpenAI" Date: Fri, 14 Aug 2026 20:19:16 +0000 Subject: [PATCH] Deliver gRPC code-mode notifications without truncation (#38645) ## What changed - Forward notification text to the session delegate without applying the previous 1,024-byte limit or appending a truncation suffix. - Update the gRPC host integration test to verify that oversized multibyte notification text is delivered unchanged. GitOrigin-RevId: 9a9e24b359a07540f70ec4e98b28524db3f7a4a0 --- codex-rs/code-mode-host/tests/grpc_notifications.rs | 10 +++------- codex-rs/code-mode/src/grpc_session/callbacks.rs | 12 +----------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/codex-rs/code-mode-host/tests/grpc_notifications.rs b/codex-rs/code-mode-host/tests/grpc_notifications.rs index 86a361fda6..c3590ef43b 100644 --- a/codex-rs/code-mode-host/tests/grpc_notifications.rs +++ b/codex-rs/code-mode-host/tests/grpc_notifications.rs @@ -273,7 +273,7 @@ async fn termination_cancels_pending_notifications() -> Result<()> { } #[tokio::test] -async fn oversized_notification_text_is_truncated_at_a_utf8_boundary() -> Result<()> { +async fn oversized_notification_text_is_delivered_unchanged() -> Result<()> { let host = HostHarness::start("grpc://127.0.0.1:0").await?; let provider = GrpcCodeModeSessionProvider::new(host.endpoint); let delegate = Arc::new(RecordingDelegate::default()); @@ -292,17 +292,13 @@ async fn oversized_notification_text_is_truncated_at_a_utf8_boundary() -> Result ); timeout(TEST_TIMEOUT, delegate.notification_delivered.notified()) .await - .context("truncated notification was not delivered")?; + .context("oversized notification was not delivered")?; assert_eq!( *delegate .notifications .lock() .unwrap_or_else(PoisonError::into_inner), - vec![( - "call-1".to_string(), - cell_id("1"), - format!("{}... [truncated]", "🦀".repeat(252)), - )] + vec![("call-1".to_string(), cell_id("1"), "🦀".repeat(512),)] ); session.shutdown().await.map_err(anyhow::Error::msg)?; diff --git a/codex-rs/code-mode/src/grpc_session/callbacks.rs b/codex-rs/code-mode/src/grpc_session/callbacks.rs index daf5f09b06..27714a836a 100644 --- a/codex-rs/code-mode/src/grpc_session/callbacks.rs +++ b/codex-rs/code-mode/src/grpc_session/callbacks.rs @@ -16,9 +16,6 @@ use super::conversion; use super::deadline; use super::state::CallbackAdmission; -const MAX_NOTIFICATION_BYTES: usize = 1_024; -const TRUNCATED_NOTIFICATION_SUFFIX: &str = "... [truncated]"; - impl SessionInner { pub(super) fn spawn_session_events( self: &Arc, @@ -197,15 +194,8 @@ impl SessionInner { fn handle_notification( self: &Arc, - mut notification: grpc::Notification, + notification: grpc::Notification, ) -> Result<(), String> { - if notification.text.len() > MAX_NOTIFICATION_BYTES { - let boundary = notification - .text - .floor_char_boundary(MAX_NOTIFICATION_BYTES - TRUNCATED_NOTIFICATION_SUFFIX.len()); - notification.text.truncate(boundary); - notification.text.push_str(TRUNCATED_NOTIFICATION_SUFFIX); - } let admission = self .state .lock()