From 59f7da58d6ae8401304554f807023610181f65f0 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Thu, 20 Aug 2026 12:12:01 +0000 Subject: [PATCH] Log TUI app event variants without their payloads (#39709) ## Why The TUI session logger is meant to record only the variant for unhandled app events. Parsing `Debug` output removed tuple payloads but retained fields from struct variants. ## What changed Derive `IntoStaticStr` for `AppEvent` and use that conversion when recording fallback `app_event` entries, so the `variant` field consistently contains only the enum variant name. GitOrigin-RevId: 5b539f414269c6b001e69cf9496db5b49aceb759 --- codex-rs/tui/src/app_event.rs | 3 ++- codex-rs/tui/src/session_log.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/codex-rs/tui/src/app_event.rs b/codex-rs/tui/src/app_event.rs index 85938623a4..a22dd9db8a 100644 --- a/codex-rs/tui/src/app_event.rs +++ b/codex-rs/tui/src/app_event.rs @@ -40,6 +40,7 @@ use codex_protocol::ThreadId; use codex_protocol::openai_models::ModelPreset; use codex_utils_absolute_path::AbsolutePathBuf; use codex_utils_approval_presets::ApprovalPreset; +use strum_macros::IntoStaticStr; use uuid::Uuid; use crate::app_command::AppCommand; @@ -193,7 +194,7 @@ pub(crate) enum TranscriptExportDestination { } #[allow(clippy::large_enum_variant)] -#[derive(Debug)] +#[derive(Debug, IntoStaticStr)] pub(crate) enum AppEvent { /// Open the daemon-wide overview of loaded root sessions. OpenAgentsOverview, diff --git a/codex-rs/tui/src/session_log.rs b/codex-rs/tui/src/session_log.rs index 0994367685..1602aae797 100644 --- a/codex-rs/tui/src/session_log.rs +++ b/codex-rs/tui/src/session_log.rs @@ -199,11 +199,12 @@ pub(crate) fn log_inbound_app_event(event: &AppEvent) { } // Noise or control flow – record variant only other => { + let variant: &'static str = other.into(); let value = json!({ "ts": now_ts(), "dir": "to_tui", "kind": "app_event", - "variant": format!("{other:?}").split('(').next().unwrap_or("app_event"), + "variant": variant, }); LOGGER.write_json_line(value); }