merge origin/friel/auto-unarchive-resume into collab stack

This commit is contained in:
Friel
2026-03-30 01:42:50 +00:00
9 changed files with 246 additions and 9 deletions

View File

@@ -224,6 +224,62 @@ async fn thread_resume_returns_rollout_history() -> Result<()> {
Ok(())
}
#[tokio::test]
async fn thread_resume_unarchives_archived_rollout() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
create_config_toml(codex_home.path(), &server.uri())?;
let filename_ts = "2025-01-05T12-00-00";
let conversation_id = create_fake_rollout_with_text_elements(
codex_home.path(),
filename_ts,
"2025-01-05T12:00:00Z",
"Saved user message",
Vec::new(),
Some("mock_provider"),
/*git_info*/ None,
)?;
let active_rollout_path = rollout_path(codex_home.path(), filename_ts, &conversation_id);
let archived_rollout_path = codex_home.path().join("archived_sessions/2025/01/05").join(
active_rollout_path
.file_name()
.expect("active rollout file name"),
);
std::fs::create_dir_all(
archived_rollout_path
.parent()
.expect("archived rollout parent directory"),
)?;
std::fs::rename(&active_rollout_path, &archived_rollout_path)?;
let mut mcp = McpProcess::new(codex_home.path()).await?;
timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??;
let resume_id = mcp
.send_thread_resume_request(ThreadResumeParams {
thread_id: conversation_id.clone(),
..Default::default()
})
.await?;
let resume_resp: JSONRPCResponse = timeout(
DEFAULT_READ_TIMEOUT,
mcp.read_stream_until_response_message(RequestId::Integer(resume_id)),
)
.await??;
let ThreadResumeResponse { thread, .. } = to_response::<ThreadResumeResponse>(resume_resp)?;
assert_eq!(thread.id, conversation_id);
assert!(active_rollout_path.exists());
assert!(!archived_rollout_path.exists());
assert_eq!(
std::fs::canonicalize(thread.path.as_ref().expect("thread path"))?,
std::fs::canonicalize(&active_rollout_path)?
);
Ok(())
}
#[tokio::test]
async fn thread_resume_prefers_persisted_git_metadata_for_local_threads() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;