mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Return to the command center after session cancellation or deletion (#44711)
## Why Deleting a session, canceling an archived session resume or fork, and pressing `Esc` in a conversation open in another app previously exited the TUI. Local daemon and remote connections can instead return to the command center to select another conversation. ## What changed - Return to the command center after successful deletion on local daemon and remote connections. Shut down side conversations before deletion and clear the deleted thread's local state. - Return to the command center when an unarchive prompt is canceled, discarding startup input intended for the canceled resume or fork. Keep explicit quit actions and embedded server exit behavior. - Make `Esc` open the command center from a conversation open in another app. Reselecting that conversation preserves its read-only snapshot and draft; `R` explicitly retries attachment. - Update deletion confirmation text and keyboard hints to reflect these destinations. ## Testing Add lifecycle tests for deletion success and failure, side conversation cleanup, unarchive cancellation and quitting, and read-only snapshot preservation. Add snapshots for command center navigation hints and deletion confirmation. GitOrigin-RevId: 55a96358edb7af73949877a515614943bdc73643
This commit is contained in:
1 parent
fc948f8c47
commit
08e49689b8
18 files changed
+500
-142
No files matched your search
@@ -53,16 +53,24 @@ impl SessionStartAction {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum SessionStartOutcome {
|
||||
Started(Box<AppServerStartedThread>),
|
||||
CommandCenter,
|
||||
Exit,
|
||||
}
|
||||
|
||||
pub(crate) async fn complete_session_start(
|
||||
app_server: &mut AppServerSession,
|
||||
config: &Config,
|
||||
app_server_target: &crate::AppServerTarget,
|
||||
target: &SessionTarget,
|
||||
action: SessionStartAction,
|
||||
initial_result: Result<AppServerStartedThread>,
|
||||
confirm: impl AsyncFnOnce() -> Result<UnarchiveChoice>,
|
||||
) -> Result<Option<AppServerStartedThread>> {
|
||||
) -> Result<SessionStartOutcome> {
|
||||
match initial_result {
|
||||
Ok(started) => return Ok(Some(started)),
|
||||
Ok(started) => return Ok(SessionStartOutcome::Started(Box::new(started))),
|
||||
Err(err) => {
|
||||
// Match the requested ID as well as the server's archive guidance: an unrelated
|
||||
// startup failure must never cause us to unarchive a session.
|
||||
@@ -75,8 +83,16 @@ pub(crate) async fn complete_session_start(
|
||||
}
|
||||
}
|
||||
|
||||
if confirm().await? == UnarchiveChoice::Cancel {
|
||||
return Ok(None);
|
||||
match confirm().await? {
|
||||
UnarchiveChoice::Cancel => {
|
||||
return Ok(match app_server_target {
|
||||
crate::AppServerTarget::LocalDaemon { .. }
|
||||
| crate::AppServerTarget::Remote { .. } => SessionStartOutcome::CommandCenter,
|
||||
crate::AppServerTarget::Embedded => SessionStartOutcome::Exit,
|
||||
});
|
||||
}
|
||||
UnarchiveChoice::Quit => return Ok(SessionStartOutcome::Exit),
|
||||
UnarchiveChoice::Unarchive => {}
|
||||
}
|
||||
|
||||
app_server
|
||||
@@ -87,7 +103,7 @@ pub(crate) async fn complete_session_start(
|
||||
action
|
||||
.start(app_server, config, target)
|
||||
.await
|
||||
.map(Some)
|
||||
.map(|started| SessionStartOutcome::Started(Box::new(started)))
|
||||
.map_err(|err| session_start_error(action.verb(), target, err))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user