Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Scope Guardian V2 response timing to snapshot sampling (#51065)

swastik-oai315f0efb3488
diff --git a/codex-rs/ext/guardian-v2/src/async_scorer/classification.rs b/codex-rs/ext/guardian-v2/src/async_scorer/classification.rs
index abfa27f22d..541e2a9024 100644
--- a/codex-rs/ext/guardian-v2/src/async_scorer/classification.rs
+++ b/codex-rs/ext/guardian-v2/src/async_scorer/classification.rs
@@ -308,7 +308,6 @@ impl Classification {
parent_turn_id: turn_id.clone(),
root_turn_id,
};
- let mut sampling_started = Instant::now();
let result = match transcript {
ClassificationContext::Snapshot(context) => {
sampling.input = context.into_messages();
@@ -325,8 +324,10 @@ impl Classification {
"not_initialized",
);
}
- sampling_started = Instant::now();
- sampler.sample(sampling).await
+ let sampling_started = Instant::now();
+ let result = sampler.sample(sampling).await;
+ responses_duration = Some(sampling_started.elapsed());
+ result
}
ClassificationContext::Conversation {
@@ -358,7 +359,6 @@ impl Classification {
score.await.unwrap_or(Err(LunaSamplerError::Superseded))
}
};
- responses_duration = Some(sampling_started.elapsed());
let output = match result {
Ok(output) => output,
Err(LunaSamplerError::Superseded) => {