From bf612d0c2a6911295fcca9c233927e3facec1d17 Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Fri, 21 Nov 2025 17:13:19 +0100 Subject: [PATCH 1/2] Add AskApproval event --- packages/types/src/telemetry.ts | 1 + .../kilocode/captureAskApprovalEvent.ts | 10 ++++++++++ src/core/assistant-message/presentAssistantMessage.ts | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 src/core/assistant-message/kilocode/captureAskApprovalEvent.ts diff --git a/packages/types/src/telemetry.ts b/packages/types/src/telemetry.ts index cd6be8c5440..7fed0593c0d 100644 --- a/packages/types/src/telemetry.ts +++ b/packages/types/src/telemetry.ts @@ -40,6 +40,7 @@ export enum TelemetryEventName { AUTO_PURGE_FAILED = "Auto Purge Failed", MANUAL_PURGE_TRIGGERED = "Manual Purge Triggered", GHOST_SERVICE_DISABLED = "Ghost Service Disabled", + ASK_APPROVAL = "Ask Approval", // kilocode_change end TASK_CREATED = "Task Created", diff --git a/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts b/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts new file mode 100644 index 00000000000..13393c338c2 --- /dev/null +++ b/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts @@ -0,0 +1,10 @@ +import { TelemetryEventName, ToolName } from "@roo-code/types" +import { TelemetryService } from "@roo-code/telemetry" + +export function captureAskApproval(tool: ToolName, isApproved: boolean, isYoloMode: boolean) { + TelemetryService.instance.captureEvent(TelemetryEventName.ASK_APPROVAL, { + tool, + isApproved, + isYoloMode, + }) +} diff --git a/src/core/assistant-message/presentAssistantMessage.ts b/src/core/assistant-message/presentAssistantMessage.ts index e17872a9ad4..3eb0d6b7fdc 100644 --- a/src/core/assistant-message/presentAssistantMessage.ts +++ b/src/core/assistant-message/presentAssistantMessage.ts @@ -43,6 +43,7 @@ import { experiments, EXPERIMENT_IDS } from "../../shared/experiments" import { applyDiffToolLegacy } from "../tools/applyDiffTool" import { yieldPromise } from "../kilocode" import Anthropic from "@anthropic-ai/sdk" // kilocode_change +import { captureAskApproval } from "./kilocode/captureAskApprovalEvent" /** * Processes and presents assistant message content to the user interface. @@ -331,8 +332,10 @@ export async function presentAssistantMessage(cline: Task) { // Gatekeeper denied the action pushToolResult(formatResponse.toolDenied()) cline.didRejectTool = true + captureAskApproval(block.name, false, true) return false } + captureAskApproval(block.name, true, true) return true } // kilocode_change end @@ -354,6 +357,7 @@ export async function presentAssistantMessage(cline: Task) { pushToolResult(formatResponse.toolDenied()) } cline.didRejectTool = true + captureAskApproval(block.name, false, false) // kilocode_change return false } @@ -363,6 +367,7 @@ export async function presentAssistantMessage(cline: Task) { pushToolResult(formatResponse.toolResult(formatResponse.toolApprovedWithFeedback(text), images)) } + captureAskApproval(block.name, true, false) // kilocode_change return true } From 9bbd63a5ce3542d547b45f4caf886803656d94dd Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Wed, 26 Nov 2025 12:09:12 +0100 Subject: [PATCH 2/2] Store auto-approve settings as well --- .../kilocode/captureAskApprovalEvent.ts | 8 ++--- .../presentAssistantMessage.ts | 8 ++--- src/core/webview/ClineProvider.ts | 32 ++++++++++++++++++- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts b/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts index 13393c338c2..de126a9e211 100644 --- a/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts +++ b/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts @@ -1,10 +1,6 @@ import { TelemetryEventName, ToolName } from "@roo-code/types" import { TelemetryService } from "@roo-code/telemetry" -export function captureAskApproval(tool: ToolName, isApproved: boolean, isYoloMode: boolean) { - TelemetryService.instance.captureEvent(TelemetryEventName.ASK_APPROVAL, { - tool, - isApproved, - isYoloMode, - }) +export function captureAskApproval(tool: ToolName, isApproved: boolean) { + TelemetryService.instance.captureEvent(TelemetryEventName.ASK_APPROVAL, { tool, isApproved }) } diff --git a/src/core/assistant-message/presentAssistantMessage.ts b/src/core/assistant-message/presentAssistantMessage.ts index 48037fc7acb..e1ab2942cc8 100644 --- a/src/core/assistant-message/presentAssistantMessage.ts +++ b/src/core/assistant-message/presentAssistantMessage.ts @@ -335,10 +335,10 @@ export async function presentAssistantMessage(cline: Task) { // Gatekeeper denied the action pushToolResult(formatResponse.toolDenied()) cline.didRejectTool = true - captureAskApproval(block.name, false, true) + captureAskApproval(block.name, false) return false } - captureAskApproval(block.name, true, true) + captureAskApproval(block.name, true) return true } // kilocode_change end @@ -360,7 +360,7 @@ export async function presentAssistantMessage(cline: Task) { pushToolResult(formatResponse.toolDenied()) } cline.didRejectTool = true - captureAskApproval(block.name, false, false) // kilocode_change + captureAskApproval(block.name, false) // kilocode_change return false } @@ -370,7 +370,7 @@ export async function presentAssistantMessage(cline: Task) { pushToolResult(formatResponse.toolResult(formatResponse.toolApprovedWithFeedback(text), images)) } - captureAskApproval(block.name, true, false) // kilocode_change + captureAskApproval(block.name, true) // kilocode_change return true } diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index b874eaa58f3..4d95547879b 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -3128,7 +3128,8 @@ ${prompt} public async getTelemetryProperties(): Promise { // kilocode_change start - const { apiConfiguration, experiments } = await this.getState() + const state = await this.getState() + const { apiConfiguration, experiments } = state const task = this.getCurrentTask() async function getModelId() { @@ -3187,6 +3188,34 @@ ${prompt} } } } + + const getAutoApproveSettings = () => { + try { + return { + autoApprove: { + autoApprovalEnabled: !!state.autoApprovalEnabled, + alwaysAllowBrowser: !!state.alwaysAllowBrowser, + alwaysAllowExecute: !!state.alwaysAllowExecute, + alwaysAllowFollowupQuestions: !!state.alwaysAllowFollowupQuestions, + alwaysAllowMcp: !!state.alwaysAllowMcp, + alwaysAllowModeSwitch: !!state.alwaysAllowModeSwitch, + alwaysAllowReadOnly: !!state.alwaysAllowReadOnly, + alwaysAllowReadOnlyOutsideWorkspace: !!state.alwaysAllowReadOnlyOutsideWorkspace, + alwaysAllowSubtasks: !!state.alwaysAllowSubtasks, + alwaysAllowUpdateTodoList: !!state.alwaysAllowUpdateTodoList, + alwaysAllowWrite: !!state.alwaysAllowWrite, + alwaysAllowWriteOutsideWorkspace: !!state.alwaysAllowWriteOutsideWorkspace, + alwaysAllowWriteProtected: !!state.alwaysAllowWriteProtected, + alwaysApproveResubmit: !!state.alwaysApproveResubmit, + yoloModel: !!state.yoloMode, + }, + } + } catch (error) { + return { + autoApproveException: stringifyError(error), + } + } + } // kilocode_change end return { @@ -3197,6 +3226,7 @@ ${prompt} ...getMemory(), ...getFastApply(), ...getOpenRouter(), + ...getAutoApproveSettings(), // kilocode_change end ...(await this.getTaskProperties()), ...(await this.getGitProperties()),