Compare commits

...

3 Commits

Author SHA1 Message Date
easong-openai
141895b03b Merge branch 'pakrym/display-session-id-in-status' of github.com:openai/codex into pakrym/display-session-id-in-status 2025-08-14 18:56:36 -07:00
pakrym-oai
b39713424d Display session id in status 2025-08-14 18:42:24 -07:00
pakrym-oai
89fda7a776 Display session id in status 2025-08-14 07:47:01 -07:00
3 changed files with 19 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ use ratatui::widgets::Widget;
use ratatui::widgets::WidgetRef;
use tokio::sync::mpsc::UnboundedSender;
use tracing::debug;
use uuid::Uuid;
use crate::app_event::AppEvent;
use crate::app_event_sender::AppEventSender;
@@ -86,6 +87,7 @@ pub(crate) struct ChatWidget<'a> {
interrupts: InterruptManager,
// Whether a redraw is needed after handling the current event
needs_redraw: bool,
session_id: Option<Uuid>,
}
struct UserMessage {
@@ -123,6 +125,7 @@ impl ChatWidget<'_> {
}
// --- Small event handlers ---
fn on_session_configured(&mut self, event: codex_core::protocol::SessionConfiguredEvent) {
self.session_id = Some(event.session_id);
self.bottom_pane
.set_history_metadata(event.history_log_id, event.history_entry_count);
self.add_to_history(&history_cell::new_session_info(&self.config, event, true));
@@ -528,6 +531,7 @@ impl ChatWidget<'_> {
task_complete_pending: false,
interrupts: InterruptManager::new(),
needs_redraw: false,
session_id: None,
}
}
@@ -675,6 +679,7 @@ impl ChatWidget<'_> {
self.add_to_history(&history_cell::new_status_output(
&self.config,
&self.total_token_usage,
&self.session_id,
));
}

View File

@@ -141,6 +141,7 @@ fn make_chatwidget_manual() -> (
task_complete_pending: false,
interrupts: InterruptManager::new(),
needs_redraw: false,
session_id: None,
};
(widget, rx, op_rx)
}

View File

@@ -37,6 +37,7 @@ use std::path::PathBuf;
use std::time::Duration;
use std::time::Instant;
use tracing::error;
use uuid::Uuid;
#[derive(Clone)]
pub(crate) struct CommandOutput {
@@ -483,7 +484,11 @@ pub(crate) fn new_diff_output(message: String) -> PlainHistoryCell {
PlainHistoryCell { lines }
}
pub(crate) fn new_status_output(config: &Config, usage: &TokenUsage) -> PlainHistoryCell {
pub(crate) fn new_status_output(
config: &Config,
usage: &TokenUsage,
session_id: &Option<Uuid>,
) -> PlainHistoryCell {
let mut lines: Vec<Line<'static>> = Vec::new();
lines.push(Line::from("/status".magenta()));
@@ -521,6 +526,13 @@ pub(crate) fn new_status_output(config: &Config, usage: &TokenUsage) -> PlainHis
sandbox_name.into(),
]));
if let Some(session_id) = session_id {
lines.push(Line::from(vec![
" • Session ID: ".into(),
session_id.to_string().into(),
]));
}
lines.push(Line::from(""));
// 👤 Account (only if ChatGPT tokens exist), shown under the first block