Add Guardian v2 approval review metrics (#39224)

## What changed

- Pass metrics bound to the active turn's model to approval-review contributors.
- Add counter support to `ExtensionMetrics` while preserving host session attribution.
- Record Guardian v2 tool-call score lag and count stale-score fallbacks with the `score_lag` reason.

## Testing

- Cover counter forwarding and session metadata tags.
- Verify Guardian v2 metric samples for current and stale scores.

GitOrigin-RevId: 0ec34736d29d2e37ed217a27e773b4f6230ae38a
This commit is contained in:
Dylan Hurd authored and copyberry committed 2026-08-18 16:27:54 +00:00
1 parent 2a30972fcb
commit e7e13c68e2
15 files changed
+230 -16

No files matched your search

+3
View File
@@ -330,6 +330,9 @@ async fn run_guardian_review(
&session.services.session_extension_data,
&session.services.thread_extension_data,
&action.to_string(),
Some(crate::session::extension_metrics::from_session_telemetry(
turn.session_telemetry.clone(),
)),
)
.await
{
+1
View File
@@ -2999,6 +2999,7 @@ async fn escalated_retry_bypasses_extension_approval_and_runs_guardian() -> anyh
_session_store: &'a codex_extension_api::ExtensionData,
_thread_store: &'a codex_extension_api::ExtensionData,
_prompt: &'a str,
_extension_metrics: Option<Arc<dyn codex_extension_api::ExtensionMetrics>>,
) -> codex_extension_api::ExtensionFuture<'a, Option<ReviewDecision>> {
Box::pin(async move { Some(ReviewDecision::Approved) })
}