[codex-analytics] add tool review event schema

This commit is contained in:
rhan-oai
2026-05-04 16:34:43 -07:00
parent 25fcab2575
commit b978e3757a

View File

@@ -75,6 +75,8 @@ pub(crate) enum TrackEventRequest {
WebSearch(CodexWebSearchEventRequest),
#[allow(dead_code)]
ImageGeneration(CodexImageGenerationEventRequest),
#[allow(dead_code)]
ToolCallReview(CodexToolCallReviewEventRequest),
PluginUsed(CodexPluginUsedEventRequest),
PluginInstalled(CodexPluginEventRequest),
PluginUninstalled(CodexPluginEventRequest),
@@ -462,6 +464,74 @@ pub(crate) struct CodexToolItemEventBase {
pub(crate) requested_network_access: bool,
}
#[allow(dead_code)]
#[derive(Clone, Copy, Debug, Serialize)]
#[serde(rename_all = "snake_case")]
pub(crate) enum ToolReviewToolKind {
CommandExecution,
FileChange,
McpToolCall,
Permissions,
NetworkAccess,
}
#[allow(dead_code)]
#[derive(Clone, Copy, Debug, Serialize)]
#[serde(rename_all = "snake_case")]
pub(crate) enum ToolReviewReviewer {
Guardian,
User,
}
#[allow(dead_code)]
#[derive(Clone, Copy, Debug, Serialize)]
#[serde(rename_all = "snake_case")]
pub(crate) enum ToolReviewTrigger {
Initial,
SandboxRetry,
NetworkRetry,
SubcommandExecve,
}
#[allow(dead_code)]
#[derive(Clone, Copy, Debug, Serialize)]
#[serde(rename_all = "snake_case")]
pub(crate) enum ToolReviewStatus {
Approved,
ApprovedForSession,
ApprovedExecpolicyAmendment,
NetworkPolicyAllow,
NetworkPolicyDeny,
Denied,
Aborted,
TimedOut,
}
#[derive(Serialize)]
pub(crate) struct CodexToolCallReviewEventParams {
pub(crate) thread_id: String,
pub(crate) turn_id: String,
pub(crate) item_id: Option<String>,
pub(crate) review_id: String,
pub(crate) thread_source: Option<&'static str>,
pub(crate) subagent_source: Option<String>,
pub(crate) parent_thread_id: Option<String>,
pub(crate) tool_kind: ToolReviewToolKind,
pub(crate) tool_name: String,
pub(crate) reviewer: ToolReviewReviewer,
pub(crate) trigger: ToolReviewTrigger,
pub(crate) status: ToolReviewStatus,
pub(crate) created_at: u64,
pub(crate) completed_at: Option<u64>,
pub(crate) duration_ms: Option<u64>,
}
#[derive(Serialize)]
pub(crate) struct CodexToolCallReviewEventRequest {
pub(crate) event_type: &'static str,
pub(crate) event_params: CodexToolCallReviewEventParams,
}
#[allow(dead_code)]
#[derive(Clone, Copy, Debug, Serialize)]
#[serde(rename_all = "snake_case")]