mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add session archiving to the resume picker (#37369)
## What changed - Add a `Ctrl+A` action and footer hint for archiving the selected session in the resume picker. - Send archive requests through the app server, remove successfully archived sessions from the picker, and surface failures inline. - Prevent duplicate actions while an archive is pending, preserve configured keybindings, and direct users to `/archive` when they select the current session. - Ignore archive notifications for untracked side threads so they do not appear in agent navigation. ## Testing - Cover successful, repeated, rejected, and failed archive requests, shortcut conflicts, footer rendering, and untracked-thread notifications. GitOrigin-RevId: 20ea21c804a9685e46484d67df967859f9be4651
This commit is contained in:
1 parent
6622546169
commit
1efd8fcb26
6 files changed
+403
-7
No files matched your search
@@ -132,6 +132,9 @@ impl App {
|
||||
/*show_all*/ false,
|
||||
/*include_non_interactive*/ false,
|
||||
picker_app_server,
|
||||
app_server.request_handle(),
|
||||
self.primary_thread_id
|
||||
.or(self.current_displayed_thread_id()),
|
||||
)
|
||||
.await?
|
||||
{
|
||||
|
||||
@@ -76,6 +76,7 @@ use codex_app_server_protocol::RequestId as AppServerRequestId;
|
||||
use codex_app_server_protocol::ServerNotification;
|
||||
use codex_app_server_protocol::ServerRequest;
|
||||
use codex_app_server_protocol::Thread;
|
||||
use codex_app_server_protocol::ThreadArchivedNotification;
|
||||
use codex_app_server_protocol::ThreadClosedNotification;
|
||||
use codex_app_server_protocol::ThreadItem;
|
||||
use codex_app_server_protocol::ThreadSettings;
|
||||
@@ -1438,6 +1439,43 @@ async fn collab_receiver_notification_does_not_cache_not_found_thread() {
|
||||
assert_eq!(app.agent_navigation.get(&receiver_thread_id), None);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn archived_untracked_threads_do_not_appear_in_agent_picker() -> Result<()> {
|
||||
let mut app = Box::pin(make_test_app()).await;
|
||||
let mut app_server = Box::pin(crate::start_embedded_app_server_for_picker(
|
||||
app.chat_widget.config_ref(),
|
||||
))
|
||||
.await?;
|
||||
let primary_thread_id = ThreadId::new();
|
||||
app.enqueue_primary_thread_session(
|
||||
test_thread_session(primary_thread_id, test_path_buf("/tmp/project")),
|
||||
Vec::new(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let archived_thread_id = ThreadId::new();
|
||||
app.handle_app_server_event(
|
||||
&app_server,
|
||||
codex_app_server_client::AppServerEvent::ServerNotification(Box::new(
|
||||
ServerNotification::ThreadArchived(ThreadArchivedNotification {
|
||||
thread_id: archived_thread_id.to_string(),
|
||||
}),
|
||||
)),
|
||||
)
|
||||
.await;
|
||||
|
||||
assert!(!app.thread_event_channels.contains_key(&archived_thread_id));
|
||||
|
||||
Box::pin(app.open_agent_picker(&mut app_server)).await;
|
||||
|
||||
assert_eq!(
|
||||
app.agent_navigation.ordered_thread_ids(),
|
||||
vec![primary_thread_id]
|
||||
);
|
||||
assert_eq!(app.active_thread_id, Some(primary_thread_id));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn open_agent_picker_keeps_missing_threads_for_replay() -> Result<()> {
|
||||
let mut app = Box::pin(make_test_app()).await;
|
||||
|
||||
@@ -957,8 +957,10 @@ impl App {
|
||||
if self.abandoned_side_threads.contains(&thread_id) {
|
||||
return Ok(());
|
||||
}
|
||||
if matches!(notification, ServerNotification::ThreadSettingsUpdated(_))
|
||||
&& self.primary_thread_id.is_some()
|
||||
if matches!(
|
||||
notification,
|
||||
ServerNotification::ThreadSettingsUpdated(_) | ServerNotification::ThreadArchived(_)
|
||||
) && self.primary_thread_id.is_some()
|
||||
&& self.primary_thread_id != Some(thread_id)
|
||||
&& !self.thread_event_channels.contains_key(&thread_id)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user