mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +00:00
Separate TUI preferences from server configuration (#42202)
## Why TUI preferences and persistence paths belong to the local client, while thread configuration and account requirements may come from the active app server. Keeping both in the same resolved `Config` can replace live local preferences when a thread is resumed, forked, reconnected, or switched. ## What changed - Add `LocalSettings` as the TUI-owned source for UI, history, notice, and local persistence settings, and preserve it across session lifecycle transitions. - Write preference changes to the selected user config file and reload local settings from disk when changing roots. - Use the app server's account response for authentication-dependent onboarding and status UI instead of the local model-provider configuration. - Retain platform family and OS metadata reported by remote app servers. ## Testing - Cover local setting defaults, overrides, persistence destinations, reloads, and preservation across widget replacement and root switching. - Cover remote platform metadata and server-controlled authentication UI. GitOrigin-RevId: dbc2965fb1d6cbecb3f973f6133f3dcd4467b753
This commit is contained in:
1 parent
0b509e930e
commit
9d57be71ba
87 files changed
+1188
-459
No files matched your search
@@ -23,7 +23,7 @@ impl ChatWidget {
|
||||
pub(crate) fn backend_banner_fallback(&self) -> Option<ModelPreset> {
|
||||
let banner = self.backend_banner_state.banner.as_ref()?;
|
||||
if !self.has_chatgpt_account
|
||||
|| !self.config.model_provider.requires_openai_auth
|
||||
|| !self.requires_openai_auth
|
||||
|| banner.blocked_model_slug.as_deref() != Some(self.current_model())
|
||||
{
|
||||
return None;
|
||||
|
||||
@@ -302,7 +302,7 @@ impl ChatWidget {
|
||||
parsed_cmd,
|
||||
source,
|
||||
/*interaction_input*/ None,
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
)));
|
||||
self.bump_active_cell_revision();
|
||||
}
|
||||
@@ -418,7 +418,7 @@ impl ChatWidget {
|
||||
parsed,
|
||||
source,
|
||||
/*interaction_input*/ None,
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
);
|
||||
let completed = orphan.complete_call(&id, output, duration);
|
||||
debug_assert!(completed, "new orphan exec cell should contain {id}");
|
||||
@@ -435,7 +435,7 @@ impl ChatWidget {
|
||||
parsed,
|
||||
source,
|
||||
/*interaction_input*/ None,
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
);
|
||||
let completed = cell.complete_call(&id, output, duration);
|
||||
debug_assert!(completed, "new exec cell should contain {id}");
|
||||
|
||||
@@ -13,12 +13,14 @@ impl ChatWidget {
|
||||
) -> Self {
|
||||
let ChatWidgetInit {
|
||||
config,
|
||||
local_settings,
|
||||
frame_requester,
|
||||
app_event_tx,
|
||||
workspace_command_runner,
|
||||
initial_user_message,
|
||||
enhanced_keys_supported,
|
||||
has_chatgpt_account,
|
||||
requires_openai_auth,
|
||||
has_codex_backend_auth,
|
||||
model_catalog,
|
||||
feedback,
|
||||
@@ -65,11 +67,12 @@ impl ChatWidget {
|
||||
let current_cwd = Some(config.cwd.to_path_buf());
|
||||
let effective_service_tier = crate::service_tier_resolution::effective_service_tier(
|
||||
&config,
|
||||
&local_settings.notices,
|
||||
&header_model,
|
||||
&model_catalog.try_list_models().unwrap_or_default(),
|
||||
);
|
||||
let current_terminal_info = terminal_info();
|
||||
let runtime_keymap = RuntimeKeymap::from_config(&config.tui_keymap).ok();
|
||||
let runtime_keymap = RuntimeKeymap::from_config(&local_settings.tui.keymap).ok();
|
||||
let default_keymap = RuntimeKeymap::defaults();
|
||||
let copy_last_response_binding = runtime_keymap
|
||||
.as_ref()
|
||||
@@ -88,7 +91,7 @@ impl ChatWidget {
|
||||
codex_http_client::ClientRouteClass::Other,
|
||||
);
|
||||
pets::start_configured_pet_load_if_needed(
|
||||
&config,
|
||||
&local_settings,
|
||||
/*ambient_pet_missing*/ true,
|
||||
frame_requester.clone(),
|
||||
app_event_tx.clone(),
|
||||
@@ -104,19 +107,21 @@ impl ChatWidget {
|
||||
has_input_focus: true,
|
||||
enhanced_keys_supported,
|
||||
placeholder_text: placeholder.clone(),
|
||||
disable_paste_burst: config.disable_paste_burst,
|
||||
animations_enabled: config.animations,
|
||||
disable_paste_burst: local_settings.tui.disable_paste_burst.unwrap_or(false),
|
||||
animations_enabled: local_settings.tui.animations,
|
||||
skills: None,
|
||||
}),
|
||||
transcript: TranscriptState::new(active_cell),
|
||||
raw_output_mode: config.tui_raw_output_mode,
|
||||
raw_output_mode: local_settings.tui.raw_output_mode,
|
||||
config,
|
||||
local_settings,
|
||||
effective_service_tier,
|
||||
skills_all: Vec::new(),
|
||||
skills_initial_state: None,
|
||||
current_collaboration_mode,
|
||||
active_collaboration_mask,
|
||||
has_chatgpt_account,
|
||||
requires_openai_auth,
|
||||
has_codex_backend_auth,
|
||||
model_catalog,
|
||||
model_popup_request_id: None,
|
||||
@@ -265,7 +270,7 @@ impl ChatWidget {
|
||||
if let Some(keymap) = runtime_keymap {
|
||||
widget.bottom_pane.set_keymap_bindings(&keymap);
|
||||
}
|
||||
if widget.config.tui_vim_mode_default {
|
||||
if widget.local_settings.tui.vim_mode_default {
|
||||
widget.bottom_pane.enable_vim_in_insert_mode();
|
||||
} else {
|
||||
widget.bottom_pane.set_vim_enabled(/*enabled*/ false);
|
||||
|
||||
@@ -129,7 +129,7 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
pub(super) fn schedule_hook_timer_if_needed(&self) {
|
||||
if self.config.animations
|
||||
if self.local_settings.tui.animations
|
||||
&& self
|
||||
.active_hook_cell
|
||||
.as_ref()
|
||||
|
||||
@@ -83,7 +83,7 @@ impl ChatWidget {
|
||||
draft.last_composer_activity_at,
|
||||
draft.startup_local_history,
|
||||
);
|
||||
if startup_has_content && self.config.tui_vim_mode_default {
|
||||
if startup_has_content && self.local_settings.tui.vim_mode_default {
|
||||
self.bottom_pane.enable_vim_in_insert_mode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ impl ChatWidget {
|
||||
/// overrides. If the config is invalid, the user sees the parse error instead of a partial
|
||||
/// picker that could commit edits against stale runtime state.
|
||||
pub(crate) fn open_keymap_picker(&mut self) {
|
||||
match RuntimeKeymap::from_config(&self.config.tui_keymap) {
|
||||
match RuntimeKeymap::from_config(&self.local_settings.tui.keymap) {
|
||||
Ok(runtime_keymap) => {
|
||||
let params = keymap_setup::build_keymap_picker_params_with_filter(
|
||||
&runtime_keymap,
|
||||
&self.config.tui_keymap,
|
||||
&self.local_settings.tui.keymap,
|
||||
self.keymap_action_filter(),
|
||||
);
|
||||
self.bottom_pane.show_selection_view(params);
|
||||
@@ -59,7 +59,7 @@ impl ChatWidget {
|
||||
context,
|
||||
action,
|
||||
runtime_keymap,
|
||||
&self.config.tui_keymap,
|
||||
&self.local_settings.tui.keymap,
|
||||
);
|
||||
self.bottom_pane.show_selection_view(params);
|
||||
}
|
||||
@@ -91,7 +91,8 @@ impl ChatWidget {
|
||||
|
||||
/// Opens the keypress inspector with the current runtime bindings.
|
||||
pub(crate) fn open_keymap_debug(&mut self, runtime_keymap: &RuntimeKeymap) {
|
||||
let view = keymap_setup::build_keymap_debug_view(runtime_keymap, &self.config.tui_keymap);
|
||||
let view =
|
||||
keymap_setup::build_keymap_debug_view(runtime_keymap, &self.local_settings.tui.keymap);
|
||||
self.bottom_pane.show_view(Box::new(view));
|
||||
self.request_redraw();
|
||||
}
|
||||
@@ -126,7 +127,7 @@ impl ChatWidget {
|
||||
) {
|
||||
let params = keymap_setup::build_keymap_picker_params_for_selected_action_with_filter(
|
||||
runtime_keymap,
|
||||
&self.config.tui_keymap,
|
||||
&self.local_settings.tui.keymap,
|
||||
self.keymap_action_filter(),
|
||||
context,
|
||||
action,
|
||||
@@ -142,7 +143,7 @@ impl ChatWidget {
|
||||
if !replaced {
|
||||
let params = keymap_setup::build_keymap_picker_params_for_selected_action_with_filter(
|
||||
runtime_keymap,
|
||||
&self.config.tui_keymap,
|
||||
&self.local_settings.tui.keymap,
|
||||
self.keymap_action_filter(),
|
||||
context,
|
||||
action,
|
||||
@@ -162,14 +163,14 @@ impl ChatWidget {
|
||||
///
|
||||
/// The caller is responsible for persisting the config file before invoking this method. This
|
||||
/// method updates the in-memory config, app-level copy binding cache, and bottom-pane keymap
|
||||
/// bindings as one unit; callers that update only `self.config.tui_keymap` would leave visible
|
||||
/// bindings as one unit; callers that update only `self.local_settings.tui.keymap` would leave visible
|
||||
/// picker state and active key handlers disagreeing until the next restart.
|
||||
pub(crate) fn apply_keymap_update(
|
||||
&mut self,
|
||||
keymap_config: TuiKeymap,
|
||||
runtime_keymap: &RuntimeKeymap,
|
||||
) {
|
||||
self.config.tui_keymap = keymap_config;
|
||||
self.local_settings.tui.keymap = keymap_config;
|
||||
self.copy_last_response_binding = runtime_keymap.app.copy.clone();
|
||||
self.chat_keymap = runtime_keymap.chat.clone();
|
||||
self.queued_message_edit_hint_binding =
|
||||
|
||||
@@ -4,7 +4,7 @@ use super::*;
|
||||
|
||||
impl ChatWidget {
|
||||
pub(super) fn notify(&mut self, notification: Notification) {
|
||||
if !notification.allowed_for(&self.config.tui_notifications.notifications) {
|
||||
if !notification.allowed_for(&self.local_settings.tui.notification_settings.notifications) {
|
||||
return;
|
||||
}
|
||||
if let Some(existing) = self.pending_notification.as_ref()
|
||||
|
||||
@@ -4,10 +4,10 @@ use super::*;
|
||||
use codex_config::types::TuiPetAnchor;
|
||||
|
||||
pub(super) fn load_ambient_pet(
|
||||
config: &Config,
|
||||
config: &crate::local_settings::LocalSettings,
|
||||
frame_requester: FrameRequester,
|
||||
) -> Option<crate::pets::AmbientPet> {
|
||||
let selected_pet = config.tui_pet.as_deref()?;
|
||||
let selected_pet = config.tui.pet.as_deref()?;
|
||||
if selected_pet == crate::pets::DISABLED_PET_ID {
|
||||
return None;
|
||||
}
|
||||
@@ -16,19 +16,19 @@ pub(super) fn load_ambient_pet(
|
||||
Some(selected_pet),
|
||||
&config.codex_home,
|
||||
frame_requester,
|
||||
config.animations,
|
||||
config.tui.animations,
|
||||
)
|
||||
.ok()
|
||||
}
|
||||
|
||||
pub(super) fn start_configured_pet_load_if_needed(
|
||||
config: &Config,
|
||||
config: &crate::local_settings::LocalSettings,
|
||||
ambient_pet_missing: bool,
|
||||
frame_requester: FrameRequester,
|
||||
app_event_tx: AppEventSender,
|
||||
pet_http_client: codex_http_client::RouteAwareClientPool,
|
||||
) {
|
||||
let Some(pet_id) = config.tui_pet.clone() else {
|
||||
let Some(pet_id) = config.tui.pet.clone() else {
|
||||
return;
|
||||
};
|
||||
if pet_id == crate::pets::DISABLED_PET_ID || !ambient_pet_missing {
|
||||
@@ -36,7 +36,7 @@ pub(super) fn start_configured_pet_load_if_needed(
|
||||
}
|
||||
|
||||
let codex_home = config.codex_home.clone();
|
||||
let animations_enabled = config.animations;
|
||||
let animations_enabled = config.tui.animations;
|
||||
let event_pet_id = pet_id.clone();
|
||||
spawn_pet_load(
|
||||
async move {
|
||||
@@ -90,7 +90,7 @@ impl ChatWidget {
|
||||
return None;
|
||||
}
|
||||
|
||||
let anchor_bottom_y = match self.config.tui_pet_anchor {
|
||||
let anchor_bottom_y = match self.local_settings.tui.pet_anchor {
|
||||
TuiPetAnchor::Composer => composer_bottom_y,
|
||||
TuiPetAnchor::ScreenBottom => area.bottom(),
|
||||
};
|
||||
@@ -146,14 +146,15 @@ impl ChatWidget {
|
||||
self.pet_picker_preview_state.clear();
|
||||
self.pet_picker_preview_pet = None;
|
||||
let params = crate::pets::build_pet_picker_params(
|
||||
self.config.tui_pet.as_deref(),
|
||||
&self.config.codex_home,
|
||||
self.local_settings.tui.pet.as_deref(),
|
||||
&self.local_settings.codex_home,
|
||||
self.pet_picker_preview_state.clone(),
|
||||
);
|
||||
self.bottom_pane.show_selection_view(params);
|
||||
let initial_pet_id = self
|
||||
.config
|
||||
.tui_pet
|
||||
.local_settings
|
||||
.tui
|
||||
.pet
|
||||
.as_deref()
|
||||
.unwrap_or(crate::pets::DEFAULT_PET_ID)
|
||||
.to_string();
|
||||
@@ -193,10 +194,10 @@ impl ChatWidget {
|
||||
crate::pets::detect_pet_image_support()
|
||||
}
|
||||
|
||||
/// Set the pet preselected by the TUI picker in the widget's config copy.
|
||||
/// Set the pet preselected by the TUI picker in the widget's local settings.
|
||||
pub(crate) fn set_tui_pet(&mut self, pet: Option<String>) {
|
||||
self.config.tui_pet = pet;
|
||||
self.ambient_pet = load_ambient_pet(&self.config, self.frame_requester.clone());
|
||||
self.local_settings.tui.pet = pet;
|
||||
self.ambient_pet = load_ambient_pet(&self.local_settings, self.frame_requester.clone());
|
||||
self.apply_ambient_pet_image_support_override_for_tests();
|
||||
self.request_redraw();
|
||||
}
|
||||
@@ -206,7 +207,7 @@ impl ChatWidget {
|
||||
pet: Option<String>,
|
||||
ambient_pet: Option<crate::pets::AmbientPet>,
|
||||
) {
|
||||
self.config.tui_pet = pet;
|
||||
self.local_settings.tui.pet = pet;
|
||||
self.ambient_pet = ambient_pet;
|
||||
self.apply_ambient_pet_image_support_override_for_tests();
|
||||
self.request_redraw();
|
||||
@@ -238,7 +239,7 @@ impl ChatWidget {
|
||||
self.pet_picker_preview_state.set_loading();
|
||||
self.request_redraw();
|
||||
|
||||
let codex_home = self.config.codex_home.clone();
|
||||
let codex_home = self.local_settings.codex_home.clone();
|
||||
let frame_requester = self.frame_requester.clone();
|
||||
let tx = self.app_event_tx.clone();
|
||||
let pet_http_client = self.pet_http_client.clone();
|
||||
|
||||
@@ -343,7 +343,7 @@ impl ChatWidget {
|
||||
view_id: Some(PLUGINS_SELECTION_VIEW_ID),
|
||||
header: Box::new(DelayedLoadingHeader::new(
|
||||
self.frame_requester.clone(),
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
"Loading available plugins...".to_string(),
|
||||
Some("This updates when the marketplace list is ready.".to_string()),
|
||||
)),
|
||||
@@ -362,7 +362,7 @@ impl ChatWidget {
|
||||
view_id: Some(PLUGINS_SELECTION_VIEW_ID),
|
||||
header: Box::new(DelayedLoadingHeader::new(
|
||||
self.frame_requester.clone(),
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
"Adding marketplace...".to_string(),
|
||||
/*note*/ None,
|
||||
)),
|
||||
@@ -486,7 +486,7 @@ impl ChatWidget {
|
||||
view_id: Some(PLUGINS_SELECTION_VIEW_ID),
|
||||
header: Box::new(DelayedLoadingHeader::new(
|
||||
self.frame_requester.clone(),
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
loading_text.clone(),
|
||||
/*note*/ None,
|
||||
)),
|
||||
@@ -508,7 +508,7 @@ impl ChatWidget {
|
||||
view_id: Some(PLUGINS_SELECTION_VIEW_ID),
|
||||
header: Box::new(DelayedLoadingHeader::new(
|
||||
self.frame_requester.clone(),
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
format!("Loading details for {plugin_display_name}..."),
|
||||
/*note*/ None,
|
||||
)),
|
||||
|
||||
@@ -372,7 +372,7 @@ impl ChatWidget {
|
||||
|
||||
#[cfg_attr(not(test), allow(dead_code))]
|
||||
pub(super) fn should_prefetch_rate_limits(&self) -> bool {
|
||||
self.config.model_provider.requires_openai_auth && self.has_chatgpt_account
|
||||
self.requires_openai_auth && self.has_chatgpt_account
|
||||
}
|
||||
|
||||
fn lower_cost_preset(&self) -> Option<ModelPreset> {
|
||||
@@ -384,7 +384,7 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
fn rate_limit_switch_prompt_hidden(&self) -> bool {
|
||||
self.config
|
||||
self.local_settings
|
||||
.notices
|
||||
.hide_rate_limit_model_nudge
|
||||
.unwrap_or(false)
|
||||
@@ -598,7 +598,7 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
pub(crate) fn set_rate_limit_switch_prompt_hidden(&mut self, hidden: bool) {
|
||||
self.config.notices.hide_rate_limit_model_nudge = Some(hidden);
|
||||
self.local_settings.notices.hide_rate_limit_model_nudge = Some(hidden);
|
||||
if hidden {
|
||||
self.rate_limit_switch_prompt = RateLimitSwitchPromptState::Idle;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ impl ChatWidget {
|
||||
self.flush_answer_stream_with_separator();
|
||||
self.flush_active_cell();
|
||||
self.transcript.active_cell = Some(Box::new(history_cell::ThreadRecapLoadingCell::new(
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
)));
|
||||
self.bump_active_cell_revision();
|
||||
self.request_redraw();
|
||||
|
||||
@@ -28,6 +28,7 @@ impl ChatWidget {
|
||||
pub(crate) fn service_tier_update_for_core(&self) -> Option<Option<String>> {
|
||||
service_tier_resolution::service_tier_update_for_core(
|
||||
&self.config,
|
||||
&self.local_settings.notices,
|
||||
self.current_model(),
|
||||
&self.model_catalog.try_list_models().unwrap_or_default(),
|
||||
)
|
||||
@@ -151,6 +152,7 @@ impl ChatWidget {
|
||||
pub(super) fn refresh_effective_service_tier(&mut self) {
|
||||
self.effective_service_tier = service_tier_resolution::effective_service_tier(
|
||||
&self.config,
|
||||
&self.local_settings.notices,
|
||||
self.current_model(),
|
||||
&self.model_catalog.try_list_models().unwrap_or_default(),
|
||||
);
|
||||
|
||||
@@ -129,6 +129,7 @@ impl ChatWidget {
|
||||
.should_show_fast_status(&model_for_header, self.effective_service_tier.as_deref());
|
||||
let session_info_cell = history_cell::new_session_info(
|
||||
&self.config,
|
||||
&self.local_settings,
|
||||
&model_for_header,
|
||||
&session,
|
||||
self.show_welcome_banner,
|
||||
|
||||
@@ -123,12 +123,12 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
pub(crate) fn set_world_writable_warning_acknowledged(&mut self, acknowledged: bool) {
|
||||
self.config.notices.hide_world_writable_warning = Some(acknowledged);
|
||||
self.local_settings.notices.hide_world_writable_warning = Some(acknowledged);
|
||||
}
|
||||
|
||||
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
|
||||
pub(crate) fn world_writable_warning_hidden(&self) -> bool {
|
||||
self.config
|
||||
self.local_settings
|
||||
.notices
|
||||
.hide_world_writable_warning
|
||||
.unwrap_or(false)
|
||||
@@ -256,7 +256,7 @@ impl ChatWidget {
|
||||
|
||||
/// Set the syntax theme override in the widget's config copy.
|
||||
pub(crate) fn set_tui_theme(&mut self, theme: Option<String>) {
|
||||
self.config.tui_theme = theme;
|
||||
self.local_settings.tui.theme = theme;
|
||||
}
|
||||
|
||||
/// Set the model in the widget's config copy and stored collaboration mode.
|
||||
|
||||
@@ -9,7 +9,7 @@ impl ChatWidget {
|
||||
pub(super) fn open_theme_picker(&mut self) {
|
||||
let codex_home = codex_utils_home_dir::find_codex_home().ok();
|
||||
let params = crate::theme_picker::build_theme_picker_params(
|
||||
self.config.tui_theme.as_deref(),
|
||||
self.local_settings.tui.theme.as_deref(),
|
||||
codex_home.as_deref(),
|
||||
self.last_rendered_width.get(),
|
||||
);
|
||||
|
||||
@@ -743,7 +743,8 @@ impl ChatWidget {
|
||||
SlashCommand::Keymap => match trimmed.to_ascii_lowercase().as_str() {
|
||||
"" => self.open_keymap_picker(),
|
||||
"debug" => {
|
||||
match crate::keymap::RuntimeKeymap::from_config(&self.config.tui_keymap) {
|
||||
match crate::keymap::RuntimeKeymap::from_config(&self.local_settings.tui.keymap)
|
||||
{
|
||||
Ok(runtime_keymap) => self.open_keymap_debug(&runtime_keymap),
|
||||
Err(err) => {
|
||||
self.add_error_message(format!(
|
||||
|
||||
@@ -40,15 +40,16 @@ impl ChatWidget {
|
||||
StatusDetailsCapitalization::Preserve,
|
||||
details_max_lines,
|
||||
);
|
||||
let title_uses_status = self
|
||||
.config
|
||||
.tui_terminal_title
|
||||
.as_ref()
|
||||
.is_some_and(|items| {
|
||||
items
|
||||
.iter()
|
||||
.any(|item| item == "run-state" || item == "status")
|
||||
});
|
||||
let title_uses_status =
|
||||
self.local_settings
|
||||
.tui
|
||||
.terminal_title
|
||||
.as_ref()
|
||||
.is_some_and(|items| {
|
||||
items
|
||||
.iter()
|
||||
.any(|item| item == "run-state" || item == "status")
|
||||
});
|
||||
if title_uses_status {
|
||||
self.refresh_status_surfaces();
|
||||
}
|
||||
@@ -115,19 +116,20 @@ impl ChatWidget {
|
||||
"status line setup confirmed with items: {items:#?}, use_theme_colors: {use_theme_colors}"
|
||||
);
|
||||
let ids = items.iter().map(ToString::to_string).collect::<Vec<_>>();
|
||||
self.config.tui_status_line = Some(ids);
|
||||
self.config.tui_status_line_use_colors = use_theme_colors;
|
||||
self.local_settings.tui.status_line = Some(ids);
|
||||
self.local_settings.tui.status_line_use_colors = use_theme_colors;
|
||||
self.refresh_status_line();
|
||||
}
|
||||
|
||||
/// Applies a temporary terminal-title selection while the setup UI is open.
|
||||
pub(crate) fn preview_terminal_title(&mut self, items: Vec<TerminalTitleItem>) {
|
||||
if self.terminal_title_setup_original_items.is_none() {
|
||||
self.terminal_title_setup_original_items = Some(self.config.tui_terminal_title.clone());
|
||||
self.terminal_title_setup_original_items =
|
||||
Some(self.local_settings.tui.terminal_title.clone());
|
||||
}
|
||||
|
||||
let ids = items.iter().map(ToString::to_string).collect::<Vec<_>>();
|
||||
self.config.tui_terminal_title = Some(ids);
|
||||
self.local_settings.tui.terminal_title = Some(ids);
|
||||
self.refresh_terminal_title();
|
||||
}
|
||||
|
||||
@@ -138,7 +140,7 @@ impl ChatWidget {
|
||||
return;
|
||||
};
|
||||
|
||||
self.config.tui_terminal_title = original_items;
|
||||
self.local_settings.tui.terminal_title = original_items;
|
||||
self.refresh_terminal_title();
|
||||
}
|
||||
|
||||
@@ -156,7 +158,7 @@ impl ChatWidget {
|
||||
tracing::info!("terminal title setup confirmed with items: {items:#?}");
|
||||
let ids = items.iter().map(ToString::to_string).collect::<Vec<_>>();
|
||||
self.terminal_title_setup_original_items = None;
|
||||
self.config.tui_terminal_title = Some(ids);
|
||||
self.local_settings.tui.terminal_title = Some(ids);
|
||||
self.refresh_terminal_title();
|
||||
}
|
||||
|
||||
@@ -227,6 +229,7 @@ impl ChatWidget {
|
||||
crate::status::compose_agents_summary(&self.config, &self.instruction_source_paths);
|
||||
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.remote_connection.as_ref(),
|
||||
self.status_account_display.as_ref(),
|
||||
@@ -301,7 +304,7 @@ impl ChatWidget {
|
||||
let configured_status_line_items = self.configured_status_line_items();
|
||||
let view = StatusLineSetupView::new(
|
||||
Some(configured_status_line_items.as_slice()),
|
||||
self.config.tui_status_line_use_colors,
|
||||
self.local_settings.tui.status_line_use_colors,
|
||||
self.status_surface_preview_data(),
|
||||
self.app_event_tx.clone(),
|
||||
self.bottom_pane.list_keymap(),
|
||||
@@ -311,7 +314,8 @@ impl ChatWidget {
|
||||
|
||||
pub(super) fn open_terminal_title_setup(&mut self) {
|
||||
let configured_terminal_title_items = self.configured_terminal_title_items();
|
||||
self.terminal_title_setup_original_items = Some(self.config.tui_terminal_title.clone());
|
||||
self.terminal_title_setup_original_items =
|
||||
Some(self.local_settings.tui.terminal_title.clone());
|
||||
let view = TerminalTitleSetupView::new(
|
||||
Some(configured_terminal_title_items.as_slice()),
|
||||
self.terminal_title_preview_data(),
|
||||
|
||||
@@ -215,7 +215,7 @@ impl ChatWidget {
|
||||
|
||||
self.set_status_line(status_line_from_segments(
|
||||
segments,
|
||||
self.config.tui_status_line_use_colors,
|
||||
self.local_settings.tui.status_line_use_colors,
|
||||
));
|
||||
let hyperlink_url = selections
|
||||
.status_line_items
|
||||
@@ -358,7 +358,7 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
fn action_required_terminal_title_prefix_at(&self, now: Instant) -> &'static str {
|
||||
if !self.config.animations {
|
||||
if !self.local_settings.tui.animations {
|
||||
return TERMINAL_TITLE_ACTION_REQUIRED_PREFIX;
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ impl ChatWidget {
|
||||
&self,
|
||||
selections: &StatusSurfaceSelections,
|
||||
) -> Option<Duration> {
|
||||
if self.config.animations
|
||||
if self.local_settings.tui.animations
|
||||
&& self.terminal_title_shows_action_required_with_selections(selections)
|
||||
{
|
||||
return Some(TERMINAL_TITLE_ACTION_REQUIRED_INTERVAL);
|
||||
@@ -423,12 +423,16 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
pub(super) fn configured_status_line_items(&self) -> Vec<String> {
|
||||
self.config.tui_status_line.clone().unwrap_or_else(|| {
|
||||
DEFAULT_STATUS_LINE_ITEMS
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect()
|
||||
})
|
||||
self.local_settings
|
||||
.tui
|
||||
.status_line
|
||||
.clone()
|
||||
.unwrap_or_else(|| {
|
||||
DEFAULT_STATUS_LINE_ITEMS
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
||||
/// Parses configured terminal-title ids into known items and collects unknown ids.
|
||||
@@ -440,12 +444,16 @@ impl ChatWidget {
|
||||
|
||||
/// Returns the configured terminal-title ids, or the default ordering when unset.
|
||||
pub(super) fn configured_terminal_title_items(&self) -> Vec<String> {
|
||||
self.config.tui_terminal_title.clone().unwrap_or_else(|| {
|
||||
DEFAULT_TERMINAL_TITLE_ITEMS
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect()
|
||||
})
|
||||
self.local_settings
|
||||
.tui
|
||||
.terminal_title
|
||||
.clone()
|
||||
.unwrap_or_else(|| {
|
||||
DEFAULT_TERMINAL_TITLE_ITEMS
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
||||
fn status_line_cwd(&self) -> &Path {
|
||||
@@ -960,7 +968,7 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
pub(super) fn terminal_title_spinner_text_at(&self, now: Instant) -> Option<String> {
|
||||
if !self.config.animations {
|
||||
if !self.local_settings.tui.animations {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -979,11 +987,15 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
fn terminal_title_uses_activity(&self) -> bool {
|
||||
self.config.tui_terminal_title.as_ref().is_none_or(|items| {
|
||||
items
|
||||
.iter()
|
||||
.any(|item| item == "activity" || item == "spinner")
|
||||
})
|
||||
self.local_settings
|
||||
.tui
|
||||
.terminal_title
|
||||
.as_ref()
|
||||
.is_none_or(|items| {
|
||||
items
|
||||
.iter()
|
||||
.any(|item| item == "activity" || item == "spinner")
|
||||
})
|
||||
}
|
||||
|
||||
fn terminal_title_has_active_progress(&self) -> bool {
|
||||
@@ -995,20 +1007,20 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
pub(super) fn should_animate_terminal_title_spinner(&self) -> bool {
|
||||
self.config.animations
|
||||
self.local_settings.tui.animations
|
||||
&& self.terminal_title_uses_activity()
|
||||
&& self.terminal_title_has_active_progress()
|
||||
}
|
||||
|
||||
pub(super) fn should_animate_terminal_title_action_required(&self) -> bool {
|
||||
self.config.animations && self.terminal_title_shows_action_required()
|
||||
self.local_settings.tui.animations && self.terminal_title_shows_action_required()
|
||||
}
|
||||
|
||||
fn should_animate_terminal_title_spinner_with_selections(
|
||||
&self,
|
||||
selections: &StatusSurfaceSelections,
|
||||
) -> bool {
|
||||
self.config.animations
|
||||
self.local_settings.tui.animations
|
||||
&& selections
|
||||
.terminal_title_items
|
||||
.contains(&TerminalTitleItem::Spinner)
|
||||
|
||||
@@ -319,10 +319,10 @@ async fn backend_banner_fallback_candidates_and_notice_follow_selected_model() {
|
||||
json!(["hidden-model", "test-model-c", "test-model-b"]);
|
||||
chat.update_backend_banner(&response);
|
||||
assert_eq!(chat.backend_banner_fallback(), Some(models[2].clone()));
|
||||
// A retained ChatGPT login must not change a task using a custom provider.
|
||||
chat.config.model_provider.requires_openai_auth = false;
|
||||
// A retained ChatGPT login must not change a task whose server does not require auth.
|
||||
chat.requires_openai_auth = false;
|
||||
assert_eq!(chat.backend_banner_fallback(), None);
|
||||
chat.config.model_provider.requires_openai_auth = true;
|
||||
chat.requires_openai_auth = true;
|
||||
let mut mode = chat.effective_collaboration_mode();
|
||||
mode.settings.model = "test-model-c".into();
|
||||
chat.finish_backend_banner_fallback(mode);
|
||||
|
||||
@@ -1243,7 +1243,7 @@ async fn startup_draft_handoff_keeps_vim_insert_mode_for_nonempty_drafts() {
|
||||
let startup_draft = startup_chat.bottom_pane.composer_draft_snapshot();
|
||||
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_vim_mode_default = true;
|
||||
chat.local_settings.tui.vim_mode_default = true;
|
||||
chat.bottom_pane.set_vim_enabled(/*enabled*/ true);
|
||||
chat.restore_startup_draft(startup_draft);
|
||||
chat.bottom_pane
|
||||
|
||||
@@ -184,6 +184,8 @@ pub(super) async fn make_chatwidget_manual_with_auth(
|
||||
let session_telemetry = test_session_telemetry(&cfg, resolved_model.as_str());
|
||||
let model_catalog = test_model_catalog(&cfg);
|
||||
let common = ChatWidgetInit {
|
||||
requires_openai_auth: cfg.model_provider.requires_openai_auth,
|
||||
local_settings: crate::local_settings::LocalSettings::from(&cfg),
|
||||
config: cfg,
|
||||
frame_requester,
|
||||
app_event_tx,
|
||||
|
||||
@@ -14,7 +14,7 @@ async fn permission_shortcuts_cycle_builtin_modes() {
|
||||
chat.chat_keymap.previous_permission_mode = vec![crate::key_hint::plain(KeyCode::F(7))];
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
for (current, reviewer, key, expected, next_reviewer) in [
|
||||
|
||||
@@ -271,7 +271,7 @@ async fn profile_permissions_full_access_always_opens_confirmation() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.explicit_permission_profile_mode = true;
|
||||
chat.set_feature_enabled(Feature::GuardianApproval, /*enabled*/ false);
|
||||
chat.config.notices.hide_full_access_warning = Some(true);
|
||||
chat.local_settings.notices.hide_full_access_warning = Some(true);
|
||||
|
||||
chat.open_permissions_popup();
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::Up));
|
||||
@@ -852,7 +852,7 @@ async fn permissions_selection_emits_history_cell_when_selection_changes() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.set_feature_enabled(Feature::GuardianApproval, /*enabled*/ true);
|
||||
@@ -878,7 +878,7 @@ async fn permissions_selection_history_snapshot_after_mode_switch() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.set_feature_enabled(Feature::GuardianApproval, /*enabled*/ false);
|
||||
@@ -915,7 +915,7 @@ async fn permissions_selection_history_snapshot_full_access_to_default() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.config
|
||||
@@ -957,7 +957,7 @@ async fn permissions_selection_emits_history_cell_when_current_is_selected() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.config
|
||||
@@ -991,7 +991,7 @@ async fn permissions_selection_hides_auto_review_when_feature_disabled() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.set_feature_enabled(Feature::GuardianApproval, /*enabled*/ false);
|
||||
@@ -1010,7 +1010,7 @@ async fn permissions_selection_hides_auto_review_when_feature_disabled_even_if_a
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.set_feature_enabled(Feature::GuardianApproval, /*enabled*/ false);
|
||||
@@ -1039,7 +1039,7 @@ async fn permissions_selection_marks_auto_review_current_after_session_configure
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
let _ = chat
|
||||
@@ -1084,7 +1084,7 @@ async fn permissions_selection_marks_auto_review_current_with_custom_workspace_w
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
let _ = chat
|
||||
@@ -1133,7 +1133,7 @@ async fn permissions_selection_can_disable_auto_review() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.set_feature_enabled(Feature::GuardianApproval, /*enabled*/ true);
|
||||
@@ -1173,7 +1173,7 @@ async fn permissions_selection_sends_approvals_reviewer_in_override_turn_context
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.set_feature_enabled(Feature::GuardianApproval, /*enabled*/ true);
|
||||
@@ -1254,7 +1254,7 @@ async fn permissions_full_access_history_cell_emitted_only_after_confirmation()
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
chat.config.notices.hide_world_writable_warning = Some(true);
|
||||
chat.local_settings.notices.hide_world_writable_warning = Some(true);
|
||||
chat.set_windows_sandbox_mode(Some(WindowsSandboxModeToml::Unelevated));
|
||||
}
|
||||
chat.set_feature_enabled(Feature::GuardianApproval, /*enabled*/ false);
|
||||
|
||||
@@ -549,7 +549,7 @@ fn plan_mode_prompt_notification_uses_dedicated_type_name() {
|
||||
#[tokio::test]
|
||||
async fn open_plan_implementation_prompt_sets_pending_notification() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
chat.config.tui_notifications.notifications =
|
||||
chat.local_settings.tui.notification_settings.notifications =
|
||||
Notifications::Custom(vec!["plan-mode-prompt".to_string()]);
|
||||
|
||||
chat.open_plan_implementation_prompt();
|
||||
@@ -563,7 +563,7 @@ async fn open_plan_implementation_prompt_sets_pending_notification() {
|
||||
#[tokio::test]
|
||||
async fn open_plan_reasoning_scope_prompt_sets_pending_notification() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
chat.config.tui_notifications.notifications =
|
||||
chat.local_settings.tui.notification_settings.notifications =
|
||||
Notifications::Custom(vec!["plan-mode-prompt".to_string()]);
|
||||
|
||||
chat.open_plan_reasoning_scope_prompt("gpt-5.4".to_string(), Some(ReasoningEffortConfig::High));
|
||||
@@ -624,7 +624,7 @@ async fn request_user_input_notification_overrides_pending_agent_turn_complete_n
|
||||
#[tokio::test]
|
||||
async fn handle_request_user_input_sets_pending_notification() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
chat.config.tui_notifications.notifications =
|
||||
chat.local_settings.tui.notification_settings.notifications =
|
||||
Notifications::Custom(vec!["plan-mode-prompt".to_string()]);
|
||||
|
||||
chat.handle_request_user_input_now(ToolRequestUserInputParams {
|
||||
@@ -1630,6 +1630,8 @@ async fn make_startup_chat_with_cli_overrides(
|
||||
let resolved_model = get_model_offline_for_tests(cfg.model.as_deref());
|
||||
let session_telemetry = test_session_telemetry(&cfg, resolved_model.as_str());
|
||||
let init = ChatWidgetInit {
|
||||
requires_openai_auth: true,
|
||||
local_settings: crate::local_settings::LocalSettings::from(&cfg),
|
||||
config: cfg.clone(),
|
||||
frame_requester: FrameRequester::test_dummy(),
|
||||
app_event_tx: AppEventSender::new(unbounded_channel::<AppEvent>().0),
|
||||
|
||||
@@ -35,6 +35,8 @@ async fn experimental_mode_plan_is_ignored_on_startup() {
|
||||
let resolved_model = get_model_offline_for_tests(cfg.model.as_deref());
|
||||
let session_telemetry = test_session_telemetry(&cfg, resolved_model.as_str());
|
||||
let init = ChatWidgetInit {
|
||||
requires_openai_auth: true,
|
||||
local_settings: crate::local_settings::LocalSettings::from(&cfg),
|
||||
config: cfg.clone(),
|
||||
frame_requester: FrameRequester::test_dummy(),
|
||||
app_event_tx: AppEventSender::new(unbounded_channel::<AppEvent>().0),
|
||||
|
||||
@@ -302,7 +302,7 @@ async fn slash_side_requests_forked_side_question_while_task_running() {
|
||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
let parent_thread_id = ThreadId::new();
|
||||
chat.thread_id = Some(parent_thread_id);
|
||||
chat.config.tui_status_line = Some(vec!["model-with-reasoning".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["model-with-reasoning".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
chat.on_task_started();
|
||||
chat.show_welcome_banner = false;
|
||||
@@ -385,7 +385,7 @@ async fn slash_btw_requests_forked_side_question_while_task_running() {
|
||||
async fn side_context_label_preserves_status_line_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.tui_status_line = Some(vec!["model-name".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["model-name".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
chat.set_side_conversation_active(/*active*/ true);
|
||||
chat.set_side_conversation_context_label(Some(
|
||||
@@ -427,7 +427,7 @@ async fn side_context_label_shows_parent_status_snapshot() {
|
||||
async fn side_context_label_shows_hidden_side_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.tui_status_line = Some(vec!["model-name".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["model-name".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
chat.set_side_conversation_context_label(Some("ctrl + / for side".to_string()));
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ async fn resumed_session_hides_unknown_token_usage_until_an_update_arrives() {
|
||||
@"(hidden)"
|
||||
);
|
||||
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"context-remaining".to_string(),
|
||||
"context-used".to_string(),
|
||||
"total-input-tokens".to_string(),
|
||||
@@ -489,6 +489,8 @@ async fn configured_pet_load_is_deferred_until_after_construction() {
|
||||
let resolved_model = get_model_offline_for_tests(cfg.model.as_deref());
|
||||
let session_telemetry = test_session_telemetry(&cfg, resolved_model.as_str());
|
||||
let init = ChatWidgetInit {
|
||||
requires_openai_auth: true,
|
||||
local_settings: crate::local_settings::LocalSettings::from(&cfg),
|
||||
config: cfg.clone(),
|
||||
frame_requester: FrameRequester::test_dummy(),
|
||||
app_event_tx: tx,
|
||||
@@ -532,10 +534,14 @@ async fn prefetch_rate_limits_is_gated_on_chatgpt_auth_provider() {
|
||||
|
||||
assert!(!chat.should_prefetch_rate_limits());
|
||||
|
||||
// The server requires auth even if the local provider does not.
|
||||
chat.config.model_provider.requires_openai_auth = false;
|
||||
set_chatgpt_auth(&mut chat);
|
||||
assert!(chat.should_prefetch_rate_limits());
|
||||
|
||||
chat.config.model_provider.requires_openai_auth = false;
|
||||
// Conversely, a local OpenAI provider cannot enable usage for a different server.
|
||||
chat.config.model_provider.requires_openai_auth = true;
|
||||
chat.requires_openai_auth = false;
|
||||
assert!(!chat.should_prefetch_rate_limits());
|
||||
|
||||
chat.prefetch_rate_limits();
|
||||
@@ -1699,7 +1705,7 @@ async fn account_update_clears_derived_usage_limit_state_and_prompt() {
|
||||
async fn rate_limit_switch_prompt_respects_hidden_notice() {
|
||||
let (mut chat, _, _) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
chat.has_chatgpt_account = true;
|
||||
chat.config.notices.hide_rate_limit_model_nudge = Some(true);
|
||||
chat.local_settings.notices.hide_rate_limit_model_nudge = Some(true);
|
||||
|
||||
chat.on_rate_limit_snapshot(Some(snapshot(/*percent*/ 95.0)));
|
||||
|
||||
@@ -2474,7 +2480,7 @@ async fn ambient_pet_screen_bottom_anchor_uses_terminal_bottom() {
|
||||
.expect("composer-anchored pet draw request");
|
||||
assert_eq!(default_draw.y, 14);
|
||||
|
||||
chat.config.tui_pet_anchor = TuiPetAnchor::ScreenBottom;
|
||||
chat.local_settings.tui.pet_anchor = TuiPetAnchor::ScreenBottom;
|
||||
let screen_bottom_draw = chat
|
||||
.ambient_pet_draw(terminal_area, composer_bottom_y)
|
||||
.expect("screen-bottom anchored pet draw request");
|
||||
@@ -2861,7 +2867,7 @@ async fn repeated_generic_warning_is_not_hidden() {
|
||||
#[tokio::test]
|
||||
async fn status_line_invalid_items_warn_once() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"model_name".to_string(),
|
||||
"bogus_item".to_string(),
|
||||
"lines_changed".to_string(),
|
||||
@@ -2890,7 +2896,7 @@ async fn status_line_invalid_items_warn_once() {
|
||||
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.local_settings.tui.status_line = Some(vec!["hostname".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
|
||||
@@ -2905,7 +2911,7 @@ async fn status_line_hostname_renders_current_machine_hostname() {
|
||||
async fn status_line_context_used_renders_labeled_percent() {
|
||||
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!["context-used".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["context-used".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
|
||||
@@ -2920,7 +2926,7 @@ async fn status_line_context_used_renders_labeled_percent() {
|
||||
async fn status_line_context_remaining_renders_labeled_percent() {
|
||||
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!["context-remaining".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["context-remaining".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
|
||||
@@ -2938,7 +2944,7 @@ async fn status_line_context_remaining_renders_labeled_percent() {
|
||||
async fn status_line_legacy_context_usage_renders_context_used_percent() {
|
||||
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!["context-usage".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["context-usage".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
|
||||
@@ -2956,7 +2962,7 @@ async fn status_line_estimated_thread_cost_fetches_and_renders_backend_estimate(
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
assert_eq!(status_line_text(&chat), None);
|
||||
@@ -2992,7 +2998,7 @@ async fn status_line_thread_credits_fetches_and_renders_fractional_credits() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["thread-credits".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["thread-credits".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
assert_eq!(status_line_text(&chat), None);
|
||||
@@ -3028,7 +3034,7 @@ async fn status_line_thread_credits_and_cost_share_one_backend_request() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
@@ -3064,7 +3070,7 @@ async fn status_line_thread_credits_remain_visible_when_usd_is_unavailable() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
@@ -3099,8 +3105,8 @@ async fn terminal_title_thread_usage_fetches_and_renders_without_status_line() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(Vec::new());
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(Vec::new());
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
@@ -3142,8 +3148,8 @@ async fn terminal_title_thread_credits_remain_visible_when_usd_is_unavailable()
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(Vec::new());
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(Vec::new());
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
@@ -3178,8 +3184,8 @@ async fn terminal_title_and_status_line_share_one_thread_usage_request() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.config.tui_terminal_title = Some(vec!["thread-credits".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.terminal_title = Some(vec!["thread-credits".to_string()]);
|
||||
|
||||
chat.refresh_status_surfaces();
|
||||
let request_id = match rx.try_recv() {
|
||||
@@ -3211,7 +3217,7 @@ async fn status_line_estimated_thread_cost_avoids_unsupported_plan_requests() {
|
||||
chat.thread_id = Some(ThreadId::new());
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Pro);
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"estimated-thread-cost".to_string(),
|
||||
"run-state".to_string(),
|
||||
]);
|
||||
@@ -3232,7 +3238,7 @@ async fn status_line_estimated_thread_cost_stops_after_backend_disables_feature(
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::EnterpriseCbpAutomation);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let request_id = match rx.try_recv() {
|
||||
Ok(AppEvent::RefreshThreadUsage { request_id, .. }) => request_id,
|
||||
@@ -3257,7 +3263,7 @@ async fn status_line_estimated_thread_cost_preserves_cached_amount_during_settle
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
Ok(AppEvent::RefreshThreadUsage { request_id, .. }) => request_id,
|
||||
@@ -3304,7 +3310,7 @@ async fn completed_turn_refreshes_estimated_thread_cost() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
@@ -3355,8 +3361,8 @@ async fn completed_turn_refreshes_credits_only_terminal_title() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(Vec::new());
|
||||
chat.config.tui_terminal_title = Some(vec!["thread-credits".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(Vec::new());
|
||||
chat.local_settings.tui.terminal_title = Some(vec!["thread-credits".to_string()]);
|
||||
chat.refresh_terminal_title();
|
||||
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
@@ -3407,7 +3413,7 @@ async fn interrupted_turn_refreshes_estimated_thread_usage() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
@@ -3448,7 +3454,7 @@ async fn failed_turn_refreshes_estimated_thread_usage() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
@@ -3493,7 +3499,7 @@ async fn status_line_estimated_thread_cost_rejects_stale_thread_completions() {
|
||||
chat.thread_id = Some(previous_thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let previous_request_id = match rx.try_recv() {
|
||||
Ok(AppEvent::RefreshThreadUsage { request_id, .. }) => request_id,
|
||||
@@ -3542,7 +3548,7 @@ async fn status_line_estimated_thread_cost_footer_snapshot() {
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"model-with-reasoning".to_string(),
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
@@ -3579,7 +3585,7 @@ async fn status_line_estimated_thread_cost_footer_snapshot() {
|
||||
async fn status_line_workspace_headline_renders_cached_value() {
|
||||
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!["workspace-headline".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.status_line_workspace_headline = Some("Workspace maintenance starts at 5pm".to_string());
|
||||
|
||||
chat.refresh_status_line();
|
||||
@@ -3598,7 +3604,7 @@ async fn status_line_workspace_headline_renders_cached_value() {
|
||||
async fn status_line_workspace_headline_omits_when_unavailable() {
|
||||
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![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"workspace-headline".to_string(),
|
||||
"run-state".to_string(),
|
||||
]);
|
||||
@@ -3615,7 +3621,7 @@ async fn status_line_workspace_headline_omits_when_unavailable() {
|
||||
#[tokio::test]
|
||||
async fn workspace_headline_update_applies_feature_disabled_result() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.status_line_workspace_headline = Some("Old headline".to_string());
|
||||
let request_id = 3;
|
||||
chat.status_line_workspace_headline_pending_request_id = Some(request_id);
|
||||
@@ -3632,7 +3638,7 @@ async fn workspace_headline_update_applies_feature_disabled_result() {
|
||||
#[tokio::test]
|
||||
async fn workspace_headline_update_applies_available_headline() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
let request_id = 4;
|
||||
chat.status_line_workspace_headline_pending_request_id = Some(request_id);
|
||||
|
||||
@@ -3655,7 +3661,7 @@ async fn workspace_headline_update_applies_available_headline() {
|
||||
#[tokio::test]
|
||||
async fn account_update_clears_workspace_headline_state() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.status_line_workspace_headline = Some("Old workspace headline".to_string());
|
||||
chat.status_line_workspace_headline_pending_request_id = Some(5);
|
||||
chat.status_line_workspace_headline_last_requested_at = Some(Instant::now());
|
||||
@@ -3680,7 +3686,7 @@ async fn account_update_clears_workspace_headline_state() {
|
||||
#[tokio::test]
|
||||
async fn workspace_headline_fetch_allows_backend_auth_without_chatgpt_account() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
|
||||
chat.update_account_state(
|
||||
/*status_account_display*/ None, /*plan_type*/ None,
|
||||
@@ -3697,7 +3703,7 @@ async fn workspace_headline_fetch_allows_backend_auth_without_chatgpt_account()
|
||||
#[tokio::test]
|
||||
async fn account_update_discards_stale_workspace_headline_results() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
|
||||
chat.update_account_state(
|
||||
Some(StatusAccountDisplay::ChatGpt {
|
||||
@@ -3767,7 +3773,7 @@ async fn status_line_branch_state_resets_when_git_branch_disabled() {
|
||||
chat.status_line_branch = Some("main".to_string());
|
||||
chat.status_line_branch_pending = true;
|
||||
chat.status_line_branch_lookup_complete = true;
|
||||
chat.config.tui_status_line = Some(vec!["model_name".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["model_name".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
|
||||
@@ -3780,7 +3786,7 @@ async fn status_line_branch_state_resets_when_git_branch_disabled() {
|
||||
async fn status_line_branch_refreshes_after_turn_complete() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
install_noop_workspace_command_runner(&mut chat);
|
||||
chat.config.tui_status_line = Some(vec!["git-branch".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["git-branch".to_string()]);
|
||||
chat.status_line_branch_lookup_complete = true;
|
||||
chat.status_line_branch_pending = false;
|
||||
|
||||
@@ -3793,7 +3799,7 @@ async fn status_line_branch_refreshes_after_turn_complete() {
|
||||
async fn status_line_branch_refreshes_after_interrupt() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
install_noop_workspace_command_runner(&mut chat);
|
||||
chat.config.tui_status_line = Some(vec!["git-branch".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["git-branch".to_string()]);
|
||||
chat.status_line_branch_lookup_complete = true;
|
||||
chat.status_line_branch_pending = false;
|
||||
|
||||
@@ -3891,7 +3897,7 @@ async fn completed_turn_clears_visible_running_hook() {
|
||||
async fn status_line_fast_mode_renders_on_and_off() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
set_fast_mode_test_catalog(&mut chat);
|
||||
chat.config.tui_status_line = Some(vec!["fast-mode".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["fast-mode".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
assert_eq!(status_line_text(&chat), Some("Fast off".to_string()));
|
||||
@@ -3905,7 +3911,7 @@ async fn status_line_fast_mode_renders_on_and_off() {
|
||||
async fn status_line_fast_mode_updates_visibility_on_model_change() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
set_fast_mode_test_catalog(&mut chat);
|
||||
chat.config.tui_status_line = Some(vec!["fast-mode".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["fast-mode".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
assert_eq!(status_line_text(&chat), Some("Fast off".to_string()));
|
||||
@@ -3930,7 +3936,7 @@ async fn status_line_fast_mode_footer_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.2")).await;
|
||||
set_fast_mode_test_catalog(&mut chat);
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"model-with-reasoning".to_string(),
|
||||
"fast-mode".to_string(),
|
||||
]);
|
||||
@@ -3955,7 +3961,7 @@ async fn status_line_model_with_reasoning_includes_fast_for_fast_capable_models(
|
||||
set_fast_mode_test_catalog(&mut chat);
|
||||
assert!(get_available_model(&chat, "gpt-5.4").supports_fast_mode());
|
||||
chat.config.cwd = test_project_path().abs();
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"model-with-reasoning".to_string(),
|
||||
"context-used".to_string(),
|
||||
"current-dir".to_string(),
|
||||
@@ -3985,7 +3991,7 @@ async fn status_line_model_with_reasoning_includes_fast_for_fast_capable_models(
|
||||
#[tokio::test]
|
||||
async fn terminal_title_model_updates_on_model_change_without_manual_refresh() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
chat.config.tui_terminal_title = Some(vec!["model".to_string()]);
|
||||
chat.local_settings.tui.terminal_title = Some(vec!["model".to_string()]);
|
||||
chat.refresh_terminal_title();
|
||||
|
||||
assert_eq!(chat.last_terminal_title, Some("gpt-5.4".to_string()));
|
||||
@@ -3998,8 +4004,8 @@ async fn terminal_title_model_updates_on_model_change_without_manual_refresh() {
|
||||
#[tokio::test]
|
||||
async fn status_line_and_terminal_title_reasoning_render_only_effort() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
chat.config.tui_status_line = Some(vec!["reasoning".to_string()]);
|
||||
chat.config.tui_terminal_title = Some(vec!["reasoning".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["reasoning".to_string()]);
|
||||
chat.local_settings.tui.terminal_title = Some(vec!["reasoning".to_string()]);
|
||||
chat.set_reasoning_effort(Some(ReasoningEffortConfig::XHigh));
|
||||
chat.set_service_tier(Some(ServiceTier::Fast.request_value().to_string()));
|
||||
|
||||
@@ -4014,7 +4020,7 @@ async fn status_line_and_terminal_title_reasoning_render_only_effort() {
|
||||
async fn status_line_reasoning_updates_on_mode_switch_without_manual_refresh() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.2")).await;
|
||||
chat.set_feature_enabled(Feature::CollaborationModes, /*enabled*/ true);
|
||||
chat.config.tui_status_line = Some(vec!["reasoning".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["reasoning".to_string()]);
|
||||
chat.set_reasoning_effort(Some(ReasoningEffortConfig::High));
|
||||
|
||||
assert_eq!(status_line_text(&chat), Some("high".to_string()));
|
||||
@@ -4030,7 +4036,7 @@ async fn status_line_reasoning_updates_on_mode_switch_without_manual_refresh() {
|
||||
async fn status_line_model_with_reasoning_updates_on_mode_switch_without_manual_refresh() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.2")).await;
|
||||
chat.set_feature_enabled(Feature::CollaborationModes, /*enabled*/ true);
|
||||
chat.config.tui_status_line = Some(vec!["model-with-reasoning".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["model-with-reasoning".to_string()]);
|
||||
chat.set_reasoning_effort(Some(ReasoningEffortConfig::High));
|
||||
|
||||
assert_eq!(status_line_text(&chat), Some("gpt-5.2 high".to_string()));
|
||||
@@ -4056,7 +4062,7 @@ async fn status_line_model_with_reasoning_plan_mode_footer_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.2")).await;
|
||||
chat.show_welcome_banner = false;
|
||||
chat.set_feature_enabled(Feature::CollaborationModes, /*enabled*/ true);
|
||||
chat.config.tui_status_line = Some(vec!["model-with-reasoning".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["model-with-reasoning".to_string()]);
|
||||
chat.set_reasoning_effort(Some(ReasoningEffortConfig::High));
|
||||
|
||||
let plan_mask = collaboration_modes::plan_mask(chat.model_catalog.as_ref())
|
||||
@@ -4082,7 +4088,7 @@ async fn renamed_thread_footer_title_snapshot() {
|
||||
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.2")).await;
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"model-with-reasoning".to_string(),
|
||||
"thread-title".to_string(),
|
||||
]);
|
||||
@@ -4123,7 +4129,7 @@ async fn status_line_model_with_reasoning_fast_footer_snapshot() {
|
||||
assert!(get_available_model(&chat, "gpt-5.4").supports_fast_mode());
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.cwd = test_project_path().abs();
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"model-with-reasoning".to_string(),
|
||||
"context-used".to_string(),
|
||||
"current-dir".to_string(),
|
||||
@@ -4157,7 +4163,7 @@ async fn status_line_model_with_reasoning_context_remaining_footer_snapshot() {
|
||||
assert!(get_available_model(&chat, "gpt-5.4").supports_fast_mode());
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.cwd = test_project_path().abs();
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"model-with-reasoning".to_string(),
|
||||
"context-remaining".to_string(),
|
||||
"current-dir".to_string(),
|
||||
@@ -4189,7 +4195,7 @@ async fn status_line_goal_active_token_budget_footer_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
chat.set_feature_enabled(Feature::Goals, /*enabled*/ true);
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.tui_status_line = Some(vec!["model-name".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["model-name".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
chat.handle_server_notification(
|
||||
ServerNotification::ThreadGoalUpdated(
|
||||
@@ -4226,7 +4232,7 @@ async fn status_line_goal_complete_elapsed_footer_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
chat.set_feature_enabled(Feature::Goals, /*enabled*/ true);
|
||||
chat.show_welcome_banner = false;
|
||||
chat.config.tui_status_line = Some(vec!["model-name".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["model-name".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let mut goal = test_thread_goal(
|
||||
codex_app_server_protocol::ThreadGoalStatus::Complete,
|
||||
|
||||
@@ -127,7 +127,7 @@ async fn status_line_setup_popup_live_only_snapshot() {
|
||||
cache_project_root(&mut chat, "preview-live-root");
|
||||
chat.status_line_branch = Some("feature/live-preview-branch".to_string());
|
||||
chat.thread_name = Some("Live preview thread".to_string());
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"project-name".to_string(),
|
||||
"git-branch".to_string(),
|
||||
"thread-title".to_string(),
|
||||
@@ -181,7 +181,7 @@ async fn thread_title_falls_back_to_thread_id_when_unnamed() {
|
||||
#[tokio::test]
|
||||
async fn status_line_setup_popup_hardcoded_only_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"project-name".to_string(),
|
||||
"git-branch".to_string(),
|
||||
"thread-title".to_string(),
|
||||
@@ -197,7 +197,7 @@ async fn status_line_setup_popup_hardcoded_only_snapshot() {
|
||||
async fn status_line_setup_popup_workspace_headline_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.status_line_workspace_headline = Some("Workspace maintenance starts at 5pm".to_string());
|
||||
chat.config.tui_status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["workspace-headline".to_string()]);
|
||||
|
||||
assert_chatwidget_snapshot!(
|
||||
"status_line_setup_popup_workspace_headline",
|
||||
@@ -252,11 +252,11 @@ async fn status_surface_preview_lines_thread_usage_snapshot() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
@@ -299,11 +299,11 @@ async fn status_surface_thread_usage_previews_omit_unavailable_usd_estimates() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
@@ -393,7 +393,7 @@ async fn status_surface_preview_omits_unavailable_rate_limit_items() {
|
||||
async fn status_line_setup_popup_rate_limits_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
cache_rate_limit_snapshot(&mut chat);
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"five-hour-limit".to_string(),
|
||||
"weekly-limit".to_string(),
|
||||
]);
|
||||
@@ -409,7 +409,7 @@ async fn status_line_setup_popup_mixed_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.status_line_branch = Some("feature/mixed-preview".to_string());
|
||||
chat.thread_name = Some("Mixed preview thread".to_string());
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"project-name".to_string(),
|
||||
"git-branch".to_string(),
|
||||
"thread-title".to_string(),
|
||||
@@ -428,7 +428,7 @@ async fn terminal_title_setup_popup_live_only_snapshot() {
|
||||
chat.status_line_branch = Some("feature/live-preview-branch".to_string());
|
||||
chat.thread_name = Some("Live preview thread".to_string());
|
||||
chat.transcript.last_plan_progress = Some((2, 5));
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"project-name".to_string(),
|
||||
"thread-title".to_string(),
|
||||
"git-branch".to_string(),
|
||||
@@ -444,7 +444,7 @@ async fn terminal_title_setup_popup_live_only_snapshot() {
|
||||
#[tokio::test]
|
||||
async fn terminal_title_setup_popup_hardcoded_only_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"thread-title".to_string(),
|
||||
"git-branch".to_string(),
|
||||
"task-progress".to_string(),
|
||||
@@ -460,7 +460,7 @@ async fn terminal_title_setup_popup_hardcoded_only_snapshot() {
|
||||
async fn terminal_title_setup_popup_mixed_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.thread_name = Some("Mixed preview thread".to_string());
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"project-name".to_string(),
|
||||
"thread-title".to_string(),
|
||||
"task-progress".to_string(),
|
||||
@@ -476,7 +476,7 @@ async fn terminal_title_setup_popup_mixed_snapshot() {
|
||||
async fn terminal_title_setup_popup_rate_limits_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
cache_rate_limit_snapshot(&mut chat);
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"five-hour-limit".to_string(),
|
||||
"weekly-limit".to_string(),
|
||||
]);
|
||||
@@ -490,7 +490,7 @@ async fn terminal_title_setup_popup_rate_limits_snapshot() {
|
||||
#[tokio::test]
|
||||
async fn terminal_title_setup_popup_thread_usage_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_terminal_title = Some(vec![
|
||||
chat.local_settings.tui.terminal_title = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
|
||||
@@ -127,13 +127,13 @@ async fn terminal_title_shows_action_required_while_exec_approval_is_pending() {
|
||||
assert!(chat.should_animate_terminal_title_spinner());
|
||||
|
||||
for (animations, title_items) in [(false, None), (true, Some(Vec::new()))] {
|
||||
chat.config.animations = true;
|
||||
chat.config.tui_terminal_title = None;
|
||||
chat.local_settings.tui.animations = true;
|
||||
chat.local_settings.tui.terminal_title = None;
|
||||
chat.refresh_terminal_title();
|
||||
assert!(chat.terminal_title_next_refresh.is_some());
|
||||
|
||||
chat.config.animations = animations;
|
||||
chat.config.tui_terminal_title = title_items;
|
||||
chat.local_settings.tui.animations = animations;
|
||||
chat.local_settings.tui.terminal_title = title_items;
|
||||
chat.refresh_terminal_title();
|
||||
assert!(chat.terminal_title_next_refresh.is_none());
|
||||
}
|
||||
@@ -142,7 +142,7 @@ async fn terminal_title_shows_action_required_while_exec_approval_is_pending() {
|
||||
#[tokio::test]
|
||||
async fn terminal_title_action_required_respects_spinner_setting() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.tui_terminal_title = Some(vec!["project".to_string()]);
|
||||
chat.local_settings.tui.terminal_title = Some(vec!["project".to_string()]);
|
||||
chat.bottom_pane.set_task_running(/*running*/ true);
|
||||
chat.refresh_terminal_title();
|
||||
|
||||
@@ -206,7 +206,7 @@ async fn terminal_title_action_required_blinks_when_animations_are_enabled() {
|
||||
#[tokio::test]
|
||||
async fn terminal_title_activity_indicators_do_not_animate_when_animations_are_disabled() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.animations = false;
|
||||
chat.local_settings.tui.animations = false;
|
||||
chat.bottom_pane.set_task_running(/*running*/ true);
|
||||
chat.terminal_title_animation_origin = Instant::now() - std::time::Duration::from_millis(1500);
|
||||
chat.refresh_terminal_title();
|
||||
|
||||
@@ -74,7 +74,7 @@ async fn temporary_thread_usage_failures_have_bounded_retries() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
|
||||
for attempt in 0..=THREAD_USAGE_RETRY_DELAYS.len() {
|
||||
@@ -106,7 +106,7 @@ async fn status_history_survives_exhausted_billing_retries() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let mut request_id = thread_usage_request_id(&mut rx);
|
||||
|
||||
@@ -176,7 +176,7 @@ async fn status_history_updates_again_after_billing_settles() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec![selected_item.to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec![selected_item.to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
assert!(chat.finish_thread_usage_refresh(
|
||||
@@ -258,7 +258,7 @@ async fn replayed_turn_completions_do_not_start_live_billing_refreshes() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
assert!(chat.finish_thread_usage_refresh(
|
||||
@@ -309,7 +309,7 @@ async fn replayed_errors_do_not_start_live_billing_refreshes() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
assert!(chat.finish_thread_usage_refresh(
|
||||
@@ -357,11 +357,11 @@ async fn transient_zero_cost_preserves_fresh_credits_and_breakdowns() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
chat.config.tui_terminal_title = chat.config.tui_status_line.clone();
|
||||
chat.local_settings.tui.terminal_title = chat.local_settings.tui.status_line.clone();
|
||||
chat.refresh_status_surfaces();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
assert!(chat.finish_thread_usage_refresh(
|
||||
@@ -425,8 +425,8 @@ async fn transient_zero_credits_preserves_credits_only_estimates() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["thread-credits".to_string()]);
|
||||
chat.config.tui_terminal_title = chat.config.tui_status_line.clone();
|
||||
chat.local_settings.tui.status_line = Some(vec!["thread-credits".to_string()]);
|
||||
chat.local_settings.tui.terminal_title = chat.local_settings.tui.status_line.clone();
|
||||
chat.refresh_status_surfaces();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
let previous_usage = ThreadUsage {
|
||||
@@ -481,7 +481,7 @@ async fn cost_settlement_waits_for_new_or_missing_usd_estimates() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
assert!(chat.finish_thread_usage_refresh(
|
||||
@@ -542,7 +542,7 @@ async fn credits_only_settlement_completes_without_usd_estimates() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_terminal_title = Some(vec!["thread-credits".to_string()]);
|
||||
chat.local_settings.tui.terminal_title = Some(vec!["thread-credits".to_string()]);
|
||||
chat.refresh_terminal_title();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
assert!(chat.finish_thread_usage_refresh(
|
||||
@@ -582,8 +582,8 @@ async fn combined_billing_surfaces_wait_for_credits_and_cost() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec![status_line_item.to_string()]);
|
||||
chat.config.tui_terminal_title = Some(vec![title_item.to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec![status_line_item.to_string()]);
|
||||
chat.local_settings.tui.terminal_title = Some(vec![title_item.to_string()]);
|
||||
chat.refresh_status_surfaces();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
assert!(chat.finish_thread_usage_refresh(
|
||||
@@ -640,11 +640,11 @@ async fn billing_surfaces_render_for_every_supported_enterprise_plan() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(plan_type);
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
chat.local_settings.tui.status_line = Some(vec![
|
||||
"thread-credits".to_string(),
|
||||
"estimated-thread-cost".to_string(),
|
||||
]);
|
||||
chat.config.tui_terminal_title = chat.config.tui_status_line.clone();
|
||||
chat.local_settings.tui.terminal_title = chat.local_settings.tui.status_line.clone();
|
||||
chat.refresh_status_surfaces();
|
||||
let request_id = thread_usage_request_id(&mut rx);
|
||||
assert!(chat.finish_thread_usage_refresh(
|
||||
@@ -676,7 +676,7 @@ async fn early_draw_rearms_thread_usage_retry_after_immediate_redraw() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
|
||||
let request_id = match rx.try_recv() {
|
||||
@@ -714,7 +714,7 @@ async fn unchanged_thread_usage_has_bounded_settlement_refreshes() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
@@ -772,7 +772,7 @@ async fn early_draw_rearms_thread_usage_settlement_after_immediate_redraw() {
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
@@ -834,7 +834,7 @@ async fn thread_usage_settlement_requires_request_started_after_turn_completion(
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.refresh_status_line();
|
||||
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
@@ -924,8 +924,8 @@ async fn deselecting_billing_surfaces_cancels_polling_and_preserves_status_cache
|
||||
chat.thread_id = Some(thread_id);
|
||||
chat.has_codex_backend_auth = true;
|
||||
chat.plan_type = Some(PlanType::Business);
|
||||
chat.config.tui_status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.config.tui_terminal_title = Some(vec!["thread-credits".to_string()]);
|
||||
chat.local_settings.tui.status_line = Some(vec!["estimated-thread-cost".to_string()]);
|
||||
chat.local_settings.tui.terminal_title = Some(vec!["thread-credits".to_string()]);
|
||||
chat.refresh_status_surfaces();
|
||||
|
||||
let initial_request_id = match rx.try_recv() {
|
||||
@@ -965,8 +965,8 @@ async fn deselecting_billing_surfaces_cancels_polling_and_preserves_status_cache
|
||||
};
|
||||
assert!(chat.thread_usage.settlement_refresh_due_at.is_some());
|
||||
|
||||
chat.config.tui_status_line = Some(Vec::new());
|
||||
chat.config.tui_terminal_title = Some(Vec::new());
|
||||
chat.local_settings.tui.status_line = Some(Vec::new());
|
||||
chat.local_settings.tui.terminal_title = Some(Vec::new());
|
||||
chat.refresh_status_surfaces();
|
||||
|
||||
assert!(!chat.thread_usage.status_requested);
|
||||
|
||||
@@ -74,7 +74,7 @@ impl ChatWidget {
|
||||
self.transcript.active_cell = Some(Box::new(history_cell::new_active_web_search_call(
|
||||
call_id,
|
||||
String::new(),
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
)));
|
||||
self.bump_active_cell_revision();
|
||||
self.request_redraw();
|
||||
@@ -184,7 +184,7 @@ impl ChatWidget {
|
||||
tool,
|
||||
arguments: Some(arguments),
|
||||
},
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
)));
|
||||
self.bump_active_cell_revision();
|
||||
self.request_redraw();
|
||||
@@ -236,8 +236,11 @@ impl ChatWidget {
|
||||
Some(cell) if cell.call_id() == id => cell.complete(duration, result),
|
||||
_ => {
|
||||
self.flush_active_cell();
|
||||
let mut cell =
|
||||
history_cell::new_active_mcp_tool_call(id, invocation, self.config.animations);
|
||||
let mut cell = history_cell::new_active_mcp_tool_call(
|
||||
id,
|
||||
invocation,
|
||||
self.local_settings.tui.animations,
|
||||
);
|
||||
let extra_cell = cell.complete(duration, result);
|
||||
self.transcript.active_cell = Some(Box::new(cell));
|
||||
extra_cell
|
||||
|
||||
@@ -29,7 +29,7 @@ impl ChatWidget {
|
||||
#[cfg(target_os = "windows")]
|
||||
pub(crate) fn world_writable_warning_details(&self) -> Option<(Vec<String>, usize, bool)> {
|
||||
if self
|
||||
.config
|
||||
.local_settings
|
||||
.notices
|
||||
.hide_world_writable_warning
|
||||
.unwrap_or(false)
|
||||
|
||||
Reference in new issue
Block a user