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

@@ -61,6 +61,15 @@ impl ToolExecutor<ToolInvocation> for ExtensionToolAdapter {
}
impl CoreToolRuntime for ExtensionToolAdapter {
fn is_builtin_control_tool(&self) -> bool {
let tool_name = self.0.tool_name();
tool_name.is_default_namespace()
&& matches!(
tool_name.name.as_str(),
"get_goal" | "create_goal" | "update_goal"
)
}
fn matches_kind(&self, payload: &ToolPayload) -> bool {
match payload {
ToolPayload::Function { .. } => true,
+5 -1
View File
@@ -96,7 +96,11 @@ impl PlanHandler {
}
}
impl CoreToolRuntime for PlanHandler {}
impl CoreToolRuntime for PlanHandler {
fn is_builtin_control_tool(&self) -> bool {
true
}
}
fn parse_update_plan_arguments(arguments: &str) -> Result<UpdatePlanArgs, FunctionCallError> {
serde_json::from_str::<UpdatePlanArgs>(arguments).map_err(|e| {
@@ -98,7 +98,11 @@ impl RequestUserInputHandler {
}
}
impl CoreToolRuntime for RequestUserInputHandler {}
impl CoreToolRuntime for RequestUserInputHandler {
fn is_builtin_control_tool(&self) -> bool {
true
}
}
#[cfg(test)]
#[path = "request_user_input_tests.rs"]
@@ -208,7 +208,11 @@ impl ViewImageHandler {
}
}
impl CoreToolRuntime for ViewImageHandler {}
impl CoreToolRuntime for ViewImageHandler {
fn is_builtin_control_tool(&self) -> bool {
true
}
}
pub struct ViewImageOutput {
image_url: String,