Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Test thread archiving before the first turn (#51193)

Brent Trautb4e3726d73a3
diff --git a/codex-rs/app-server/tests/suite/v2/thread_metadata_update.rs b/codex-rs/app-server/tests/suite/v2/thread_metadata_update.rs
index 799b58d9f7..ed51accc1f 100644
--- a/codex-rs/app-server/tests/suite/v2/thread_metadata_update.rs
+++ b/codex-rs/app-server/tests/suite/v2/thread_metadata_update.rs
@@ -5,10 +5,13 @@ use app_test_support::create_fake_rollout;
use app_test_support::create_mock_responses_server_repeating_assistant;
use app_test_support::rollout_path;
use app_test_support::to_response;
+use codex_app_server_protocol::ClientRequest;
use codex_app_server_protocol::GitInfo;
use codex_app_server_protocol::JSONRPCError;
use codex_app_server_protocol::JSONRPCResponse;
use codex_app_server_protocol::RequestId;
+use codex_app_server_protocol::ThreadArchiveParams;
+use codex_app_server_protocol::ThreadArchiveResponse;
use codex_app_server_protocol::ThreadHistoryMode;
use codex_app_server_protocol::ThreadListParams;
use codex_app_server_protocol::ThreadListResponse;
@@ -53,7 +56,7 @@ const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs
const INVALID_REQUEST_ERROR_CODE: i64 = -32600;
#[tokio::test]
-async fn thread_section_move_pins_before_first_turn() -> Result<()> {
+async fn thread_section_move_pins_and_archives_before_first_turn() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri()).write(codex_home.path())?;
@@ -122,7 +125,7 @@ async fn thread_section_move_pins_before_first_turn() -> Result<()> {
let move_id = mcp
.send_thread_section_move_request(ThreadSectionMoveParams {
- thread_id,
+ thread_id: thread_id.clone(),
section_id: None,
before_thread_id: None,
})
@@ -132,12 +135,39 @@ async fn thread_section_move_pins_before_first_turn() -> Result<()> {
let list_id = mcp
.send_thread_list_request(ThreadListParams {
section_id: None,
- ..list_params
+ ..list_params.clone()
})
.await?;
let listed: ThreadListResponse =
timeout(DEFAULT_READ_TIMEOUT, mcp.read_response(list_id)).await??;
assert_eq!(listed.data, vec![]);
+
+ let _: ThreadArchiveResponse = mcp
+ .request(|request_id| ClientRequest::ThreadArchive {
+ request_id,
+ params: ThreadArchiveParams {
+ thread_id: thread_id.clone(),
+ },
+ })
+ .await?;
+ let archived: ThreadListResponse = mcp
+ .request(|request_id| ClientRequest::ThreadList {
+ request_id,
+ params: ThreadListParams {
+ archived: Some(true),
+ section_id: None,
+ ..list_params
+ },
+ })
+ .await?;
+ assert_eq!(
+ archived
+ .data
+ .iter()
+ .map(|thread| thread.id.as_str())
+ .collect::<Vec<_>>(),
+ vec![thread_id.as_str()]
+ );
Ok(())
}