diff --git a/codex-rs/exec-server/src/client/notification_tracing.rs b/codex-rs/exec-server/src/client/notification_tracing.rs index 25d20eb5bf..8cfacce91d 100644 --- a/codex-rs/exec-server/src/client/notification_tracing.rs +++ b/codex-rs/exec-server/src/client/notification_tracing.rs @@ -1,7 +1,9 @@ use codex_exec_server_protocol::JSONRPCNotification; use tracing::warn; -use crate::rpc::should_trace_server_notification; +use crate::protocol::EXEC_CLOSED_METHOD; +use crate::protocol::EXEC_EXITED_METHOD; +use crate::protocol::HTTP_REQUEST_BODY_DELTA_METHOD; pub(super) fn notification_span(notification: &JSONRPCNotification) -> tracing::Span { let method = notification.method.as_str(); @@ -9,7 +11,18 @@ pub(super) fn notification_span(notification: &JSONRPCNotification) -> tracing:: .params .as_ref() .unwrap_or(&serde_json::Value::Null); - if !should_trace_server_notification(method, params) { + let should_trace = match method { + EXEC_EXITED_METHOD | EXEC_CLOSED_METHOD => true, + HTTP_REQUEST_BODY_DELTA_METHOD => { + let Some(params) = params.as_object() else { + return tracing::Span::none(); + }; + params.get("done").and_then(serde_json::Value::as_bool) == Some(true) + || params.get("error").is_some_and(|error| !error.is_null()) + } + _ => false, + }; + if !should_trace { return tracing::Span::none(); } let span = tracing::info_span!(