mirror of
https://github.com/openai/codex.git
synced 2026-11-25 07:23:22 +00:00
[codex] Remove async_trait from first-party code (#27475)
## Why First-party async traits should expose their `Send` contracts explicitly without requiring `async_trait`. This completes the migration pattern established in #27303 and #27304. ## What changed - Replaced the remaining first-party `async_trait` traits with native return-position `impl Future + Send` where statically dispatched and explicit boxed `Send` futures where object safety is required. - Kept implementations behavior-preserving, outlining existing async bodies into inherent methods where that keeps the diff reviewable. - Removed all direct first-party `async-trait` dependencies and the workspace dependency declaration. - Added a cargo-deny policy that permits `async-trait` only through the remaining transitive wrapper crates. - Updated `rand` from 0.8.5 to 0.8.6 to resolve RUSTSEC-2026-0097 and keep the full cargo-deny check passing. ## Validation - `just test -p codex-exec-server`: 216 passed, 2 skipped. - `just test -p codex-model-provider`: 39 passed. - `just test -p codex-core` and `just test`: changed tests passed; remaining failures are environment-sensitive suites unrelated to this migration. - `cargo deny check` - `just fix` - `just fmt` - `cargo shear` - `just bazel-lock-check`
This commit is contained in:
1 parent
1829ed1122
commit
5a56caf18c
98 files changed
+2010
-1050
No files matched your search
@@ -3,6 +3,7 @@ use codex_cloud_tasks_client::ApplyOutcome;
|
||||
use codex_cloud_tasks_client::ApplyStatus;
|
||||
use codex_cloud_tasks_client::AttemptStatus;
|
||||
use codex_cloud_tasks_client::CloudBackend;
|
||||
use codex_cloud_tasks_client::CloudBackendFuture;
|
||||
use codex_cloud_tasks_client::CloudTaskError;
|
||||
use codex_cloud_tasks_client::CreatedTask;
|
||||
use codex_cloud_tasks_client::DiffSummary;
|
||||
@@ -17,8 +18,7 @@ use codex_cloud_tasks_client::TurnAttempt;
|
||||
#[derive(Clone, Default)]
|
||||
pub struct MockClient;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl CloudBackend for MockClient {
|
||||
impl MockClient {
|
||||
async fn list_tasks(
|
||||
&self,
|
||||
_env: Option<&str>,
|
||||
@@ -160,6 +160,70 @@ impl CloudBackend for MockClient {
|
||||
}
|
||||
}
|
||||
|
||||
impl CloudBackend for MockClient {
|
||||
fn list_tasks<'a>(
|
||||
&'a self,
|
||||
env: Option<&'a str>,
|
||||
limit: Option<i64>,
|
||||
cursor: Option<&'a str>,
|
||||
) -> CloudBackendFuture<'a, TaskListPage> {
|
||||
Box::pin(MockClient::list_tasks(self, env, limit, cursor))
|
||||
}
|
||||
|
||||
fn get_task_summary(&self, id: TaskId) -> CloudBackendFuture<'_, TaskSummary> {
|
||||
Box::pin(MockClient::get_task_summary(self, id))
|
||||
}
|
||||
|
||||
fn get_task_diff(&self, id: TaskId) -> CloudBackendFuture<'_, Option<String>> {
|
||||
Box::pin(MockClient::get_task_diff(self, id))
|
||||
}
|
||||
|
||||
fn get_task_messages(&self, id: TaskId) -> CloudBackendFuture<'_, Vec<String>> {
|
||||
Box::pin(MockClient::get_task_messages(self, id))
|
||||
}
|
||||
|
||||
fn get_task_text(&self, id: TaskId) -> CloudBackendFuture<'_, TaskText> {
|
||||
Box::pin(MockClient::get_task_text(self, id))
|
||||
}
|
||||
|
||||
fn apply_task(
|
||||
&self,
|
||||
id: TaskId,
|
||||
diff_override: Option<String>,
|
||||
) -> CloudBackendFuture<'_, ApplyOutcome> {
|
||||
Box::pin(MockClient::apply_task(self, id, diff_override))
|
||||
}
|
||||
|
||||
fn apply_task_preflight(
|
||||
&self,
|
||||
id: TaskId,
|
||||
diff_override: Option<String>,
|
||||
) -> CloudBackendFuture<'_, ApplyOutcome> {
|
||||
Box::pin(MockClient::apply_task_preflight(self, id, diff_override))
|
||||
}
|
||||
|
||||
fn list_sibling_attempts(
|
||||
&self,
|
||||
task: TaskId,
|
||||
turn_id: String,
|
||||
) -> CloudBackendFuture<'_, Vec<TurnAttempt>> {
|
||||
Box::pin(MockClient::list_sibling_attempts(self, task, turn_id))
|
||||
}
|
||||
|
||||
fn create_task<'a>(
|
||||
&'a self,
|
||||
env_id: &'a str,
|
||||
prompt: &'a str,
|
||||
git_ref: &'a str,
|
||||
qa_mode: bool,
|
||||
best_of_n: usize,
|
||||
) -> CloudBackendFuture<'a, CreatedTask> {
|
||||
Box::pin(MockClient::create_task(
|
||||
self, env_id, prompt, git_ref, qa_mode, best_of_n,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn mock_diff_for(id: &TaskId) -> String {
|
||||
match id.0.as_str() {
|
||||
"T-1000" => {
|
||||
|
||||
Reference in new issue
Block a user