mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +00:00
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
This commit is contained in:
1 parent
0e9589ffae
commit
21bd5d3cdc
22 files changed
+87
-134
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<ModelCatalog> {
|
||||
self.model_catalog.clone()
|
||||
|
||||
+1
-1
@@ -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: <none>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<Op>,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user