mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +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:
@@ -504,6 +504,7 @@ const DEFAULT_STATUS_LINE_ITEMS: [&str; 2] = ["model-with-reasoning", "current-d
|
||||
/// Common initialization parameters shared by all `ChatWidget` constructors.
|
||||
pub(crate) struct ChatWidgetInit {
|
||||
pub(crate) config: Config,
|
||||
pub(crate) local_settings: crate::local_settings::LocalSettings,
|
||||
pub(crate) frame_requester: FrameRequester,
|
||||
pub(crate) app_event_tx: AppEventSender,
|
||||
/// App-server-backed runner used by status surfaces for workspace metadata probes.
|
||||
@@ -514,6 +515,7 @@ pub(crate) struct ChatWidgetInit {
|
||||
pub(crate) initial_user_message: Option<UserMessage>,
|
||||
pub(crate) enhanced_keys_supported: bool,
|
||||
pub(crate) has_chatgpt_account: bool,
|
||||
pub(crate) requires_openai_auth: bool,
|
||||
pub(crate) has_codex_backend_auth: bool,
|
||||
pub(crate) model_catalog: Arc<ModelCatalog>,
|
||||
pub(crate) feedback: codex_feedback::CodexFeedback,
|
||||
@@ -556,6 +558,7 @@ pub(crate) struct ChatWidget {
|
||||
bottom_pane: BottomPane,
|
||||
transcript: TranscriptState,
|
||||
config: Config,
|
||||
pub(crate) local_settings: crate::local_settings::LocalSettings,
|
||||
raw_output_mode: bool,
|
||||
/// Runtime value resolved by core. `config.service_tier` remains the explicit user choice.
|
||||
effective_service_tier: Option<String>,
|
||||
@@ -566,6 +569,7 @@ pub(crate) struct ChatWidget {
|
||||
/// The currently active collaboration mask, if any.
|
||||
active_collaboration_mask: Option<CollaborationModeMask>,
|
||||
has_chatgpt_account: bool,
|
||||
pub(crate) requires_openai_auth: bool,
|
||||
has_codex_backend_auth: bool,
|
||||
model_catalog: Arc<ModelCatalog>,
|
||||
model_popup_request_id: Option<uuid::Uuid>,
|
||||
@@ -1572,7 +1576,7 @@ impl ChatWidget {
|
||||
self.flush_answer_stream_with_separator();
|
||||
self.flush_active_cell();
|
||||
self.transcript.active_cell = Some(Box::new(history_cell::new_mcp_inventory_loading(
|
||||
self.config.animations,
|
||||
self.local_settings.tui.animations,
|
||||
)));
|
||||
self.bump_active_cell_revision();
|
||||
self.request_redraw();
|
||||
@@ -1636,7 +1640,7 @@ impl ChatWidget {
|
||||
|
||||
pub(crate) fn set_raw_output_mode(&mut self, enabled: bool) {
|
||||
self.raw_output_mode = enabled;
|
||||
self.config.tui_raw_output_mode = enabled;
|
||||
self.local_settings.tui.raw_output_mode = enabled;
|
||||
let render_mode = self.history_render_mode();
|
||||
if let Some(controller) = self.stream_controller.as_mut() {
|
||||
controller.set_render_mode(render_mode);
|
||||
@@ -1871,7 +1875,6 @@ impl ChatWidget {
|
||||
self.config.features = config.features.clone();
|
||||
self.config.config_layer_stack = config.config_layer_stack.clone();
|
||||
self.config.memories = config.memories.clone();
|
||||
self.config.terminal_resize_reflow = config.terminal_resize_reflow;
|
||||
self.sync_mentions_v2_enabled();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user