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:
Eric Traut authored and copyberry committed 2026-09-02 04:20:38 +00:00
1 parent 0b509e930e
commit 9d57be71ba
87 files changed
+1188 -459

No files matched your search

@@ -17,7 +17,7 @@ async fn reconnect_restores_history_permissions_and_keeps_old_input_paused() ->
let cwd = app.config.cwd.clone();
app.config.model = Some("gpt-test".into());
// Avoid platform-specific path widths in the mode-preservation snapshot.
app.config.tui_status_line = Some(vec!["model-with-reasoning".into()]);
app.local_settings.tui.status_line = Some(vec!["model-with-reasoning".into()]);
app.config
.permissions
.set_permission_profile(PermissionProfile::read_only())?;
@@ -187,6 +187,7 @@ async fn reconnect_restores_history_permissions_and_keeps_old_input_paused() ->
let connected = reconnect(
app.app_server_target.clone(),
app.config.clone(),
app.local_settings.clone(),
Some(id),
/*remote_cwd*/ None,
transport,
@@ -315,6 +316,7 @@ async fn reconnect_exhaustion_and_unknown_initial_thread_stay_offline() -> Resul
reconnect(
app.app_server_target.clone(),
app.config.clone(),
app.local_settings.clone(),
id,
/*remote_cwd*/ None,
crate::dynamic_tools_mcp::ThreadToolTransport::Dynamic,
@@ -366,6 +368,7 @@ async fn reconnect_allows_slow_hydration_but_bounds_a_stalled_server() -> Result
endpoint: endpoint.clone(),
},
app.config.clone(),
app.local_settings.clone(),
Some(id),
/*remote_cwd*/ None,
crate::dynamic_tools_mcp::ThreadToolTransport::Dynamic,