feat(logging): Add clearcut logging for disabling loop detection (#8503)

This commit is contained in:
Sandy Tao
2025-09-15 14:12:39 -07:00
committed by GitHub
parent 2e12a67198
commit f7ff26ba65
5 changed files with 47 additions and 2 deletions
@@ -49,6 +49,7 @@ export enum EventNames {
FLASH_FALLBACK = 'flash_fallback',
RIPGREP_FALLBACK = 'ripgrep_fallback',
LOOP_DETECTED = 'loop_detected',
LOOP_DETECTION_DISABLED = 'loop_detection_disabled',
NEXT_SPEAKER_CHECK = 'next_speaker_check',
SLASH_COMMAND = 'slash_command',
MALFORMED_JSON_RESPONSE = 'malformed_json_response',
@@ -657,6 +658,15 @@ export class ClearcutLogger {
this.flushIfNeeded();
}
logLoopDetectionDisabledEvent(): void {
const data: EventValue[] = [];
this.enqueueLogEvent(
this.createLogEvent(EventNames.LOOP_DETECTION_DISABLED, data),
);
this.flushIfNeeded();
}
logNextSpeakerCheck(event: NextSpeakerCheckEvent): void {
const data: EventValue[] = [
{
+8
View File
@@ -41,6 +41,7 @@ import type {
FlashFallbackEvent,
NextSpeakerCheckEvent,
LoopDetectedEvent,
LoopDetectionDisabledEvent,
SlashCommandEvent,
ConversationFinishedEvent,
KittySequenceOverflowEvent,
@@ -441,6 +442,13 @@ export function logLoopDetected(
logger.emit(logRecord);
}
export function logLoopDetectionDisabled(
config: Config,
_event: LoopDetectionDisabledEvent,
): void {
ClearcutLogger.getInstance(config)?.logLoopDetectionDisabledEvent();
}
export function logNextSpeakerCheck(
config: Config,
event: NextSpeakerCheckEvent,
+13
View File
@@ -313,6 +313,18 @@ export class LoopDetectedEvent implements BaseTelemetryEvent {
}
}
export class LoopDetectionDisabledEvent implements BaseTelemetryEvent {
'event.name': 'loop_detection_disabled';
'event.timestamp': string;
prompt_id: string;
constructor(prompt_id: string) {
this['event.name'] = 'loop_detection_disabled';
this['event.timestamp'] = new Date().toISOString();
this.prompt_id = prompt_id;
}
}
export class NextSpeakerCheckEvent implements BaseTelemetryEvent {
'event.name': 'next_speaker_check';
'event.timestamp': string;
@@ -524,6 +536,7 @@ export type TelemetryEvent =
| ApiResponseEvent
| FlashFallbackEvent
| LoopDetectedEvent
| LoopDetectionDisabledEvent
| NextSpeakerCheckEvent
| KittySequenceOverflowEvent
| MalformedJsonResponseEvent