mirror of
https://github.com/openai/codex.git
synced 2026-11-27 15:30:27 +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
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user