From a02016416147128a85b8388e556c487f5caad7c5 Mon Sep 17 00:00:00 2001 From: Spencer Tang Date: Wed, 8 Apr 2026 16:48:49 -0400 Subject: [PATCH] fix(core): apply history truncation to ChatRecordingService --- packages/core/src/services/chatRecordingService.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/src/services/chatRecordingService.ts b/packages/core/src/services/chatRecordingService.ts index c71519f858..c2afc8867a 100644 --- a/packages/core/src/services/chatRecordingService.ts +++ b/packages/core/src/services/chatRecordingService.ts @@ -577,6 +577,12 @@ export class ChatRecordingService { ) { const conversation = this.readConversation(); updateFn(conversation); + // Enforce a hard limit of 1000 items to prevent unbounded memory and file growth + if (conversation.messages.length > 1000) { + conversation.messages = conversation.messages.slice( + conversation.messages.length - 1000, + ); + } this.writeConversation(conversation); }