diff --git a/codex-rs/cloud-tasks-client/src/api.rs b/codex-rs/cloud-tasks-client/src/api.rs index d301bcf6c5..42fa8f5db7 100644 --- a/codex-rs/cloud-tasks-client/src/api.rs +++ b/codex-rs/cloud-tasks-client/src/api.rs @@ -3,10 +3,10 @@ use chrono::Utc; use serde::Deserialize; use serde::Serialize; -pub type Result = std::result::Result; +pub type Result = std::result::Result; #[derive(Debug, thiserror::Error)] -pub enum Error { +pub enum CloudTaskError { #[error("unimplemented: {0}")] Unimplemented(&'static str), #[error("http error: {0}")] diff --git a/codex-rs/cloud-tasks-client/src/http.rs b/codex-rs/cloud-tasks-client/src/http.rs index f4dab55d9e..1ff06cad2d 100644 --- a/codex-rs/cloud-tasks-client/src/http.rs +++ b/codex-rs/cloud-tasks-client/src/http.rs @@ -3,7 +3,7 @@ use crate::ApplyStatus; use crate::AttemptStatus; use crate::CloudBackend; use crate::DiffSummary; -use crate::Error; +use crate::CloudTaskError; use crate::Result; use crate::TaskId; use crate::TaskStatus; @@ -74,7 +74,7 @@ impl CloudBackend for HttpClient { .backend .list_tasks(Some(20), Some("current"), env) .await - .map_err(|e| Error::Http(format!("list_tasks failed: {e}")))?; + .map_err(|e| CloudTaskError::Http(format!("list_tasks failed: {e}")))?; let tasks: Vec = resp .items @@ -96,7 +96,7 @@ impl CloudBackend for HttpClient { .backend .get_task_details_with_body(&id) .await - .map_err(|e| Error::Http(format!("get_task_details failed: {e}")))?; + .map_err(|e| CloudTaskError::Http(format!("get_task_details failed: {e}")))?; if let Some(diff) = details.unified_diff() { return Ok(Some(diff)); } @@ -112,7 +112,7 @@ impl CloudBackend for HttpClient { .backend .get_task_details_with_body(&id) .await - .map_err(|e| Error::Http(format!("get_task_details failed: {e}")))?; + .map_err(|e| CloudTaskError::Http(format!("get_task_details failed: {e}")))?; let mut msgs = details.assistant_text_messages(); if msgs.is_empty() { msgs.extend(extract_assistant_messages_from_body(&body)); @@ -129,7 +129,7 @@ impl CloudBackend for HttpClient { } else { format!("{}/api/codex/tasks/{}", self.base_url, id) }; - Err(Error::Http(format!( + Err(CloudTaskError::Http(format!( "No assistant text messages in response. GET {url}; content-type={ct}; body={body}" ))) } @@ -140,7 +140,7 @@ impl CloudBackend for HttpClient { .backend .get_task_details_with_body(&id) .await - .map_err(|e| Error::Http(format!("get_task_details failed: {e}")))?; + .map_err(|e| CloudTaskError::Http(format!("get_task_details failed: {e}")))?; let prompt = details.user_text_prompt(); let mut messages = details.assistant_text_messages(); if messages.is_empty() { @@ -188,7 +188,7 @@ impl CloudBackend for HttpClient { .backend .list_sibling_turns(&task.0, &turn_id) .await - .map_err(|e| Error::Http(format!("list_sibling_turns failed: {e}")))?; + .map_err(|e| CloudTaskError::Http(format!("list_sibling_turns failed: {e}")))?; let mut attempts: Vec = resp .sibling_turns @@ -263,7 +263,7 @@ impl CloudBackend for HttpClient { prompt.chars().count(), e )); - Err(Error::Http(format!("create_task failed: {e}"))) + Err(CloudTaskError::Http(format!("create_task failed: {e}"))) } } } @@ -285,10 +285,10 @@ impl HttpClient { .backend .get_task_details(&id) .await - .map_err(|e| Error::Http(format!("get_task_details failed: {e}")))?; + .map_err(|e| CloudTaskError::Http(format!("get_task_details failed: {e}")))?; details .unified_diff() - .ok_or_else(|| Error::Msg(format!("No diff available for task {id}")))? + .ok_or_else(|| CloudTaskError::Msg(format!("No diff available for task {id}")))? } }; @@ -315,7 +315,7 @@ impl HttpClient { preflight, }; let r = codex_git_apply::apply_git_patch(&req) - .map_err(|e| Error::Io(format!("git apply failed to run: {e}")))?; + .map_err(|e| CloudTaskError::Io(format!("git apply failed to run: {e}")))?; let status = if r.exit_code == 0 { ApplyStatus::Success diff --git a/codex-rs/cloud-tasks-client/src/lib.rs b/codex-rs/cloud-tasks-client/src/lib.rs index ba830e72f0..451c1387d4 100644 --- a/codex-rs/cloud-tasks-client/src/lib.rs +++ b/codex-rs/cloud-tasks-client/src/lib.rs @@ -6,7 +6,7 @@ pub use api::AttemptStatus; pub use api::CloudBackend; pub use api::CreatedTask; pub use api::DiffSummary; -pub use api::Error; +pub use api::CloudTaskError; pub use api::Result; pub use api::TaskId; pub use api::TaskStatus; diff --git a/codex-rs/cloud-tasks/src/app.rs b/codex-rs/cloud-tasks/src/app.rs index 07f4c221b9..9793447ecd 100644 --- a/codex-rs/cloud-tasks/src/app.rs +++ b/codex-rs/cloud-tasks/src/app.rs @@ -381,7 +381,7 @@ mod tests { &self, _id: TaskId, ) -> codex_cloud_tasks_client::Result> { - Err(codex_cloud_tasks_client::Error::Unimplemented( + Err(codex_cloud_tasks_client::CloudTaskError::Unimplemented( "not used in test", )) } @@ -419,7 +419,7 @@ mod tests { _id: TaskId, _diff_override: Option, ) -> codex_cloud_tasks_client::Result { - Err(codex_cloud_tasks_client::Error::Unimplemented( + Err(codex_cloud_tasks_client::CloudTaskError::Unimplemented( "not used in test", )) } @@ -429,7 +429,7 @@ mod tests { _id: TaskId, _diff_override: Option, ) -> codex_cloud_tasks_client::Result { - Err(codex_cloud_tasks_client::Error::Unimplemented( + Err(codex_cloud_tasks_client::CloudTaskError::Unimplemented( "not used in test", )) } @@ -441,7 +441,7 @@ mod tests { _git_ref: &str, _qa_mode: bool, ) -> codex_cloud_tasks_client::Result { - Err(codex_cloud_tasks_client::Error::Unimplemented( + Err(codex_cloud_tasks_client::CloudTaskError::Unimplemented( "not used in test", )) }