Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Log TUI app event variants without their payloads (#39709)

Tamir Duberstein59f7da58d6ae
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);
}