Add Guardian V2 analytics events (#42144)

## What changed

- Emit `codex_guardian_v2_classification` events with the outcome, risk
  level, duration, model, and thread attribution.
- Emit `codex_guardian_v2_fast_decision` events when Guardian V2 approves an
  action without a full review.
- Add `guardian_v2_enabled` to turn analytics, accounting for review scope
  and model requirements.

## Testing

- Extend the Guardian V2 app-server coverage to verify event payloads,
  attribution, enablement state, and scoped event emission.

GitOrigin-RevId: 0805975f8e8f9d954aa1058ea8c60545a090ae74
This commit is contained in:
jif authored and copyberry committed 2026-09-01 22:02:42 +00:00
1 parent a876a9e494
commit 86b7d12742
17 files changed
+272 -20

No files matched your search

+12
View File
@@ -1029,6 +1029,18 @@ async fn track_turn_resolved_config_analytics(
.and_then(ServiceTier::from_request_value),
approval_policy: turn_context.approval_policy(),
approvals_reviewer: turn_context.config.approvals_reviewer,
guardian_v2_enabled: sess
.services
.thread_extension_data
.get::<codex_extension_api::GuardianV2Enabled>()
.is_some_and(|state| {
state.computer_use_only
|| !turn_context
.config
.config_layer_stack
.requirements()
.auto_review_required_for_model(&turn_context.model_info().slug)
}),
sandbox_network_access: turn_context.network_sandbox_policy().is_enabled(),
collaboration_mode: turn_context.mode(),
personality: turn_context.personality(),