From 6723c72fa5468be713c05205c75be532729e8f92 Mon Sep 17 00:00:00 2001 From: Jerop Kipruto Date: Thu, 12 Jun 2025 16:48:10 -0400 Subject: telemetry: include user decisions in tool call logs (#966) Add the user's decision (accept, reject, modify) to tool call telemetry to better understand user intent. The decision provides crucial context to the `success` metric, as a user can reject a call that would have succeeded or accept one that fails. Also prettify the arguments json. Example: ![image](https://github.com/user-attachments/assets/251cb9fc-ceaa-4cdd-929c-8de47031aca8) #750 --- packages/cli/src/ui/hooks/useReactToolScheduler.ts | 28 ++-------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'packages/cli/src/ui/hooks/useReactToolScheduler.ts') diff --git a/packages/cli/src/ui/hooks/useReactToolScheduler.ts b/packages/cli/src/ui/hooks/useReactToolScheduler.ts index 0faccb2a..7f08c81f 100644 --- a/packages/cli/src/ui/hooks/useReactToolScheduler.ts +++ b/packages/cli/src/ui/hooks/useReactToolScheduler.ts @@ -20,7 +20,6 @@ import { Tool, ToolCall, Status as CoreStatus, - logToolCall, EditorType, } from '@gemini-cli/core'; import { useCallback, useState, useMemo } from 'react'; @@ -108,33 +107,9 @@ export function useReactToolScheduler( const allToolCallsCompleteHandler: AllToolCallsCompleteHandler = useCallback( (completedToolCalls) => { - completedToolCalls.forEach((call) => { - let success = false; - let errorMessage: string | undefined; - let duration = 0; - - if (call.status === 'success') { - success = true; - } - if ( - call.status === 'error' && - typeof call.response.resultDisplay === 'string' - ) { - errorMessage = call.response.resultDisplay; - } - duration = call.durationMs || 0; - - logToolCall(config, { - function_name: call.request.name, - function_args: call.request.args, - duration_ms: duration, - success, - error: errorMessage, - }); - }); onComplete(completedToolCalls); }, - [onComplete, config], + [onComplete], ); const toolCallsUpdateHandler: ToolCallsUpdateHandler = useCallback( @@ -165,6 +140,7 @@ export function useReactToolScheduler( onToolCallsUpdate: toolCallsUpdateHandler, approvalMode: config.getApprovalMode(), getPreferredEditor, + config, }), [ config, -- cgit v1.2.3