mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Prompt to unarchive sessions before resuming or forking (#39640)
## Why Starting an archived session with `codex resume` or `codex fork` stopped with guidance to run a separate `codex unarchive` command first. ## What changed - Detect archived-session startup failures and offer to unarchive and retry the requested operation. - Allow the user to cancel without modifying the archived session. - Render the confirmation in the alternate screen when available and preserve inline terminal context when `--no-alt-screen` is set. - Preserve `--no-alt-screen` whether it appears before or after the `resume` or `fork` subcommand. ## Testing - Cover confirmation, cancellation, retry behavior, and unrelated startup failures for both resume and fork. - Add prompt interaction and terminal rendering coverage, including narrow and inline viewports. GitOrigin-RevId: 382cdbd15b5d12c091e554d6d3a2f9b3589654f4
This commit is contained in:
1 parent
fdc23b93b8
commit
d944ce83a2
11 files changed
+736
-57
No files matched your search
@@ -4,6 +4,10 @@
|
||||
//! remains isolated from protected interactive requests until the initialized composer owns it.
|
||||
|
||||
use super::*;
|
||||
use crate::session_start::SessionStartAction;
|
||||
use crate::session_start::cancel_session_start;
|
||||
use crate::session_start::complete_session_start;
|
||||
use crate::unarchive_prompt::run_unarchive_prompt;
|
||||
|
||||
async fn resolve_runtime_model_provider_base_url(provider: &ModelProviderInfo) -> Option<String> {
|
||||
let provider = create_model_provider(provider.clone(), /*auth_manager*/ None);
|
||||
@@ -304,10 +308,25 @@ impl App {
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(resumed) => resumed
|
||||
.map_err(|err| session_start_error("resume", &target_session, err))?,
|
||||
Ok(resumed) => resumed,
|
||||
Err(err) => return shutdown_on_startup_error(app_server, err).await,
|
||||
};
|
||||
let action = SessionStartAction::Resume(model_settings);
|
||||
let Some(resumed) = complete_session_start(
|
||||
&mut app_server,
|
||||
&config,
|
||||
&target_session,
|
||||
action,
|
||||
resumed,
|
||||
async || {
|
||||
startup_draft.flush_pending_events(tui).await?;
|
||||
run_unarchive_prompt(tui, target_session.thread_id, action).await
|
||||
},
|
||||
)
|
||||
.await?
|
||||
else {
|
||||
return Ok(cancel_session_start(app_server).await);
|
||||
};
|
||||
let init = crate::chatwidget::ChatWidgetInit {
|
||||
config: config.clone(),
|
||||
frame_requester: tui.frame_requester(),
|
||||
@@ -350,11 +369,25 @@ impl App {
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(forked) => {
|
||||
forked.map_err(|err| session_start_error("fork", &target_session, err))?
|
||||
}
|
||||
Ok(forked) => forked,
|
||||
Err(err) => return shutdown_on_startup_error(app_server, err).await,
|
||||
};
|
||||
let action = SessionStartAction::Fork;
|
||||
let Some(forked) = complete_session_start(
|
||||
&mut app_server,
|
||||
&config,
|
||||
&target_session,
|
||||
action,
|
||||
forked,
|
||||
async || {
|
||||
startup_draft.flush_pending_events(tui).await?;
|
||||
run_unarchive_prompt(tui, target_session.thread_id, action).await
|
||||
},
|
||||
)
|
||||
.await?
|
||||
else {
|
||||
return Ok(cancel_session_start(app_server).await);
|
||||
};
|
||||
let init = crate::chatwidget::ChatWidgetInit {
|
||||
config: config.clone(),
|
||||
frame_requester: tui.frame_requester(),
|
||||
|
||||
Reference in new issue
Block a user