mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
## 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`
54 lines
2.4 KiB
Rust
54 lines
2.4 KiB
Rust
use codex_protocol::ThreadId;
|
|
|
|
use crate::AgentGraphStoreResult;
|
|
use crate::ThreadSpawnEdgeStatus;
|
|
|
|
/// Storage-neutral boundary for persisted thread-spawn parent/child topology.
|
|
///
|
|
/// Implementations are expected to return stable ordering for list methods so callers can merge
|
|
/// persisted graph state with live in-memory state without introducing nondeterministic output.
|
|
pub trait AgentGraphStore: Send + Sync {
|
|
/// Insert or replace the directional parent/child edge for a spawned thread.
|
|
///
|
|
/// `child_thread_id` has at most one persisted parent. Re-inserting the same child should
|
|
/// update both the parent and status to match the supplied values.
|
|
fn upsert_thread_spawn_edge(
|
|
&self,
|
|
parent_thread_id: ThreadId,
|
|
child_thread_id: ThreadId,
|
|
status: ThreadSpawnEdgeStatus,
|
|
) -> impl std::future::Future<Output = AgentGraphStoreResult<()>> + Send;
|
|
|
|
/// Update the persisted lifecycle status of a spawned thread's incoming edge.
|
|
///
|
|
/// Implementations should treat missing children as a successful no-op.
|
|
fn set_thread_spawn_edge_status(
|
|
&self,
|
|
child_thread_id: ThreadId,
|
|
status: ThreadSpawnEdgeStatus,
|
|
) -> impl std::future::Future<Output = AgentGraphStoreResult<()>> + Send;
|
|
|
|
/// List direct spawned children of a parent thread.
|
|
///
|
|
/// When `status_filter` is `Some`, only child edges with that exact status are returned. When
|
|
/// it is `None`, all direct child edges are returned regardless of status, including statuses
|
|
/// that may be added by a future store implementation.
|
|
fn list_thread_spawn_children(
|
|
&self,
|
|
parent_thread_id: ThreadId,
|
|
status_filter: Option<ThreadSpawnEdgeStatus>,
|
|
) -> impl std::future::Future<Output = AgentGraphStoreResult<Vec<ThreadId>>> + Send;
|
|
|
|
/// List spawned descendants breadth-first by depth, then by thread id.
|
|
///
|
|
/// `status_filter` is applied to every traversed edge, not just to the returned descendants.
|
|
/// For example, `Some(Open)` walks only open edges, so descendants under a closed edge are not
|
|
/// included even if their own incoming edge is open. `None` walks and returns every persisted
|
|
/// edge regardless of status.
|
|
fn list_thread_spawn_descendants(
|
|
&self,
|
|
root_thread_id: ThreadId,
|
|
status_filter: Option<ThreadSpawnEdgeStatus>,
|
|
) -> impl std::future::Future<Output = AgentGraphStoreResult<Vec<ThreadId>>> + Send;
|
|
}
|