Add realtime wire trace logs (#17838)

- Add trace-only wire logging for realtime websocket request/event text
payloads and the WebRTC call SDP request.
- Gate raw realtime logs behind
`RUST_LOG=codex_api::realtime_websocket::wire=trace` so normal logs stay
quiet.

---------

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Ahmed Ibrahim
2026-04-14 14:39:28 -07:00
committed by GitHub
parent 42166ba260
commit 8b7d0e9201
2 changed files with 5 additions and 0 deletions

View File

@@ -119,6 +119,7 @@ impl<T: HttpTransport, A: AuthProvider> RealtimeCallClient<T, A> {
session_config: RealtimeSessionConfig,
extra_headers: HeaderMap,
) -> Result<RealtimeCallResponse, ApiError> {
trace!(target: "codex_api::realtime_websocket::wire", "realtime call request SDP: {sdp}");
// WebRTC can begin inference as soon as the peer connection comes up, so the initial
// session payload is sent with call creation. The sideband WebSocket still sends its normal
// session.update after it joins.

View File

@@ -45,6 +45,8 @@ use tracing::warn;
use tungstenite::protocol::WebSocketConfig;
use url::Url;
const REALTIME_WIRE_LOG_TARGET: &str = "codex_api::realtime_websocket::wire";
struct WsStream {
tx_command: mpsc::Sender<WsCommand>,
pump_task: tokio::task::JoinHandle<()>,
@@ -351,6 +353,7 @@ impl RealtimeWebsocketWriter {
));
}
trace!(target: REALTIME_WIRE_LOG_TARGET, "realtime websocket request: {payload}");
self.stream
.send(Message::Text(payload.into()))
.await
@@ -384,6 +387,7 @@ impl RealtimeWebsocketEvents {
match msg {
Message::Text(text) => {
trace!(target: REALTIME_WIRE_LOG_TARGET, "realtime websocket event: {text}");
if let Some(mut event) = parse_realtime_event(&text, self.event_parser) {
self.update_active_transcript(&mut event).await;
debug!(?event, "realtime websocket parsed event");