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

@@ -193,7 +193,7 @@ stream_max_retries = 0
#[tokio::test]
async fn manual_recap_works_when_auto_recap_disabled() -> Result<()> {
let (mut app, mut app_event_rx, _op_rx) = make_test_app_with_channels().await;
app.config.tui_auto_recap = false;
app.local_settings.tui.auto_recap = false;
let thread_id = ThreadId::new();
app.active_thread_id = Some(thread_id);
app.transcript_cells
@@ -305,7 +305,7 @@ async fn auto_recap_opt_out_blocks_requests_and_cleans_up_pending_start() -> Res
prepare_eligible_recap(&mut app, thread_id);
let (mut app_server, requests, proxy) = start_recording_remote_app_server(&app.config).await?;
let mut tui = crate::tui::test_support::make_test_tui()?;
app.config.tui_auto_recap = false;
app.local_settings.tui.auto_recap = false;
app.schedule_recap_check(thread_id, Instant::now());
app.request_recap(&app_server, thread_id, RecapTrigger::Automatic);
app.handle_event(
@@ -327,13 +327,13 @@ async fn auto_recap_opt_out_blocks_requests_and_cleans_up_pending_start() -> Res
.flat_map(|cell| cell.display_lines(/*width*/ 80))
.collect::<Vec<_>>();
app.config.tui_auto_recap = true;
app.local_settings.tui.auto_recap = true;
app.request_recap(&app_server, thread_id, RecapTrigger::Automatic);
let started_event = tokio::time::timeout(Duration::from_secs(/*secs*/ 5), app_event_rx.recv())
.await?
.expect("recap start event");
assert!(matches!(started_event, AppEvent::RecapStarted { .. }));
app.config.tui_auto_recap = false;
app.local_settings.tui.auto_recap = false;
app.handle_event(&mut tui, &mut app_server, started_event)
.await?;
tokio::time::timeout(Duration::from_secs(/*secs*/ 5), async {