Log yolo mode + number of turns (#6055)

Co-authored-by: Shi Shu <shii@google.com>
This commit is contained in:
shishu314
2025-08-25 16:06:47 -04:00
committed by GitHub
parent f32a54fefc
commit cd75d94262
9 changed files with 103 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ import {
SlashCommandEvent,
MalformedJsonResponseEvent,
IdeConnectionEvent,
ConversationFinishedEvent,
KittySequenceOverflowEvent,
ChatCompressionEvent,
FileOperationEvent,
@@ -47,6 +48,7 @@ export enum EventNames {
IDE_CONNECTION = 'ide_connection',
KITTY_SEQUENCE_OVERFLOW = 'kitty_sequence_overflow',
CHAT_COMPRESSION = 'chat_compression',
CONVERSATION_FINISHED = 'conversation_finished',
}
export interface LogResponse {
@@ -728,6 +730,28 @@ export class ClearcutLogger {
this.flushIfNeeded();
}
logConversationFinishedEvent(event: ConversationFinishedEvent): void {
const data: EventValue[] = [
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_SESSION_ID,
value: this.config?.getSessionId() ?? '',
},
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_CONVERSATION_TURN_COUNT,
value: JSON.stringify(event.turnCount),
},
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_APPROVAL_MODE,
value: event.approvalMode,
},
];
this.enqueueLogEvent(
this.createLogEvent(EventNames.CONVERSATION_FINISHED, data),
);
this.flushIfNeeded();
}
logKittySequenceOverflowEvent(event: KittySequenceOverflowEvent): void {
const data: EventValue[] = [
{

View File

@@ -232,6 +232,16 @@ export enum EventMetadataKey {
// Logs the length of the kitty sequence that overflowed.
GEMINI_CLI_KITTY_SEQUENCE_LENGTH = 53,
// ==========================================================================
// Conversation Finished Event Keys
// ===========================================================================
// Logs the approval mode
GEMINI_CLI_APPROVAL_MODE = 70,
// Logs the number of turns
GEMINI_CLI_CONVERSATION_TURN_COUNT = 71,
// Logs the number of tokens before context window compression.
GEMINI_CLI_COMPRESSION_TOKENS_BEFORE = 60,