Track built-in control tool calls in analytics (#39510)

## What changed

- Emit `codex_control_tool_call_event` for built-in control tools such as
  `request_user_input`, `update_plan`, `view_image`, and goal tools.
- Record correlation and timing metadata plus completed, failed, rejected, or
  interrupted outcomes, and include these calls in turn-level tool counts.
- Keep tool arguments out of control-tool analytics events.

## Testing

- Extend the app-server turn profile test to cover successful and failed
  control tools, event correlation, turn counts, and argument exclusion.

GitOrigin-RevId: c20f73dfb79654e31b4b5040eddb0e0d91cae10d
This commit is contained in:
jif authored and copyberry committed 2026-08-19 15:55:38 +00:00
1 parent 6972c57c78
commit 992f5c681f
13 files changed
+343 -9

No files matched your search

+14
View File
@@ -82,6 +82,7 @@ pub(crate) enum TrackEventRequest {
FileChange(CodexFileChangeEventRequest),
McpToolCall(CodexMcpToolCallEventRequest),
DynamicToolCall(CodexDynamicToolCallEventRequest),
ControlToolCall(CodexControlToolCallEventRequest),
CollabAgentToolCall(CodexCollabAgentToolCallEventRequest),
WebSearch(CodexWebSearchEventRequest),
ImageGeneration(CodexImageGenerationEventRequest),
@@ -827,6 +828,19 @@ pub(crate) struct CodexDynamicToolCallEventRequest {
pub(crate) event_params: CodexDynamicToolCallEventParams,
}
#[derive(Serialize)]
pub(crate) struct CodexControlToolCallEventParams {
#[serde(flatten)]
pub(crate) base: CodexToolItemEventBase,
pub(crate) success: bool,
}
#[derive(Serialize)]
pub(crate) struct CodexControlToolCallEventRequest {
pub(crate) event_type: &'static str,
pub(crate) event_params: CodexControlToolCallEventParams,
}
#[derive(Serialize)]
pub(crate) struct CodexCollabAgentToolCallEventParams {
#[serde(flatten)]