mirror of
https://github.com/openai/codex.git
synced 2026-09-16 12:13:30 +00:00
tui: honor resume cwd prompt exits
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -840,7 +840,7 @@ impl App {
|
||||
&mut self,
|
||||
tui: &mut tui::Tui,
|
||||
target_session: SessionTarget,
|
||||
) -> Result<()> {
|
||||
) -> Result<AppRunControl> {
|
||||
let current_cwd = self.config.cwd.clone();
|
||||
let resume_cwd = match crate::resolve_cwd_for_resume_or_fork(
|
||||
tui,
|
||||
@@ -855,7 +855,9 @@ impl App {
|
||||
{
|
||||
crate::ResolveCwdOutcome::Continue(Some(cwd)) => cwd,
|
||||
crate::ResolveCwdOutcome::Continue(None) => current_cwd.clone(),
|
||||
crate::ResolveCwdOutcome::Exit => return Ok(()),
|
||||
crate::ResolveCwdOutcome::Exit => {
|
||||
return Ok(self.handle_exit_mode(ExitMode::ShutdownFirst));
|
||||
}
|
||||
};
|
||||
let mut resume_config = match self
|
||||
.rebuild_config_for_resume_or_fallback(¤t_cwd, resume_cwd)
|
||||
@@ -866,7 +868,7 @@ impl App {
|
||||
self.chat_widget.add_error_message(format!(
|
||||
"Failed to rebuild configuration for resume: {err}"
|
||||
));
|
||||
return Ok(());
|
||||
return Ok(AppRunControl::Continue);
|
||||
}
|
||||
};
|
||||
self.apply_runtime_policy_overrides(&mut resume_config);
|
||||
@@ -911,20 +913,20 @@ impl App {
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
Ok(AppRunControl::Continue)
|
||||
}
|
||||
|
||||
async fn resume_session_by_thread_id(
|
||||
&mut self,
|
||||
tui: &mut tui::Tui,
|
||||
thread_id: ThreadId,
|
||||
) -> Result<()> {
|
||||
) -> Result<AppRunControl> {
|
||||
let Some(path) =
|
||||
find_thread_path_by_id_str(&self.config.codex_home, &thread_id.to_string()).await?
|
||||
else {
|
||||
self.chat_widget
|
||||
.add_error_message(format!("No saved session found for thread {thread_id}."));
|
||||
return Ok(());
|
||||
return Ok(AppRunControl::Continue);
|
||||
};
|
||||
self.resume_session_target(tui, SessionTarget { path, thread_id })
|
||||
.await
|
||||
@@ -2537,10 +2539,10 @@ impl App {
|
||||
tui.frame_requester().schedule_frame();
|
||||
}
|
||||
AppEvent::ResumeSession(thread_id) => {
|
||||
self.resume_session_by_thread_id(tui, thread_id).await?;
|
||||
return self.resume_session_by_thread_id(tui, thread_id).await;
|
||||
}
|
||||
AppEvent::ResumeSessionTarget(target_session) => {
|
||||
self.resume_session_target(tui, target_session).await?;
|
||||
return self.resume_session_target(tui, target_session).await;
|
||||
}
|
||||
AppEvent::ForkCurrentSession => {
|
||||
self.session_telemetry.counter(
|
||||
|
||||
Reference in New Issue
Block a user