mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
Expand per-turn critical path capture and split inference timing (#59245)
## What changed - Report sampling and compaction separately as `critical_path_sampling_ms` and `critical_path_compaction_ms`, retaining `critical_path_inference_ms` as their combined compatibility total. - Enable critical path capture for subagent and Guardian turns when `CriticalPathTiming` is enabled, while continuing to exclude memory consolidation sessions. - Preserve capture across incoming agent messages and support direct `spawn_agent` and `wait_agent` calls. Attribute these calls to the parent's tool time and keep child work on the child's own turn. ## Testing Add runtime coverage for independent parent/child timing, incoming agent messages, Guardian turns, feature gating, and memory consolidation exclusion. Update phase accounting and analytics tests to cover the new fields and millisecond truncation. GitOrigin-RevId: 09d4c0b853e817216bed173e4404d0d782de97ec
This commit is contained in:
@@ -4461,14 +4461,6 @@ impl Session {
|
||||
communication: impl Into<crate::PendingAgentMessage>,
|
||||
) {
|
||||
let communication = communication.into();
|
||||
// Agent-message dependencies are not captured by direct-tool timing.
|
||||
if turn_context
|
||||
.config
|
||||
.features
|
||||
.enabled(Feature::CriticalPathTiming)
|
||||
{
|
||||
turn_context.turn_timing_state.invalidate_critical_path();
|
||||
}
|
||||
let mut response_item = communication.to_model_input_item();
|
||||
if let ResponseItem::AgentMessage {
|
||||
content,
|
||||
|
||||
@@ -2834,22 +2834,7 @@ async fn inter_agent_communication_waits_for_confirmed_delivery_persistence() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn record_inter_agent_communication_sets_turn_id_in_rollout_and_resume() {
|
||||
let (mut session, mut turn_context) = make_session_and_context().await;
|
||||
Arc::make_mut(&mut turn_context.config)
|
||||
.features
|
||||
.enable(Feature::CriticalPathTiming)
|
||||
.unwrap();
|
||||
turn_context.turn_timing_state.enable_critical_path();
|
||||
turn_context
|
||||
.turn_timing_state
|
||||
.mark_turn_started(std::time::Instant::now())
|
||||
.await;
|
||||
assert!(
|
||||
turn_context
|
||||
.turn_timing_state
|
||||
.snapshot_path(std::time::Instant::now())
|
||||
.is_some()
|
||||
);
|
||||
let (mut session, turn_context) = make_session_and_context().await;
|
||||
let rollout_path = attach_thread_persistence(&mut session).await;
|
||||
let communication = InterAgentCommunication::new(
|
||||
AgentPath::root().join("worker").expect("worker path"),
|
||||
@@ -2870,12 +2855,6 @@ async fn record_inter_agent_communication_sets_turn_id_in_rollout_and_resume() {
|
||||
.record_inter_agent_communication(&turn_context, turn_context.model_info(), communication)
|
||||
.await;
|
||||
|
||||
assert!(
|
||||
turn_context
|
||||
.turn_timing_state
|
||||
.snapshot_path(std::time::Instant::now())
|
||||
.is_none()
|
||||
);
|
||||
let recorded_history = session.clone_history().await;
|
||||
let recorded_items = raw_history_items(&recorded_history);
|
||||
let create_time = recorded_items[0]
|
||||
|
||||
Reference in New Issue
Block a user