Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

chore: extract readiness in a dedicated utils crate (#4140)

jif-oai5b910f1f05f4
diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lock
index adac65d1fd..a90b17214b 100644
--- a/codex-rs/Cargo.lock
+++ b/codex-rs/Cargo.lock
@@ -664,13 +664,10 @@ dependencies = [
name = "codex-common"
version = "0.0.0"
dependencies = [
- "async-trait",
"clap",
"codex-core",
"codex-protocol",
"serde",
- "thiserror 2.0.16",
- "tokio",
"toml",
]
@@ -986,6 +983,16 @@ dependencies = [
"vt100",
]
+[[package]]
+name = "codex-utils-readiness"
+version = "0.0.0"
+dependencies = [
+ "async-trait",
+ "thiserror 2.0.16",
+ "time",
+ "tokio",
+]
+
[[package]]
name = "color-eyre"
version = "0.6.5"
@@ -1281,12 +1288,12 @@ dependencies = [
[[package]]
name = "deranged"
-version = "0.4.0"
+version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
+checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071"
dependencies = [
"powerfmt",
- "serde",
+ "serde_core",
]
[[package]]
@@ -4585,9 +4592,9 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.41"
+version = "0.3.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40"
+checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d"
dependencies = [
"deranged",
"itoa",
@@ -4602,15 +4609,15 @@ dependencies = [
[[package]]
name = "time-core"
-version = "0.1.4"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c"
+checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b"
[[package]]
name = "time-macros"
-version = "0.2.22"
+version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49"
+checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3"
dependencies = [
"num-conv",
"time-core",
diff --git a/codex-rs/Cargo.toml b/codex-rs/Cargo.toml
index 56364751bc..56bdf090e6 100644
--- a/codex-rs/Cargo.toml
+++ b/codex-rs/Cargo.toml
@@ -19,6 +19,7 @@ members = [
"protocol",
"protocol-ts",
"tui",
+ "utils/readiness",
]
resolver = "2"
@@ -49,6 +50,7 @@ codex-ollama = { path = "ollama" }
codex-protocol = { path = "protocol" }
codex-protocol-ts = { path = "protocol-ts" }
codex-tui = { path = "tui" }
+codex-utils-readiness = { path = "utils/readiness" }
core_test_support = { path = "core/tests/common" }
mcp-types = { path = "mcp-types" }
mcp_test_support = { path = "mcp-server/tests/common" }
@@ -191,7 +193,7 @@ unwrap_used = "deny"
# cargo-shear cannot see the platform-specific openssl-sys usage, so we
# silence the false positive here instead of deleting a real dependency.
[workspace.metadata.cargo-shear]
-ignored = ["openssl-sys"]
+ignored = ["openssl-sys", "codex-utils-readiness"]
[profile.release]
lto = "fat"
diff --git a/codex-rs/common/Cargo.toml b/codex-rs/common/Cargo.toml
index fe44be75aa..3ce84a6f50 100644
--- a/codex-rs/common/Cargo.toml
+++ b/codex-rs/common/Cargo.toml
@@ -7,14 +7,11 @@ version = { workspace = true }
workspace = true
[dependencies]
-async-trait = { workspace = true }
clap = { workspace = true, features = ["derive", "wrap_help"], optional = true }
codex-core = { workspace = true }
codex-protocol = { workspace = true }
serde = { workspace = true, optional = true }
toml = { workspace = true, optional = true }
-thiserror = { workspace = true }
-tokio = { workspace = true }
[features]
# Separate feature so that `clap` is not a mandatory dependency.
diff --git a/codex-rs/common/src/lib.rs b/codex-rs/common/src/lib.rs
index 2c5d91e1eb..292503f77e 100644
--- a/codex-rs/common/src/lib.rs
+++ b/codex-rs/common/src/lib.rs
@@ -34,5 +34,3 @@ pub mod model_presets;
// Shared approval presets (AskForApproval + Sandbox) used by TUI and MCP server
// Not to be confused with AskForApproval, which we should probably rename to EscalationPolicy.
pub mod approval_presets;
-// Readiness flag with token-based authorization and async waiting (Tokio).
-pub mod readiness;
diff --git a/codex-rs/utils/readiness/Cargo.toml b/codex-rs/utils/readiness/Cargo.toml
new file mode 100644
index 0000000000..faa5d4d13f
--- /dev/null
+++ b/codex-rs/utils/readiness/Cargo.toml
@@ -0,0 +1,16 @@
+[package]
+name = "codex-utils-readiness"
+version.workspace = true
+edition.workspace = true
+
+[dependencies]
+async-trait = { workspace = true }
+thiserror = { workspace = true }
+time = { workspace = true }
+tokio = { workspace = true, features = ["sync", "time"] }
+
+[dev-dependencies]
+tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread"] }
+
+[lints]
+workspace = true
diff --git a/codex-rs/common/src/readiness.rs b/codex-rs/utils/readiness/src/lib.rs
similarity index 100%
rename from codex-rs/common/src/readiness.rs
rename to codex-rs/utils/readiness/src/lib.rs