Use app-server metadata for TUI session restoration (#43360)

## What changed

- Carry the working directory from `thread/list` and `thread/read` in session selections, and use app-server metadata to resolve resume and fork directories.
- Use the model reported by thread reads and thread-started notifications when restoring session state.
- Remove TUI helpers that read session IDs, working directories, and models directly from rollout files or the state database. Picker selection now requires a thread ID in the selected row.

## Testing

Extend picker coverage to verify that selections preserve the working directory, and add a snapshot asserting that switching to a read thread displays the server-reported model.

GitOrigin-RevId: c9d13e1e56ea2139d3e96344d72ca9ee2de73396
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-07 04:59:12 +00:00
1 parent 21bd5d3cdc
commit 694b6319d3
15 files changed
+117 -462

No files matched your search

+2 -5
View File
@@ -8,7 +8,6 @@ use super::session_lifecycle::ThreadAttachPresentation;
use super::*;
use crate::app_event::ThreadTitleDestination;
use crate::chatwidget::ThreadInputStateRestoreMode;
use crate::session_resume::read_session_model;
use codex_app_server_protocol::ThreadStartedNotification;
use codex_app_server_protocol::TurnInterruptParams;
use codex_app_server_protocol::TurnInterruptResponse;
@@ -1252,10 +1251,8 @@ impl App {
session
.set_cwd_retargeting_implicit_runtime_workspace_root(notification.thread.cwd.clone());
let rollout_path = notification.thread.path.clone();
if let Some(model) =
read_session_model(self.state_db.as_deref(), thread_id, rollout_path.as_deref()).await
{
session.model = model;
if let Some(model) = &notification.thread.model {
session.model = model.clone();
} else if rollout_path.is_some() {
session.model.clear();
}