Lightweight coding agent that runs in your terminal
Rust
core: overlap diff root discovery with world state (#30286)
Adam Perry @ OpenAI3ae0543fddd7
diff --git a/codex-rs/core/src/session/turn.rs b/codex-rs/core/src/session/turn.rsindex 7b509ae42e..2e948b9c1e 100644--- a/codex-rs/core/src/session/turn.rs+++ b/codex-rs/core/src/session/turn.rs@@ -167,9 +167,10 @@ pub(crate) async fn run_turn(// run_turn owns the step used to seed context and make the first sampling request.let first_step_context = sess.capture_step_context(Arc::clone(&turn_context)).await;// Keep the exact model-visible state used by this turn and its inline compactions.- let mut world_state = sess- .record_context_updates_and_set_reference_context_item(first_step_context.as_ref())- .await;+ let (mut world_state, display_roots) = tokio::join!(+ sess.record_context_updates_and_set_reference_context_item(first_step_context.as_ref()),+ turn_diff_display_roots(turn_context.as_ref()),+ );let Some((injection_items, explicitly_enabled_connectors)) = build_skills_and_plugins(&sess,@@ -209,7 +210,6 @@ pub(crate) async fn run_turn(let mut stop_hook_active = false;// Although from the perspective of codex.rs, TurnDiffTracker has the lifecycle of a Task which contains// many turns, from the perspective of the user, it is a single turn.- let display_roots = turn_diff_display_roots(turn_context.as_ref()).await;let turn_diff_tracker = Arc::new(tokio::sync::Mutex::new(TurnDiffTracker::with_environment_display_roots(display_roots),));