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

@@ -120,6 +120,7 @@ async fn same_thread_retry_keeps_subscription_and_restores_draft() -> Result<()>
crate::resume_picker::SessionTarget {
path,
thread_id,
cwd: None,
history_mode: None,
},
)
@@ -3844,6 +3845,7 @@ fn session_lifecycle_avoids_redundant_subagent_metadata_reads() -> Result<()> {
crate::resume_picker::SessionTarget {
path: Some(root_rollout_path),
thread_id: root_thread_id,
cwd: None,
history_mode: None,
},
)
+9
View File
@@ -148,6 +148,7 @@ fn startup_waiting_gate_is_only_for_fresh_or_exit_session_selection() {
crate::resume_picker::SessionTarget {
path: Some(PathBuf::from("/tmp/restore")),
thread_id: ThreadId::new(),
cwd: None,
history_mode: None,
}
)),
@@ -158,6 +159,7 @@ fn startup_waiting_gate_is_only_for_fresh_or_exit_session_selection() {
crate::resume_picker::SessionTarget {
path: Some(PathBuf::from("/tmp/fork")),
thread_id: ThreadId::new(),
cwd: None,
history_mode: None,
}
)),
@@ -170,11 +172,13 @@ fn startup_paused_goal_prompt_gate_is_only_for_quiet_resume() {
let resume = SessionSelection::Resume(crate::resume_picker::SessionTarget {
path: Some(PathBuf::from("/tmp/restore")),
thread_id: ThreadId::new(),
cwd: None,
history_mode: None,
});
let fork = SessionSelection::Fork(crate::resume_picker::SessionTarget {
path: Some(PathBuf::from("/tmp/fork")),
thread_id: ThreadId::new(),
cwd: None,
history_mode: None,
});
let no_images: Vec<PathBuf> = Vec::new();
@@ -244,6 +248,7 @@ fn startup_waiting_gate_not_applied_for_resume_or_fork_session_selection() {
crate::resume_picker::SessionTarget {
path: Some(PathBuf::from("/tmp/restore")),
thread_id: ThreadId::new(),
cwd: None,
history_mode: None,
},
));
@@ -258,6 +263,7 @@ fn startup_waiting_gate_not_applied_for_resume_or_fork_session_selection() {
crate::resume_picker::SessionTarget {
path: Some(PathBuf::from("/tmp/fork")),
thread_id: ThreadId::new(),
cwd: None,
history_mode: None,
},
));
@@ -1335,6 +1341,7 @@ async fn ignore_same_thread_resume_reports_noop_for_current_thread() {
let ignored = app.ignore_same_thread_resume(&crate::resume_picker::SessionTarget {
path: Some(test_path_buf("/tmp/project")),
thread_id,
cwd: None,
history_mode: None,
});
@@ -1360,6 +1367,7 @@ async fn ignore_same_thread_resume_allows_reattaching_displayed_inactive_thread(
let ignored = app.ignore_same_thread_resume(&crate::resume_picker::SessionTarget {
path: Some(test_path_buf("/tmp/project")),
thread_id,
cwd: None,
history_mode: None,
});
@@ -1386,6 +1394,7 @@ async fn ignore_same_thread_resume_allows_retrying_read_only_view() -> Result<()
!app.ignore_same_thread_resume(&crate::resume_picker::SessionTarget {
path: Some(test_path_buf("/tmp/project")),
thread_id,
cwd: None,
history_mode: None,
})
);