mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
Record multi-agent wait duration by outcome (#51332)
## What changed Record elapsed time for completed `wait_agent` waits in `codex.multi_agent.wait.duration_ms`, with an `outcome` tag of `mailbox`, `steered`, or `timed_out`. Exclude dropped waits because they have no observed outcome. GitOrigin-RevId: 6378b98bfadab69d47aa2e9c93fa9d720f9cd0ef
This commit is contained in:
@@ -91,8 +91,23 @@ impl Handler {
|
||||
)
|
||||
.await;
|
||||
|
||||
let deadline = Instant::now() + Duration::from_millis(timeout_ms as u64);
|
||||
let wait_started = Instant::now();
|
||||
let deadline = wait_started + Duration::from_millis(timeout_ms as u64);
|
||||
let outcome = wait_for_activity(&mut activity_rx, pending_activity, deadline).await;
|
||||
// A completed wait may wake for a message, user input, or its timeout.
|
||||
// Dropped waits do not have an observed outcome and are not included.
|
||||
turn.session_telemetry.record_duration(
|
||||
"codex.multi_agent.wait.duration_ms",
|
||||
wait_started.elapsed(),
|
||||
&[(
|
||||
"outcome",
|
||||
match outcome {
|
||||
WaitOutcome::MailboxActivity => "mailbox",
|
||||
WaitOutcome::Steered => "steered",
|
||||
WaitOutcome::TimedOut => "timed_out",
|
||||
},
|
||||
)],
|
||||
);
|
||||
let result = WaitAgentResult::from_outcome(outcome, requested_timeout_ms, timeout_ms);
|
||||
|
||||
session
|
||||
|
||||
Reference in New Issue
Block a user