mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Support archiving and restoring cloud threads (#60635)
## What changed - Add cloud archive and unarchive requests and support listing archived threads. - Detach successfully archived threads and emit archive notifications. Report loaded cloud threads from live attachments rather than cached resume metadata, including after archive failures. - Scope resume picker archive state and transcript previews by backend and thread so archiving a cloud session preserves a local session with the same ID. - Limit cloud task archive cleanup to the selected thread, preserving child agents and their active session state, and update the confirmation text accordingly. ## Testing Add regression coverage for archive acknowledgments, archived-thread discovery and restoration, attachment state after archive failures, same-ID sessions across backends, and preservation of attached child agents. GitOrigin-RevId: bd155be85ee911375d4d326b18f9b5abe8e82b3d
This commit is contained in:
committed by
copyberry
parent
627b579219
commit
df82e2fe0a
@@ -16,6 +16,7 @@ async fn discovery_preserves_pagination_and_order_on_each_request() {
|
||||
limit: Some(7),
|
||||
sort_key: ThreadSortKey::UpdatedAt,
|
||||
sort_direction: ThreadSortDirection::Asc,
|
||||
archived: false,
|
||||
originators: vec!["tui".into()],
|
||||
};
|
||||
let page = fixture.client.list_threads(&query).await.unwrap();
|
||||
@@ -46,6 +47,45 @@ async fn discovery_preserves_pagination_and_order_on_each_request() {
|
||||
assert!(fixture.requests.try_recv().is_err());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn discovery_lists_archived_threads_and_restores_the_selected_thread() {
|
||||
let thread = Bytes::from_static(
|
||||
b"\x22\x00\x28\x00\x32\x01/\x48\x00\x72\x06legacy\x82\x01\x00\xaa\x01\x00\xda\x01\x00\xe2\x01\x02\x08\x01\xea\x01\x02\x12\x00\xfa\x01\x00\x80\x02\x00",
|
||||
);
|
||||
let mut response_thread = Vec::new();
|
||||
prost::encoding::bytes::encode(1, &thread, &mut response_thread);
|
||||
let mut response_page = Vec::new();
|
||||
prost::encoding::bytes::encode(1, &Bytes::from(response_thread.clone()), &mut response_page);
|
||||
let mut fixture = fixture_responses(vec![
|
||||
response(vec![frame(&response_page)], tonic::Status::ok("")),
|
||||
response(vec![frame(&response_thread)], tonic::Status::ok("")),
|
||||
])
|
||||
.await;
|
||||
|
||||
let page = fixture
|
||||
.client
|
||||
.list_threads(&ThreadListQuery {
|
||||
archived: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
let [row] = page.data.as_slice() else {
|
||||
panic!("expected one archived conversation");
|
||||
};
|
||||
assert_eq!(row.id, "legacy");
|
||||
assert_request(
|
||||
&mut fixture,
|
||||
"ListThreads",
|
||||
b"\x18\x01\x20\x02\x28\x01\x32\x00",
|
||||
)
|
||||
.await;
|
||||
|
||||
let restored = fixture.client.unarchive_thread(&row.id).await.unwrap();
|
||||
assert_eq!(restored, *row);
|
||||
assert_request(&mut fixture, "UnarchiveThread", b"\x0a\x06legacy").await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn discovery_preserves_native_snapshots_and_read_state() {
|
||||
// Independent native Thread encodings: Git metadata and future field (99), and a legacy row.
|
||||
|
||||
Reference in New Issue
Block a user