mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +00:00
Add hostname to the configurable TUI status line (#39795)
## What changed - Add `hostname` as a selectable status-line item and show it in setup previews. - Read the normalized operating-system hostname without triggering DNS resolution, and omit the item when no hostname is available. ## Testing - Cover hostname normalization, status-line rendering, and setup and surface previews. GitOrigin-RevId: c5e4e0ee1dba6e4bfdf942562a6b037835ff9e69
This commit is contained in:
1 parent
bfb8986f7f
commit
d9fd91edab
9 files changed
+116
-3
No files matched your search
@@ -2805,6 +2805,21 @@ async fn status_line_invalid_items_warn_once() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn status_line_hostname_renders_current_machine_hostname() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.thread_id = Some(ThreadId::new());
|
||||
chat.config.tui_status_line = Some(vec!["hostname".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
|
||||
assert_eq!(status_line_text(&chat), codex_config::os_host_name());
|
||||
assert!(
|
||||
drain_insert_history(&mut rx).is_empty(),
|
||||
"hostname should be accepted as a status line item"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn status_line_context_used_renders_labeled_percent() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
@@ -85,6 +85,16 @@ fn cache_rate_limit_snapshot(chat: &mut ChatWidget) {
|
||||
}));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn status_surface_hostname_preview_uses_current_machine_hostname() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
assert_eq!(
|
||||
status_preview_line(&mut chat, &[StatusLineItem::Hostname]),
|
||||
codex_config::os_host_name().expect("machine hostname")
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn status_surface_preview_lines_live_only_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
Reference in new issue
Block a user