From 21bd5d3cdcf6a6a22112a5a9571d00669af8ed05 Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Mon, 7 Sep 2026 04:29:31 +0000 Subject: [PATCH] Show the server's model provider ID in TUI status (#43359) ## Why The TUI's local provider configuration can differ from the active thread's provider, causing `/status` to show misleading provider details. ## What changed - Use the server-provided model provider ID in `/status` and update it when attaching to a thread. - Omit the provider row until a thread is configured, and display IDs such as `openai` instead of provider names and base URLs. - Remove runtime provider URL resolution from TUI startup and the associated widget state. ## Testing Add regression coverage for provider display before session configuration, thread switching, and server settings updates. Update status snapshots to show server provider IDs while preserving usage-link behavior based on the server's authentication requirement. GitOrigin-RevId: 87214b4fd971f63835e382557969e4fc3b602745 --- codex-rs/tui/src/app.rs | 6 --- codex-rs/tui/src/app/startup.rs | 28 ---------- codex-rs/tui/src/app/tests.rs | 5 -- .../src/app/tests/background_exit_tests.rs | 17 ++---- codex-rs/tui/src/app/tests/daybreak_tests.rs | 9 ++-- .../src/app/tests/recap_generation_tests.rs | 1 + .../tui/src/app/tests/safety_buffering.rs | 1 + codex-rs/tui/src/chatwidget.rs | 2 - codex-rs/tui/src/chatwidget/constructor.rs | 2 - codex-rs/tui/src/chatwidget/session_flow.rs | 1 + codex-rs/tui/src/chatwidget/settings.rs | 4 -- ...idget__tests__slash_copy_whole_status.snap | 2 +- .../tui/src/chatwidget/status_controls.rs | 3 +- .../tui/src/chatwidget/tests/app_server.rs | 44 +++++++++++++++ codex-rs/tui/src/chatwidget/tests/helpers.rs | 1 - .../tui/src/chatwidget/tests/plan_mode.rs | 1 - .../chatwidget/tests/popups_and_settings.rs | 1 - .../src/chatwidget/tests/status_and_layout.rs | 1 - codex-rs/tui/src/status/card.rs | 53 ++++--------------- ...ests__status_server_auth_not_required.snap | 25 +++++---- ...s__tests__status_server_auth_required.snap | 3 +- codex-rs/tui/src/status/tests.rs | 11 ++-- 22 files changed, 87 insertions(+), 134 deletions(-) diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index e310a45f8b..edd5136228 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -147,8 +147,6 @@ use codex_config::types::WindowsToml; use codex_exec_server::EnvironmentManager; use codex_features::Feature; use codex_features::FeaturesToml; -use codex_model_provider::create_model_provider; -use codex_model_provider_info::ModelProviderInfo; use codex_models_manager::model_presets::HIDE_GPT_5_1_CODEX_MAX_MIGRATION_PROMPT_CONFIG; use codex_models_manager::model_presets::HIDE_GPT5_1_MIGRATION_PROMPT_CONFIG; use codex_otel::SessionTelemetry; @@ -818,10 +816,6 @@ impl App { feedback: self.feedback.clone(), is_first_run: false, status_account_display: self.chat_widget.status_account_display().cloned(), - runtime_model_provider_base_url: self - .chat_widget - .runtime_model_provider_base_url() - .map(str::to_string), initial_plan_type: self.chat_widget.current_plan_type(), model: Some(self.chat_widget.current_model().to_string()), startup_tooltip_override: None, diff --git a/codex-rs/tui/src/app/startup.rs b/codex-rs/tui/src/app/startup.rs index 24abd52e59..6d5076bb50 100644 --- a/codex-rs/tui/src/app/startup.rs +++ b/codex-rs/tui/src/app/startup.rs @@ -9,17 +9,6 @@ use crate::session_start::cancel_session_start; use crate::session_start::complete_session_start; use crate::unarchive_prompt::run_unarchive_prompt; -async fn resolve_runtime_model_provider_base_url(provider: &ModelProviderInfo) -> Option { - let provider = create_model_provider(provider.clone(), /*auth_manager*/ None); - match provider.runtime_base_url().await { - Ok(base_url) => base_url, - Err(err) => { - tracing::warn!(%err, "failed to resolve runtime model provider base URL for status"); - None - } - } -} - fn spawn_startup_thread_start( app_server: &AppServerSession, local_settings: crate::local_settings::LocalSettings, @@ -353,19 +342,6 @@ impl App { let workspace_command_runner: WorkspaceCommandRunner = Arc::new( AppServerWorkspaceCommandRunner::new(app_server.request_handle()), ); - let runtime_model_provider_started_at = Instant::now(); - let runtime_model_provider_base_url = match startup_draft - .run_until( - tui, - resolve_runtime_model_provider_base_url(&config.model_provider), - ) - .await - { - Ok(base_url) => base_url, - Err(err) => return shutdown_on_startup_error(app_server, err).await, - }; - let runtime_model_provider_ms = runtime_model_provider_started_at.elapsed().as_millis(); - let enhanced_keys_supported = tui.enhanced_keys_supported(); let wait_for_initial_session_configured = Self::should_wait_for_initial_session(&session_selection); @@ -435,7 +411,6 @@ impl App { feedback: feedback.clone(), is_first_run, status_account_display: status_account_display.clone(), - runtime_model_provider_base_url: runtime_model_provider_base_url.clone(), initial_plan_type, model: Some(model.clone()), startup_tooltip_override, @@ -550,7 +525,6 @@ impl App { feedback: feedback.clone(), is_first_run, status_account_display: status_account_display.clone(), - runtime_model_provider_base_url: runtime_model_provider_base_url.clone(), initial_plan_type, model: config.model.clone(), startup_tooltip_override: None, @@ -648,7 +622,6 @@ impl App { feedback: feedback.clone(), is_first_run, status_account_display: status_account_display.clone(), - runtime_model_provider_base_url: runtime_model_provider_base_url.clone(), initial_plan_type, model: config.model.clone(), startup_tooltip_override: None, @@ -894,7 +867,6 @@ See the Codex keymap documentation for supported actions and examples." tracing::info!( duration_ms = %(startup_elapsed_before_app + startup_started_at.elapsed()).as_millis(), bootstrap_ms = %bootstrap_ms, - runtime_model_provider_ms = %runtime_model_provider_ms, thread_and_widget_ms = %thread_and_widget_ms, initial_session_ms = %initial_session_ms, event_stream_ms = %event_stream_started_at.elapsed().as_millis(), diff --git a/codex-rs/tui/src/app/tests.rs b/codex-rs/tui/src/app/tests.rs index 4b70ff51a8..97994076b1 100644 --- a/codex-rs/tui/src/app/tests.rs +++ b/codex-rs/tui/src/app/tests.rs @@ -689,7 +689,6 @@ fn set_test_initial_prompt(app: &mut App, initial_prompt: String) { feedback: codex_feedback::CodexFeedback::new(), is_first_run: false, status_account_display: None, - runtime_model_provider_base_url: None, initial_plan_type: None, model: Some(model), startup_tooltip_override: None, @@ -8142,10 +8141,6 @@ async fn replace_chat_widget_reseeds_collab_agent_metadata_for_replay() { feedback: app.feedback.clone(), is_first_run: false, status_account_display: app.chat_widget.status_account_display().cloned(), - runtime_model_provider_base_url: app - .chat_widget - .runtime_model_provider_base_url() - .map(str::to_string), initial_plan_type: app.chat_widget.current_plan_type(), model: Some(app.chat_widget.current_model().to_string()), startup_tooltip_override: None, diff --git a/codex-rs/tui/src/app/tests/background_exit_tests.rs b/codex-rs/tui/src/app/tests/background_exit_tests.rs index 22a218125b..911af0c7f8 100644 --- a/codex-rs/tui/src/app/tests/background_exit_tests.rs +++ b/codex-rs/tui/src/app/tests/background_exit_tests.rs @@ -5,8 +5,7 @@ use pretty_assertions::assert_eq; async fn external_writer_view_quits_with_escape_ctrl_c_or_q() -> Result<()> { let (mut app, mut events, _operations) = make_test_app_with_channels().await; app.chat_widget.show_external_writer_thread(); - let mut app_server = - crate::start_embedded_app_server_for_picker(app.chat_widget.config_ref()).await?; + let mut app_server = crate::start_embedded_app_server_for_picker(&app.config).await?; let mut tui = crate::tui::test_support::make_test_tui()?; while events.try_recv().is_ok() {} @@ -59,8 +58,7 @@ async fn external_writer_view_preserves_draft_from_keys_and_paste() -> Result<() app.ensure_thread_channel(thread_id).mark_external_writer(); app.chat_widget.insert_str("Retained draft"); app.chat_widget.show_external_writer_thread(); - let mut app_server = - crate::start_embedded_app_server_for_picker(app.chat_widget.config_ref()).await?; + let mut app_server = crate::start_embedded_app_server_for_picker(&app.config).await?; let mut tui = crate::tui::test_support::make_test_tui()?; for offline in [false, true] { @@ -208,8 +206,7 @@ async fn prepare_background_exit_test( ) -> Result<(AppServerSession, tui::Tui)> { while app_event_rx.try_recv().is_ok() {} while op_rx.try_recv().is_ok() {} - let app_server = - crate::start_embedded_app_server_for_picker(app.chat_widget.config_ref()).await?; + let app_server = crate::start_embedded_app_server_for_picker(&app.config).await?; Ok((app_server, crate::tui::test_support::make_test_tui()?)) } @@ -313,9 +310,7 @@ async fn exit_interrupts_before_requesting_shutdown() -> Result<()> { .set_feature_enabled(Feature::Goals, /*enabled*/ true); let (mut app_server, mut tui) = prepare_background_exit_test(&app, &mut app_event_rx, &mut op_rx).await?; - let started = app_server - .start_thread(app.chat_widget.config_ref()) - .await?; + let started = app_server.start_thread(&app.config).await?; let thread_id = started.session.thread_id; app.active_thread_id = Some(thread_id); app.chat_widget @@ -413,9 +408,7 @@ async fn daemon_ctrl_c_closes_running_side_thread_and_returns_to_parent() -> Res let side_thread_id = prepare_running_local_daemon(&mut app)?; let (mut app_server, mut tui) = prepare_background_exit_test(&app, &mut app_event_rx, &mut op_rx).await?; - let started = app_server - .start_thread(app.chat_widget.config_ref()) - .await?; + let started = app_server.start_thread(&app.config).await?; let parent_thread_id = started.session.thread_id; app.primary_thread_id = Some(parent_thread_id); app.side_threads diff --git a/codex-rs/tui/src/app/tests/daybreak_tests.rs b/codex-rs/tui/src/app/tests/daybreak_tests.rs index 641fb14742..89ece3189d 100644 --- a/codex-rs/tui/src/app/tests/daybreak_tests.rs +++ b/codex-rs/tui/src/app/tests/daybreak_tests.rs @@ -27,11 +27,10 @@ async fn cyber_refusal_reads_eligibility_without_changing_the_model() -> Result< .expect("write synthetic auth"); let server = Box::pin(crate::start_embedded_app_server_for_picker(&app.config)).await?; let thread_id = ThreadId::new(); - app.enqueue_primary_thread_session( - test_thread_session(thread_id, app.config.cwd.to_path_buf()), - Vec::new(), - ) - .await?; + let mut session = test_thread_session(thread_id, app.config.cwd.to_path_buf()); + session.model_provider_id = "openai".to_string(); + app.enqueue_primary_thread_session(session, Vec::new()) + .await?; for (status, enrolled, model, replace_account, expected) in [ (200, true, "gpt-5.6-sol", false, Notice::Limited), (200, false, "gpt-5.6-sol", false, Notice::Apply), diff --git a/codex-rs/tui/src/app/tests/recap_generation_tests.rs b/codex-rs/tui/src/app/tests/recap_generation_tests.rs index ff3992ff7e..60ef4b4fb0 100644 --- a/codex-rs/tui/src/app/tests/recap_generation_tests.rs +++ b/codex-rs/tui/src/app/tests/recap_generation_tests.rs @@ -3,6 +3,7 @@ use crate::app::session_lifecycle::ThreadAttachPresentation; use crate::app::tests::session_lifecycle_requests::recorded_params; use crate::app::tests::session_lifecycle_requests::start_recording_remote_app_server; use crate::app_event::RecapTrigger; +use codex_model_provider_info::ModelProviderInfo; use core_test_support::responses; use core_test_support::responses::ev_assistant_message; use core_test_support::responses::ev_completed; diff --git a/codex-rs/tui/src/app/tests/safety_buffering.rs b/codex-rs/tui/src/app/tests/safety_buffering.rs index fd7baef6cd..f32476b924 100644 --- a/codex-rs/tui/src/app/tests/safety_buffering.rs +++ b/codex-rs/tui/src/app/tests/safety_buffering.rs @@ -4,6 +4,7 @@ use crate::app::session_lifecycle::ThreadAttachPresentation; use crate::chatwidget::UserMessage; use codex_app_server_client::AppServerEvent; use codex_app_server_protocol::ModelSafetyBufferingUpdatedNotification; +use codex_model_provider_info::ModelProviderInfo; use codex_protocol::models::ManagedFileSystemPermissions; use codex_protocol::permissions::FileSystemAccessMode; use codex_protocol::permissions::FileSystemPath; diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index 13aaa4adf8..16d4a6e593 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -521,7 +521,6 @@ pub(crate) struct ChatWidgetInit { pub(crate) feedback: codex_feedback::CodexFeedback, pub(crate) is_first_run: bool, pub(crate) status_account_display: Option, - pub(crate) runtime_model_provider_base_url: Option, pub(crate) initial_plan_type: Option, pub(crate) model: Option, pub(crate) startup_tooltip_override: Option, @@ -582,7 +581,6 @@ pub(crate) struct ChatWidget { session_header: SessionHeader, initial_user_message: Option, status_account_display: Option, - runtime_model_provider_base_url: Option, pub(crate) remote_connection: Option, pub(crate) local_worktree_operations: bool, token_info: Option, diff --git a/codex-rs/tui/src/chatwidget/constructor.rs b/codex-rs/tui/src/chatwidget/constructor.rs index 6a2d5dee83..f45ae82fef 100644 --- a/codex-rs/tui/src/chatwidget/constructor.rs +++ b/codex-rs/tui/src/chatwidget/constructor.rs @@ -26,7 +26,6 @@ impl ChatWidget { feedback, is_first_run, status_account_display, - runtime_model_provider_base_url, initial_plan_type, model, startup_tooltip_override, @@ -134,7 +133,6 @@ impl ChatWidget { session_header: SessionHeader::new(header_model), initial_user_message, status_account_display, - runtime_model_provider_base_url, remote_connection: None, local_worktree_operations: true, token_info: None, diff --git a/codex-rs/tui/src/chatwidget/session_flow.rs b/codex-rs/tui/src/chatwidget/session_flow.rs index d62db38b6d..c29a574643 100644 --- a/codex-rs/tui/src/chatwidget/session_flow.rs +++ b/codex-rs/tui/src/chatwidget/session_flow.rs @@ -43,6 +43,7 @@ impl ChatWidget { self.current_rollout_path = session.rollout_path.clone(); self.current_cwd = Some(session.cwd.to_path_buf()); self.config.cwd = session.cwd.clone(); + self.config.model_provider_id = session.model_provider_id.clone(); if connector_scope_changed { self.invalidate_connector_scope(); } diff --git a/codex-rs/tui/src/chatwidget/settings.rs b/codex-rs/tui/src/chatwidget/settings.rs index 8fbf653e46..224feab67a 100644 --- a/codex-rs/tui/src/chatwidget/settings.rs +++ b/codex-rs/tui/src/chatwidget/settings.rs @@ -189,10 +189,6 @@ impl ChatWidget { self.status_account_display.as_ref() } - pub(crate) fn runtime_model_provider_base_url(&self) -> Option<&str> { - self.runtime_model_provider_base_url.as_deref() - } - #[cfg_attr(not(test), allow(dead_code))] pub(crate) fn model_catalog(&self) -> Arc { self.model_catalog.clone() diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__slash_copy_whole_status.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__slash_copy_whole_status.snap index f1feda58ba..4da4b628b9 100644 --- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__slash_copy_whole_status.snap +++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__slash_copy_whole_status.snap @@ -1,6 +1,5 @@ --- source: tui/src/chatwidget/tests/slash_commands.rs -assertion_line: 2041 expression: "whole_status.replace(&directory,\n\"[[workspace]]\").replace(crate::version::CODEX_CLI_VERSION, \"VERSION\")" --- >_ OpenAI Codex (vVERSION) @@ -9,6 +8,7 @@ Visit https://chatgpt.com/codex/settings/usage for up-to-date information on rate limits and credits Model: gpt-5.4 (reasoning medium, summaries auto) + Model provider: openai Directory: [[workspace]] Permissions: Read Only (Ask for approval) Agents.md: diff --git a/codex-rs/tui/src/chatwidget/status_controls.rs b/codex-rs/tui/src/chatwidget/status_controls.rs index 0666076ee7..de61cba2d5 100644 --- a/codex-rs/tui/src/chatwidget/status_controls.rs +++ b/codex-rs/tui/src/chatwidget/status_controls.rs @@ -243,7 +243,8 @@ impl ChatWidget { let (cell, handle) = crate::status::new_status_output_with_rate_limits_handle( &self.config, self.requires_openai_auth, - self.runtime_model_provider_base_url.as_deref(), + self.thread_id + .map(|_| self.config.model_provider_id.as_str()), self.remote_connection.as_ref(), self.status_account_display.as_ref(), token_info, diff --git a/codex-rs/tui/src/chatwidget/tests/app_server.rs b/codex-rs/tui/src/chatwidget/tests/app_server.rs index 3d3c91d762..8222ef5bfc 100644 --- a/codex-rs/tui/src/chatwidget/tests/app_server.rs +++ b/codex-rs/tui/src/chatwidget/tests/app_server.rs @@ -66,6 +66,50 @@ fn configured_thread_session(thread_id: ThreadId) -> crate::session_state::Threa } } +#[tokio::test] +async fn session_and_settings_sync_server_provider_id() { + let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.2")).await; + chat.config.model_provider.base_url = Some("https://local-provider.example/v1".to_string()); + let status = |chat: &mut ChatWidget| { + chat.add_status_output( + /*refreshing_rate_limits*/ false, /*request_id*/ None, + ); + chat.transcript + .last_status_copy_targets + .as_ref() + .expect("status") + .handle + .copy_text() + }; + assert!(!status(&mut chat).contains("Model provider:")); + + let first_id = ThreadId::new(); + let mut first = configured_thread_session(first_id); + first.model_provider_id = "server-ollama".to_string(); + chat.handle_thread_session(first.clone()); + let displayed = status(&mut chat); + assert!(displayed.contains("Model provider:") && displayed.contains("server-ollama")); + assert!(!displayed.contains("local-provider.example")); + + let mut other = configured_thread_session(ThreadId::new()); + other.model_provider_id = "server-bedrock".to_string(); + chat.handle_thread_session_quiet(other); + let displayed = status(&mut chat); + assert!(displayed.contains("server-bedrock")); + assert!(!displayed.contains("server-ollama")); + + chat.handle_thread_session_quiet(first); + assert_eq!(chat.config.model_provider_id, "server-ollama"); + + let mut updated = thread_settings_for_test("gpt-5.4", first_id); + updated.thread_settings.model_provider = "server-updated".to_string(); + chat.handle_server_notification( + ServerNotification::ThreadSettingsUpdated(updated), + /*replay_kind*/ None, + ); + assert!(status(&mut chat).contains("server-updated")); +} + fn start_safety_buffering_test_turn( chat: &mut ChatWidget, op_rx: &mut tokio::sync::mpsc::UnboundedReceiver, diff --git a/codex-rs/tui/src/chatwidget/tests/helpers.rs b/codex-rs/tui/src/chatwidget/tests/helpers.rs index fa2bafe3de..dcf517ad38 100644 --- a/codex-rs/tui/src/chatwidget/tests/helpers.rs +++ b/codex-rs/tui/src/chatwidget/tests/helpers.rs @@ -204,7 +204,6 @@ pub(super) async fn make_chatwidget_manual_with_auth( feedback: codex_feedback::CodexFeedback::new(), is_first_run: true, status_account_display: None, - runtime_model_provider_base_url: None, initial_plan_type: None, model: Some(resolved_model.clone()), startup_tooltip_override: None, diff --git a/codex-rs/tui/src/chatwidget/tests/plan_mode.rs b/codex-rs/tui/src/chatwidget/tests/plan_mode.rs index 9f5fc3da34..8244b851a1 100644 --- a/codex-rs/tui/src/chatwidget/tests/plan_mode.rs +++ b/codex-rs/tui/src/chatwidget/tests/plan_mode.rs @@ -1644,7 +1644,6 @@ async fn make_startup_chat_with_cli_overrides( feedback: codex_feedback::CodexFeedback::new(), is_first_run: true, status_account_display: None, - runtime_model_provider_base_url: None, initial_plan_type: None, model: Some(resolved_model), startup_tooltip_override: None, diff --git a/codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs b/codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs index 6b06f0ecb4..e7617cc3c9 100644 --- a/codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs +++ b/codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs @@ -49,7 +49,6 @@ async fn experimental_mode_plan_is_ignored_on_startup() { feedback: codex_feedback::CodexFeedback::new(), is_first_run: true, status_account_display: None, - runtime_model_provider_base_url: None, initial_plan_type: None, model: Some(resolved_model.clone()), startup_tooltip_override: None, diff --git a/codex-rs/tui/src/chatwidget/tests/status_and_layout.rs b/codex-rs/tui/src/chatwidget/tests/status_and_layout.rs index 7284cdce60..6e68f7795e 100644 --- a/codex-rs/tui/src/chatwidget/tests/status_and_layout.rs +++ b/codex-rs/tui/src/chatwidget/tests/status_and_layout.rs @@ -489,7 +489,6 @@ async fn configured_pet_load_is_deferred_until_after_construction() { feedback: codex_feedback::CodexFeedback::new(), is_first_run: true, status_account_display: None, - runtime_model_provider_base_url: None, initial_plan_type: None, model: Some(resolved_model), startup_tooltip_override: None, diff --git a/codex-rs/tui/src/status/card.rs b/codex-rs/tui/src/status/card.rs index bd4f557b9d..86437fe8d2 100644 --- a/codex-rs/tui/src/status/card.rs +++ b/codex-rs/tui/src/status/card.rs @@ -28,7 +28,6 @@ use ratatui::prelude::*; use ratatui::style::Stylize; use std::collections::BTreeSet; use std::path::PathBuf; -use url::Url; use super::account::StatusAccountDisplay; use super::format::FieldFormatter; @@ -203,7 +202,7 @@ pub(crate) fn new_status_output_with_rate_limits( new_status_output_with_rate_limits_handle( config, config.model_provider.requires_openai_auth, - /*runtime_model_provider_base_url*/ None, + /*model_provider_id*/ None, /*remote_connection*/ None, account_display, token_info, @@ -227,7 +226,7 @@ pub(crate) fn new_status_output_with_rate_limits( pub(crate) fn new_status_output_with_rate_limits_handle( config: &Config, requires_openai_auth: bool, - runtime_model_provider_base_url: Option<&str>, + model_provider_id: Option<&str>, remote_connection: Option<&RemoteConnectionStatus>, account_display: Option<&StatusAccountDisplay>, token_info: Option<&TokenUsageInfo>, @@ -248,7 +247,7 @@ pub(crate) fn new_status_output_with_rate_limits_handle( let card = Arc::new(StatusHistoryCell::new( config, requires_openai_auth, - runtime_model_provider_base_url, + model_provider_id, remote_connection, account_display, token_info, @@ -280,7 +279,7 @@ impl StatusHistoryCell { fn new( config: &Config, requires_openai_auth: bool, - runtime_model_provider_base_url: Option<&str>, + model_provider_id: Option<&str>, remote_connection: Option<&RemoteConnectionStatus>, account_display: Option<&StatusAccountDisplay>, token_info: Option<&TokenUsageInfo>, @@ -300,10 +299,12 @@ impl StatusHistoryCell { let approval_policy = AskForApproval::from(config.permissions.approval_policy.value()); let permission_profile = config.permissions.effective_permission_profile(); let workspace_roots = config.effective_workspace_roots(); + let model_provider = model_provider_id + .filter(|id| !id.trim().is_empty()) + .map(str::to_string); let mut config_entries = vec![ ("workdir", config.cwd.display().to_string()), ("model", model_name.to_string()), - ("provider", config.model_provider_id.clone()), ( "approval", config.permissions.approval_policy.value().to_string(), @@ -317,6 +318,9 @@ impl StatusHistoryCell { ), ), ]; + if let Some(provider_id) = &model_provider { + config_entries.insert(2, ("provider", provider_id.clone())); + } if config.model_provider.wire_api == WireApi::Responses { let effort_value = reasoning_effort_override .unwrap_or_else(|| config.model_reasoning_effort.clone()) @@ -350,7 +354,6 @@ impl StatusHistoryCell { &approval, workspace_root_suffix.as_deref(), ); - let model_provider = format_model_provider(config, runtime_model_provider_base_url); let show_chatgpt_usage_link = requires_openai_auth; let account = compose_account_display(account_display); let session_id = session_id.as_ref().map(std::string::ToString::to_string); @@ -954,39 +957,3 @@ impl HistoryCell for Arc { self.display_hyperlink_lines(width) } } - -fn format_model_provider(config: &Config, runtime_base_url: Option<&str>) -> Option { - let provider = &config.model_provider; - let name = provider.name.trim(); - let provider_name = if name.is_empty() { - config.model_provider_id.as_str() - } else { - name - }; - let base_url = runtime_base_url.and_then(sanitize_base_url); - let is_default_openai = provider.is_openai() && base_url.is_none(); - if is_default_openai { - return None; - } - - Some(match base_url { - Some(base_url) => format!("{provider_name} - {base_url}"), - None => provider_name.to_string(), - }) -} - -fn sanitize_base_url(raw: &str) -> Option { - let trimmed = raw.trim(); - if trimmed.is_empty() { - return None; - } - - let Ok(mut url) = Url::parse(trimmed) else { - return None; - }; - let _ = url.set_username(""); - let _ = url.set_password(None); - url.set_query(None); - url.set_fragment(None); - Some(url.to_string().trim_end_matches('/').to_string()).filter(|value| !value.is_empty()) -} diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_server_auth_not_required.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_server_auth_not_required.snap index bd805b72ef..701080e695 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_server_auth_not_required.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_server_auth_not_required.snap @@ -1,19 +1,18 @@ --- source: tui/src/status/tests.rs -assertion_line: 776 expression: rendered --- /status -╭────────────────────────────────────────────────────────────────────────────────────────╮ -│ >_ OpenAI Codex (v0.0.0) │ -│ │ -│ Model: gpt-5.6-sol (reasoning none, summaries auto) │ -│ Model provider: Amazon Bedrock - https://bedrock-mantle.eu-west-1.api.aws/openai/v1 │ -│ Directory: [[workspace]] │ -│ Permissions: Custom (workspace with network access, Ask for approval) │ -│ Agents.md: │ -│ │ -│ Token usage: 0 total (0 input + 0 output) │ -│ Limits: data not available yet │ -╰────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────╮ +│ >_ OpenAI Codex (v0.0.0) │ +│ │ +│ Model: gpt-5.6-sol (reasoning none, summaries auto) │ +│ Model provider: server-ollama │ +│ Directory: [[workspace]] │ +│ Permissions: Custom (workspace with network access, Ask for approval) │ +│ Agents.md: │ +│ │ +│ Token usage: 0 total (0 input + 0 output) │ +│ Limits: data not available yet │ +╰─────────────────────────────────────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_server_auth_required.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_server_auth_required.snap index d5560f032f..d31fdf2a03 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_server_auth_required.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_server_auth_required.snap @@ -1,6 +1,5 @@ --- source: tui/src/status/tests.rs -assertion_line: 808 expression: rendered --- /status @@ -12,7 +11,7 @@ expression: rendered │ information on rate limits and credits │ │ │ │ Model: gpt-5.6-sol (reasoning none, summaries auto) │ -│ Model provider: OpenAI Proxy │ +│ Model provider: server-openai │ │ Directory: [[workspace]] │ │ Permissions: Custom (workspace with network access, Ask for approval) │ │ Agents.md: │ diff --git a/codex-rs/tui/src/status/tests.rs b/codex-rs/tui/src/status/tests.rs index a4bcb3b3c3..e644dcb2cc 100644 --- a/codex-rs/tui/src/status/tests.rs +++ b/codex-rs/tui/src/status/tests.rs @@ -732,7 +732,7 @@ async fn status_snapshot_shows_active_user_defined_profile() { } #[tokio::test] -async fn status_model_provider_uses_bedrock_runtime_base_url_and_gates_usage_link() { +async fn status_uses_server_provider_id_and_auth_requirement() { let temp_home = TempDir::new().expect("temp home"); let mut config = test_config(&temp_home).await; config.model = Some("gpt-5.6-sol".to_string()); @@ -752,13 +752,12 @@ async fn status_model_provider_uses_bedrock_runtime_base_url_and_gates_usage_lin .single() .expect("timestamp"); let model_slug = get_model_offline_for_tests(config.model.as_deref()); - let runtime_base_url = "https://bedrock-mantle.eu-west-1.api.aws/openai/v1"; config.model_provider.requires_openai_auth = true; let (composite, _handle) = new_status_output_with_rate_limits_handle( &config, /*requires_openai_auth*/ false, - Some(runtime_base_url), + Some("server-ollama"), /*remote_connection*/ None, test_status_account_display().as_ref(), /*token_info*/ None, @@ -789,7 +788,7 @@ async fn status_model_provider_uses_bedrock_runtime_base_url_and_gates_usage_lin let (composite, _handle) = new_status_output_with_rate_limits_handle( &config, /*requires_openai_auth*/ true, - /*runtime_model_provider_base_url*/ None, + Some("server-openai"), /*remote_connection*/ None, test_status_account_display().as_ref(), /*token_info*/ None, @@ -1641,7 +1640,7 @@ async fn status_snapshot_uses_default_reasoning_when_config_empty() { let (composite, _) = new_status_output_with_rate_limits_handle( &config, /*requires_openai_auth*/ true, - /*runtime_model_provider_base_url*/ None, + /*model_provider_id*/ None, Some(&remote_connection), account_display.as_ref(), Some(&token_info), @@ -1752,7 +1751,7 @@ async fn transcript_overlay_remeasures_status_after_rate_limit_refresh() { let (status, handle) = new_status_output_with_rate_limits_handle( &config, /*requires_openai_auth*/ true, - /*runtime_model_provider_base_url*/ None, + /*model_provider_id*/ None, /*remote_connection*/ None, /*account_display*/ None, /*token_info*/ None,