mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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:
1 parent
21bd5d3cdc
commit
694b6319d3
15 files changed
+117
-462
No files matched your search
@@ -1,5 +1,4 @@
|
||||
use super::App;
|
||||
use crate::session_resume::read_session_model;
|
||||
use crate::session_state::ThreadSessionState;
|
||||
use codex_app_server_protocol::AskForApproval;
|
||||
use codex_app_server_protocol::Thread;
|
||||
@@ -80,7 +79,7 @@ impl App {
|
||||
let active_permission_profile = self.current_active_permission_profile();
|
||||
let mut session = if let Some(mut session) = self.primary_session_configured.clone() {
|
||||
if session.thread_id != thread_id {
|
||||
// `thread/read` does not include thread settings, so do not carry
|
||||
// `thread/read` does not include all thread settings, so do not carry
|
||||
// thread-scoped state from the currently active session.
|
||||
session.collaboration_mode = None;
|
||||
session.personality = None;
|
||||
@@ -120,10 +119,8 @@ impl App {
|
||||
session.active_permission_profile = active_permission_profile;
|
||||
session.instruction_source_paths = Vec::new();
|
||||
session.rollout_path = thread.path.clone();
|
||||
if let Some(model) =
|
||||
read_session_model(self.state_db.as_deref(), thread_id, thread.path.as_deref()).await
|
||||
{
|
||||
session.model = model;
|
||||
if let Some(model) = &thread.model {
|
||||
session.model = model.clone();
|
||||
} else if thread.path.is_some() {
|
||||
session.model.clear();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user