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
This commit is contained in:
Tamir Duberstein
2026-08-20 12:17:44 +00:00
committed by copyberry
parent 3675fe014b
commit 59f7da58d6
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -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,
+2 -1
View File
@@ -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);
}