Persist local workspace side chats and add tab close controls (#60152)

## What changed

- Save side chats as attachments to their parent conversation when local workspace history supports them, and let users reopen them from the sidebar after a restart.
- Show chat names or first-prompt previews in sidebar labels, and allow saved side chats to be renamed with `/rename`.
- Add tab close buttons, middle-click closing, and the configurable `close_sidebar_tab` shortcut, defaulting to `Ctrl-X W`. Closing a saved chat keeps it available in the picker; archiving removes it from Side chats.
- Confirm actions that stop running work, discard unsent input, or lose temporary history. Delete saved TUI side chats when deleting their parent conversation.

## Testing

Add coverage for reopening saved side chats after restart, archive handling, close confirmations, and preventing close-confirmation keys from accepting a replacement approval dialog.

GitOrigin-RevId: 3d47533d007286a7354660c08df13a83dd48d5d7
This commit is contained in:
Felipe Coury
2026-11-07 17:31:27 +00:00
committed by copyberry
parent 57a808a392
commit 57e64682f8
54 changed files with 2047 additions and 254 deletions
@@ -1,5 +1,7 @@
use super::*;
use crate::app_server_session::SideChatStorage;
use crate::legacy_core::config::ConfigOverrides;
use crate::local_settings::LocalSettings;
use crate::test_support::boxed_future;
use codex_config::LoaderOverrides;
use pretty_assertions::assert_eq;
@@ -140,16 +142,29 @@ async fn creation_attaches_to_original_task_and_survives_service_restart_scenari
let mut ephemeral_config = config.clone();
ephemeral_config.ephemeral = true;
let ephemeral = Box::pin(server.start_thread(&ephemeral_config)).await?;
let refused = tools
.execute(
server.request_handle(),
ephemeral.session.thread_id.to_string(),
"create_worktree",
json!({"allowAsync":true}),
)
.await;
assert!(!refused.success, "{refused:?}");
assert!(format!("{refused:?}").contains("Ephemeral side conversations"));
let saved_side = Box::pin(server.fork_side_thread(
&LocalSettings::from(&config),
config.clone(),
started.session.thread_id,
/*selected_profile*/ None,
SideChatStorage::Attached,
))
.await?;
for blocked in [ephemeral, saved_side] {
let refused = tools
.execute(
server.request_handle(),
blocked.session.thread_id.to_string(),
"create_worktree",
json!({"allowAsync":true}),
)
.await;
assert!(!refused.success, "{refused:?}");
assert!(
format!("{refused:?}")
.contains("Side conversations cannot retain worktree attachments")
);
}
assert!(!tools.manager.settings().root.exists());
assert!(tools.operations.lock().await.is_empty());
let call = |tool: &'static str, arguments| {