mirror of
https://github.com/openai/codex.git
synced 2026-09-09 15:58:47 +00:00
codex: address PR review feedback (#17380)
This commit is contained in:
@@ -5696,32 +5696,46 @@ impl CodexMessageProcessor {
|
||||
}
|
||||
|
||||
// Move the rollout file to archived.
|
||||
let result: std::io::Result<()> = async move {
|
||||
let result: Result<(), JSONRPCErrorError> = async move {
|
||||
let archive_folder = self
|
||||
.config
|
||||
.codex_home
|
||||
.join(codex_core::ARCHIVED_SESSIONS_SUBDIR);
|
||||
tokio::fs::create_dir_all(&archive_folder).await?;
|
||||
tokio::fs::create_dir_all(&archive_folder)
|
||||
.await
|
||||
.map_err(|err| JSONRPCErrorError {
|
||||
code: INTERNAL_ERROR_CODE,
|
||||
message: format!("failed to archive thread: {err}"),
|
||||
data: None,
|
||||
})?;
|
||||
let archived_path = archive_folder.join(&file_name);
|
||||
tokio::fs::rename(&canonical_rollout_path, &archived_path).await?;
|
||||
tokio::fs::rename(&canonical_rollout_path, &archived_path)
|
||||
.await
|
||||
.map_err(|err| JSONRPCErrorError {
|
||||
code: INTERNAL_ERROR_CODE,
|
||||
message: format!("failed to archive thread: {err}"),
|
||||
data: None,
|
||||
})?;
|
||||
if let Some(ctx) = state_db_ctx {
|
||||
let _ = ctx
|
||||
.mark_archived(thread_id, archived_path.as_path(), Utc::now())
|
||||
.await;
|
||||
let thread_id_str = thread_id.to_string();
|
||||
if let Err(err) = ctx.delete_thread_delivery_state(&thread_id_str).await {
|
||||
warn!("failed to delete delivery state for archived thread {thread_id}: {err}");
|
||||
}
|
||||
ctx.delete_thread_delivery_state(&thread_id_str)
|
||||
.await
|
||||
.map_err(|err| JSONRPCErrorError {
|
||||
code: INTERNAL_ERROR_CODE,
|
||||
message: format!(
|
||||
"failed to archive thread: failed to delete delivery state for archived thread {thread_id}: {err}"
|
||||
),
|
||||
data: None,
|
||||
})?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
.await;
|
||||
|
||||
result.map_err(|err| JSONRPCErrorError {
|
||||
code: INTERNAL_ERROR_CODE,
|
||||
message: format!("failed to archive thread: {err}"),
|
||||
data: None,
|
||||
})
|
||||
result
|
||||
}
|
||||
|
||||
async fn apps_list(&self, request_id: ConnectionRequestId, params: AppsListParams) {
|
||||
|
||||
Reference in New Issue
Block a user