Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions codex-rs/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,12 @@ fn merge_interactive_cli_flags(interactive: &mut TuiCli, subcommand_cli: TuiCli)
if !subcommand_cli.add_dir.is_empty() {
interactive.add_dir.extend(subcommand_cli.add_dir);
}
if subcommand_cli.event_stream.is_some() {
interactive.event_stream = subcommand_cli.event_stream;
}
if subcommand_cli.event_schema_version.is_some() {
interactive.event_schema_version = subcommand_cli.event_schema_version;
}
if let Some(prompt) = subcommand_cli.prompt {
// Normalize CRLF/CR to LF so CLI-provided text can't leak `\r` into TUI state.
interactive.prompt = Some(prompt.replace("\r\n", "\n").replace('\r', "\n"));
Expand Down
12 changes: 12 additions & 0 deletions codex-rs/tui/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ pub struct Cli {
#[arg(long = "no-alt-screen", default_value_t = false)]
pub no_alt_screen: bool,

/// Emit structured JSONL lifecycle events to a file path, or `-` for stdout.
#[arg(long = "event-stream", value_name = "PATH_OR_STDOUT")]
pub event_stream: Option<String>,

/// Pin the event stream schema version for compatibility.
#[arg(
long = "event-schema-version",
value_name = "INT",
requires = "event_stream"
)]
pub event_schema_version: Option<u32>,

#[clap(skip)]
pub config_overrides: CliConfigOverrides,
}
10 changes: 8 additions & 2 deletions codex-rs/tui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,14 @@ async fn run_ratatui_app(
}
}

// Initialize high-fidelity session event logging if enabled.
session_log::maybe_init(&initial_config);
// Initialize session event logging if enabled.
if let Err(err) = session_log::maybe_init(&initial_config, &cli) {
Comment thread
rajeshgoli marked this conversation as resolved.
restore();
let _ = tui.terminal.clear();
return Ok(AppExitInfo::fatal(format!(
"Failed to initialize session event logging: {err}"
)));
}

let auth_manager = AuthManager::shared(
initial_config.codex_home.clone(),
Expand Down
Loading
Loading