diff --git a/packages/core/src/core/client.test.ts b/packages/core/src/core/client.test.ts index bb5d5093a1..2bb2836595 100644 --- a/packages/core/src/core/client.test.ts +++ b/packages/core/src/core/client.test.ts @@ -303,6 +303,17 @@ describe('Gemini Client (client.ts)', () => { }); }); + describe('resumeChat', () => { + it('should update telemetry token count when a chat is resumed', async () => { + const history: Content[] = [ + { role: 'user', parts: [{ text: 'resumed message' }] }, + ]; + await client.resumeChat(history); + + expect(uiTelemetryService.setLastPromptTokenCount).toHaveBeenCalled(); + }); + }); + describe('resetChat', () => { it('should create a new chat session, clearing the old history', async () => { // 1. Get the initial chat instance and add some history. diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts index db829e7eb2..ba4092ec1a 100644 --- a/packages/core/src/core/client.ts +++ b/packages/core/src/core/client.ts @@ -269,6 +269,7 @@ export class GeminiClient { resumedSessionData?: ResumedSessionData, ): Promise { this.chat = await this.startChat(history, resumedSessionData); + this.updateTelemetryTokenCount(); } getChatRecordingService(): ChatRecordingService | undefined {