From b90eeabd7455ebd031e4dc4149331eb8311722a4 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Wed, 24 Sep 2025 10:41:33 +0100 Subject: [PATCH 1/3] nit: update auto compact to 250k (#4135) update auto compact for gpt-5-codex to 250k --- codex-rs/core/src/openai_model_info.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codex-rs/core/src/openai_model_info.rs b/codex-rs/core/src/openai_model_info.rs index 3df00fbbc0..b413ccc7f4 100644 --- a/codex-rs/core/src/openai_model_info.rs +++ b/codex-rs/core/src/openai_model_info.rs @@ -64,7 +64,7 @@ pub(crate) fn get_model_info(model_family: &ModelFamily) -> Option { _ if slug.starts_with("gpt-5-codex") => Some(ModelInfo { context_window: 272_000, max_output_tokens: 128_000, - auto_compact_token_limit: Some(220_000), + auto_compact_token_limit: Some(250_000), }), _ if slug.starts_with("gpt-5") => Some(ModelInfo::new(272_000, 128_000)), From af6304c641df4dd7a2fc11974840da0ee5a855b7 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Wed, 24 Sep 2025 10:47:12 +0100 Subject: [PATCH 2/3] nit: drop instruction override for auto-compact (#4137) drop instruction override for auto-compact as this is not used and dangerous as it invalidates the cache --- codex-rs/core/src/codex/compact.rs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/codex-rs/core/src/codex/compact.rs b/codex-rs/core/src/codex/compact.rs index 016f406f33..8f213d4e7e 100644 --- a/codex-rs/core/src/codex/compact.rs +++ b/codex-rs/core/src/codex/compact.rs @@ -55,7 +55,7 @@ pub(super) async fn run_inline_auto_compact_task( let input = vec![InputItem::Text { text: SUMMARIZATION_PROMPT.to_string(), }]; - run_compact_task_inner(sess, turn_context, sub_id, input, None, false).await; + run_compact_task_inner(sess, turn_context, sub_id, input, false).await; } pub(super) async fn run_compact_task( @@ -71,15 +71,7 @@ pub(super) async fn run_compact_task( }), }; sess.send_event(start_event).await; - run_compact_task_inner( - sess.clone(), - turn_context, - sub_id.clone(), - input, - None, - true, - ) - .await; + run_compact_task_inner(sess.clone(), turn_context, sub_id.clone(), input, true).await; let event = Event { id: sub_id, msg: EventMsg::TaskComplete(TaskCompleteEvent { @@ -94,7 +86,6 @@ async fn run_compact_task_inner( turn_context: Arc, sub_id: String, input: Vec, - instructions_override: Option, remove_task_on_completion: bool, ) { let initial_input_for_turn: ResponseInputItem = ResponseInputItem::from(input); @@ -104,9 +95,7 @@ async fn run_compact_task_inner( let prompt = Prompt { input: turn_input, - tools: Vec::new(), - base_instructions_override: instructions_override, - output_schema: None, + ..Default::default() }; let max_retries = turn_context.client.get_provider().stream_max_retries(); From 5b910f1f05f4484692babcb78e95c42408adf630 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Wed, 24 Sep 2025 11:15:54 +0100 Subject: [PATCH 3/3] chore: extract readiness in a dedicated utils crate (#4140) Create an `utils` directory for the small utils crates --- codex-rs/Cargo.lock | 31 ++++++++++++------- codex-rs/Cargo.toml | 4 ++- codex-rs/common/Cargo.toml | 3 -- codex-rs/common/src/lib.rs | 2 -- codex-rs/utils/readiness/Cargo.toml | 16 ++++++++++ .../readiness/src/lib.rs} | 0 6 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 codex-rs/utils/readiness/Cargo.toml rename codex-rs/{common/src/readiness.rs => utils/readiness/src/lib.rs} (100%) 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