From e8c1201db0640c99cbeefc38757403529046775a Mon Sep 17 00:00:00 2001 From: jif-oai Date: Thu, 25 Jun 2026 18:27:53 +0100 Subject: [PATCH] Simplify capability binding coverage --- codex-rs/core/src/thread_manager_tests.rs | 61 ++++--------------- .../exec-server/src/resolved_capability.rs | 12 ++-- 2 files changed, 15 insertions(+), 58 deletions(-) diff --git a/codex-rs/core/src/thread_manager_tests.rs b/codex-rs/core/src/thread_manager_tests.rs index b230eb12bb..0d407e19c5 100644 --- a/codex-rs/core/src/thread_manager_tests.rs +++ b/codex-rs/core/src/thread_manager_tests.rs @@ -613,7 +613,7 @@ async fn start_thread_seeds_extension_data_for_mcp_and_lifecycle_contributors() } #[tokio::test] -async fn selected_capability_roots_round_trip_through_fork_and_explicit_empty_wins() { +async fn selected_capability_roots_round_trip_through_fork() { let temp_dir = tempdir().expect("tempdir"); let mut config = test_config().await; config.codex_home = temp_dir.path().join("codex-home").abs(); @@ -633,20 +633,18 @@ async fn selected_capability_roots_round_trip_through_fork_and_explicit_empty_wi path: PathUri::parse("file:///plugins/demo").expect("plugin root URI"), }, }]; - let fork_history = || { - InitialHistory::Forked(vec![RolloutItem::SessionMeta(SessionMetaLine { - meta: SessionMeta { - selected_capability_roots: selected_roots.clone(), - ..SessionMeta::default() - }, - git: None, - })]) - }; - let inherited = manager .start_thread_with_options(StartThreadOptions { - config: config.clone(), - initial_history: fork_history(), + config, + initial_history: InitialHistory::Forked(vec![RolloutItem::SessionMeta( + SessionMetaLine { + meta: SessionMeta { + selected_capability_roots: selected_roots.clone(), + ..SessionMeta::default() + }, + git: None, + }, + )]), session_source: None, thread_source: None, dynamic_tools: Vec::new(), @@ -677,43 +675,6 @@ async fn selected_capability_roots_round_trip_through_fork_and_explicit_empty_wi inherited_history.get_selected_capability_roots(), selected_roots ); - - let mut explicit_empty = codex_extension_api::ExtensionDataInit::new(); - explicit_empty.insert(Vec::::new()); - let overridden = manager - .start_thread_with_options(StartThreadOptions { - config, - initial_history: fork_history(), - session_source: None, - thread_source: None, - dynamic_tools: Vec::new(), - metrics_service_name: None, - parent_trace: None, - environments: Vec::new(), - thread_extension_init: explicit_empty, - supports_openai_form_elicitation: false, - }) - .await - .expect("start explicitly empty fork"); - overridden.thread.ensure_rollout_materialized().await; - overridden - .thread - .flush_rollout() - .await - .expect("flush explicitly empty fork"); - let overridden_history = RolloutRecorder::get_rollout_history( - &overridden - .thread - .rollout_path() - .expect("explicitly empty fork rollout path"), - ) - .await - .expect("read explicitly empty fork rollout"); - - assert_eq!( - overridden_history.get_selected_capability_roots(), - Vec::new() - ); } #[tokio::test] diff --git a/codex-rs/exec-server/src/resolved_capability.rs b/codex-rs/exec-server/src/resolved_capability.rs index f590133eec..2902cf9eef 100644 --- a/codex-rs/exec-server/src/resolved_capability.rs +++ b/codex-rs/exec-server/src/resolved_capability.rs @@ -21,13 +21,6 @@ pub struct ResolvedSelectedCapabilityRoot { } impl ResolvedSelectedCapabilityRoot { - fn new(selected_root: SelectedCapabilityRoot, environment: Arc) -> Self { - Self { - selected_root, - environment, - } - } - pub fn selected_root(&self) -> &SelectedCapabilityRoot { &self.selected_root } @@ -70,7 +63,10 @@ impl EnvironmentManager { None => (Arc::clone(environments.get(environment_id)?), false), }; Some(( - ResolvedSelectedCapabilityRoot::new(selected_root.clone(), environment), + ResolvedSelectedCapabilityRoot { + selected_root: selected_root.clone(), + environment, + }, already_ready, )) })